glm_freebsd/packager
BFS - map function across entries first BFS - now run the search
Types
pub type AppError {
AppError(String)
UnableToReadTomlFile(simplifile.FileError)
UnableToParseTomlText(tom.ParseError)
KeyNotFoundInToml(List(String), List(String))
UnexpectedTomlType(tom.Toml)
UnableToCreateStagingDir(simplifile.FileError)
UnableToGetTemplates(simplifile.FileError)
UnableToReadTemplate(String, simplifile.FileError)
UnableToPrepareTemplate(String, error.TokenizerError)
UnableToProjectTemplate(String, String, error.RuntimeError)
UnableToCreateProjectTemplateDir(
String,
String,
simplifile.FileError,
)
UnableToCreateOutputDir(simplifile.FileError)
UnableToAppendPlistFile(String, String, simplifile.FileError)
UnableToBuildPackage(#(Int, String))
UnexpectedPlistLineType(String)
UnableToGetPlistFiles(String, String, simplifile.FileError)
UnableToConvertToString(tom.GetError)
UnableToCompilePartialTemplate(error.TokenizerError)
UnableToCopyPlistDirectory(
String,
String,
String,
simplifile.FileError,
)
UnableToCopyTemplatesToDirectory(String, simplifile.FileError)
UnableToGetTemplatesFromDirectory(String, simplifile.FileError)
UnableToWriteProjectedTemplate(
String,
String,
simplifile.FileError,
)
UnableToCopyPlistFile(String, String, simplifile.FileError)
UnableToCreateMetadatDir(simplifile.FileError)
}
Constructors
-
AppError(String) -
UnableToReadTomlFile(simplifile.FileError) -
UnableToParseTomlText(tom.ParseError) -
KeyNotFoundInToml(List(String), List(String)) -
UnexpectedTomlType(tom.Toml) -
UnableToCreateStagingDir(simplifile.FileError) -
UnableToGetTemplates(simplifile.FileError) -
UnableToReadTemplate(String, simplifile.FileError) -
UnableToPrepareTemplate(String, error.TokenizerError) -
UnableToProjectTemplate(String, String, error.RuntimeError) -
UnableToCreateProjectTemplateDir( String, String, simplifile.FileError, ) -
UnableToCreateOutputDir(simplifile.FileError) -
UnableToAppendPlistFile(String, String, simplifile.FileError) -
UnableToBuildPackage(#(Int, String)) -
UnexpectedPlistLineType(String) -
UnableToGetPlistFiles(String, String, simplifile.FileError) -
UnableToConvertToString(tom.GetError) -
UnableToCompilePartialTemplate(error.TokenizerError) -
UnableToCopyPlistDirectory( String, String, String, simplifile.FileError, ) -
UnableToCopyTemplatesToDirectory(String, simplifile.FileError) -
UnableToGetTemplatesFromDirectory(String, simplifile.FileError) -
UnableToWriteProjectedTemplate( String, String, simplifile.FileError, ) -
UnableToCopyPlistFile(String, String, simplifile.FileError) -
UnableToCreateMetadatDir(simplifile.FileError)
Configuration object built from the gleam.toml.
pub type Config {
Config(
app_name: String,
app_version: String,
pkg_user_name: String,
pkg_user_uid: String,
pkg_description: String,
pkg_maintainer: String,
pkg_dependencies: List(DependencyConfig),
pkg_proc_name: String,
pkg_config_dir: String,
pkg_path_extensions: String,
pkg_var_dir: String,
pkg_env_file: String,
pkg_prefix: String,
pkg_command: String,
pkg_command_args: String,
pkg_daemon_flags: String,
pkg_plist_lines: List(PlistLine),
pkg_origin: String,
pkg_comment: String,
pkg_arch: String,
pkg_www: String,
pkg_license_logic: String,
pkg_licenses: List(String),
pkg_pairs: List(ConfigPair),
)
}
Constructors
-
Config( app_name: String, app_version: String, pkg_user_name: String, pkg_user_uid: String, pkg_description: String, pkg_maintainer: String, pkg_dependencies: List(DependencyConfig), pkg_proc_name: String, pkg_config_dir: String, pkg_path_extensions: String, pkg_var_dir: String, pkg_env_file: String, pkg_prefix: String, pkg_command: String, pkg_command_args: String, pkg_daemon_flags: String, pkg_plist_lines: List(PlistLine), pkg_origin: String, pkg_comment: String, pkg_arch: String, pkg_www: String, pkg_license_logic: String, pkg_licenses: List(String), pkg_pairs: List(ConfigPair), )Arguments
- app_name
-
Gleam application name, used in template(s): +MANIFEST, required (no default).
- app_version
-
Gleam application version, used in template(s): +MANIFEST, required (no default).
- pkg_user_name
-
Freebsd package user name, used in +POST_INSTALL and rc, defaults to
app_name. - pkg_user_uid
-
Freebsd package user uid, used in +POST_INSTALL and rc, required (no default).
- pkg_description
-
Freebsd package long description, used in +DESC, required (no default).
- pkg_maintainer
-
Freebsd package maintainer email address, used in +MANIFEST, required (no default).
- pkg_dependencies
-
Freebsd package dependencies, used in +MANIFEST, required (no default).
- pkg_proc_name
-
Variable used in template(s): rc.conf; the process name to be used when looking for this package, defaults to /usr/local/lib/erlang28/*/bin/beam.smp.
- pkg_config_dir
-
Variable used in template(s): +POST_INSTALL, +PRE_DEINSTALL, rc; the package configuration directory, required (no default). Directory is NOT automatically created by the package installation. It is expected that this configuration directory and file will be provided by an orchestration service or manually by a system administrator. Service configuration is separate from service installation.
- pkg_path_extensions
-
Variable used in template(s): rc; config; path_extensions are “:” delimited paths to prepend to the PATH variable, defaults to /usr/local/lib/erlang28/bin.
- pkg_var_dir
-
Variable used in template(s): +PRE_DEINSTALL; var_dir is the data dir for this package, defaults to “/var/APP_NAME”. This directory is NOT created by the installer.
- pkg_env_file
-
Variable used in template(s): rc; defaults to APP_NAME.env.
- pkg_prefix
-
The path where the files contained in this package are installed, used in template(s): rc, +MANIFEST, defaults to /usr/local.
- pkg_command
-
Variable used in template(s): rc; defaults to ‘entrypoint.sh’.
- pkg_command_args
-
Variable used in template(s): rc; defaults to ‘run’.
- pkg_daemon_flags
-
Variable used in template(s): rc; defaults to ‘’.
- pkg_plist_lines
-
Plist line entries, details files to copy into the target system, plus keywords to control how those files are copied, permissions, etc, defaults to [].
- pkg_origin
-
This entry sets the freebsd package’s origin to pkg-origin. This is a string of the form category/port-dir which designates the port this package was built from, used in template(s): rc; defaults to ‘private/APP_NAME’
- pkg_comment
-
Comment-string is a one-line description of this package. it is the equivalent of the comment variable for a port, not a way to put comments in a +manifest file, used in template(s): +MANIFEST, required (no default).
- pkg_arch
-
The architecture of the machine the package was built on. cpu-type takes values like x86, amd64, freebsd:15:x86:64, used in template(s): +MANIFEST, defaults to ‘freebsd:15:x86:64’.
- pkg_www
-
The software’s official website, used in template(s): +MANIFEST, +DISPLAY, required, no default.
- pkg_license_logic
-
Package license, used in template(s): +MANIFEST, defaults to ‘single’.
- pkg_licenses
-
Package licenses, e.g. licenses: [“MIT”], used in template(s): +MANIFEST, defaults to ‘PRIVATE’.
- pkg_pairs
-
Unstructured key/value pairs to enable sending any string data to the templating system, useful for custom templates, can be used in any custom template. You can elect to use custom templates instead of the default templates by passing the
templatesparameter to the CLI. If you need templates to start out with, copy the default templates from ./priv/templates/freebsd to a directory of your choosing. Modify the copied templates as you wish, and then specify that directory on the CLI as previously mentioned.
FreeBSD Pairs are key (String) / value (String) pairs that provide unstructed data that can be passed through to the templating system to support custom templates.
pub type ConfigPair {
ConfigPair(key: String, value: String)
}
Constructors
-
ConfigPair(key: String, value: String)
DependencyConfig fully describes a package dependency so that it can be installed as part of installing this package.
Note:
This information can be found using:
$ pkg query " %n: { version: \"%v\", origin: %o }" [PACKAGE NAME]
pub type DependencyConfig {
DependencyConfig(name: String, version: String, origin: String)
}
Constructors
-
DependencyConfig(name: String, version: String, origin: String)
PlistFile maps a source file to a target destination, such that a local file (on the machine building the package) gets copied into the package staging area and listed in the plist file manifest.
https://man.freebsd.org/cgi/man.cgi?query=pkg-create
“”“
The plist is a sequential list of lines which can have keywords
prepended. A keyword starts with an @'. Lines not starting with a keyword are considered as paths to a file. If started with a /’ then
it is considered an absolute path. Otherwise the file is considered as
relative to PREFIX.
“”“
Note:
The dest will be prepended with the staging_directory path when it is copied on the
local filesystem. But the reference to this file in the plist file will be the path
provided.
pub type PlistLine {
PlistFile(
src: String,
dest: String,
mode: String,
owner: String,
group: String,
)
PlistDirDirective(path: String)
PlistIncludeDirective(path: String)
PlistDirectory(
src_dir: String,
dest_dir: String,
mode: String,
owner: String,
group: String,
)
}
Constructors
-
PlistFile( src: String, dest: String, mode: String, owner: String, group: String, )Arguments
- src
-
The fully qualified path to the source file (on the local host building the FreeBSD package).
- dest
-
The path for the source file on the target host (where the package will be installed).
- mode
-
Format is the same as that used by the chmod command. Blank string sets to default.
- owner
-
Set ownership file to user. Blank string sets to default (root) ownership.
- group
-
Set group ownership to group. Blank string sets to default (wheel) group owner-ship.
-
PlistDirDirective(path: String)Arguments
- path
-
Declare directory name to be deleted at deinstall time. By default, most directories created by a package installation are deleted automatically when the package is deinstalled, so this directive is only needed for empty directories or directories outside of PREFIX. These directives should appear at the end of the package list. If the directory is not empty a warning will be printed, and the directory will not be removed. (Subdirectories should be listed before parent directories.)
-
PlistIncludeDirective(path: String)Arguments
- path
-
Include the name plist file to the plist currently being parsed. the name will be opened relatively to the main plist file being parsed. Note: only one level of @include is allowed.
-
PlistDirectory( src_dir: String, dest_dir: String, mode: String, owner: String, group: String, )Arguments
- src_dir
-
Include these source files recursively.
- dest_dir
-
Base directory for source files.
- mode
-
Mode same as for PlistFile.
- owner
-
Owner same as for PlistFile.
- group
-
Group same as for PlistFile.
Values
pub fn copy_raw_templates(
target_dir: String,
) -> Result(List(String), AppError)
Copy the raw templates to a directory so that the user can modify them for their own purposes.
pub const default_templates_path: String
path to the default templates for things like +POST_INSTALL, etc.
pub const dependency_partial_template: String
use this template to create dependency entries within +MANIFEST deps stanza
pub fn gen_staging(
config: Config,
app_dir: String,
metadata_dir: String,
staging_dir: String,
templates_dir: String,
erlang_shipment_dir: String,
) -> Result(Nil, AppError)
Generate the files in the staging directory. The files in the staging directory will be packaged into the final FreeBSD package.
These files are:
- +MANIFEST: the top level file that describes this FreeBSD Package
- +[FILES]: +POST_INSTALL and +PRE_DEINSTALL scripts to execute as part of installing or removing package
- plist: a list of all the files to be copied to the target server as part of installation
- [FILES]: the files (listed in the
plistabove) to be copied to the target server
pub fn get_optional_string(
toml: dict.Dict(String, tom.Toml),
key: String,
default: String,
) -> Result(String, AppError)
Extract a string from a toml dict, use the default value if the key is missing.
pub fn get_optional_strings(
toml: dict.Dict(String, tom.Toml),
key: String,
default: List(String),
) -> Result(List(String), AppError)
Extract a list of strings from a toml dict, use the default value if the key is missing.
pub fn get_string(
toml: dict.Dict(String, tom.Toml),
key: String,
) -> Result(String, AppError)
Extract a string from a toml dict.
pub fn get_strings(
toml: dict.Dict(String, tom.Toml),
key: String,
) -> Result(List(String), AppError)
Extract list of strings from a toml dict.
pub fn load_toml(
toml_file: String,
) -> Result(dict.Dict(String, tom.Toml), AppError)
Read the gleam.toml file and parse it into toml.
Any valid (parsable) toml will succeed here.