reltool(3)
π NAME π
reltool β Main API of the Reltool application
Heads up bestie, this one is a whole manual page from the Erlang docs (the reltool(3) page, Erlang Module Definition section), so grab a snack π
β¨ DESCRIPTION β¨
Okay so. This is an interface module for the Reltool application. That's it, that's the whole vibe. π
Reltool is a release management tool. It looks at a given Erlang/OTP installation and figures out all the various dependencies between applications. Then:
- the graphical frontend shows you those dependencies and lets you customize a target system interactively, and
- the backend gives you a batch interface so you can generate customized target systems without clicking anything. π«Ά
The tool uses an installed Erlang/OTP system as its input. root_dir is the root directory of the analysed system, and it defaults to the system that is executing Reltool. Applications may also live outside root_dir β that's allowed, no cap.
lib_dirs defines library directories where extra applications may reside. It defaults to the directories listed by the operating system environment variable ERL_LIBS. See the module code for more info (yes, fr fr, go read the source πΈ).
An application directory AppDir under a library directory is recognized by the existence of an AppDir/ebin directory. If that doesn't exist, Reltool will not consider AppDir at all when looking for applications. Like, not even a little bit. π
It's recommended that application directories are named as the application, possibly followed by a dash and the version number. For example myapp or myapp-1.1. β¨
Finally, single modules and entire applications may be read from Escripts.
π The levels thing (this is important, iykyk)
Some configuration parameters control Reltool's behavior on system (sys) level. Others provide control on application (app) level, and yet others are on module (mod) level.
The override chain, from most powerful to least:
- Module (
mod) level parameters override application level parameters - Application (
app) level parameters override system level parameters - Escript (
escript) level parameters override system level parameters
Module beats app, app beats sys, escript beats sys. Memorize it bestie, this is the whole personality of this page. π
The following top level options are supported:
configβ This is the main option and it controls the configuration of Reltool. It can either be asystuple or a name of a file containing asystuple.trap_exitβ This option controls the error handling behavior of Reltool. By default the window processes trap exit, but this behavior can altered by settingtrap_exittofalse.wx_debugβ This option controls the debug level ofwx. As its name indicates it is only useful for debugging. Seewx:debug/1for more info.
π¦ System (sys) level options π¦
Besides the already mentioned source parameters root_dir and lib_dirs, the following system (sys) level options are supported:
ertsβ Erts specific configuration. See application level options below.escriptβ Escript specific configuration. An escript has a mandatory file name and escript level options that are described below.appβ Application specific configuration. An application has a mandatory name and application level options that are described below.mod_condβ This parameter controls the module inclusion policy. It defaults toall, which means that if an application is included (either explicitly or implicitly) all modules in that application will be included. This implies that both modules that exist in theebindirectory of the application, as well as modules that are named in theappfile, will be included. If the parameter is set toebin, both modules in theebindirectory and derived modules are included. If the parameter is set toapp, both modules in theappfile and derived modules are included. derived means that only modules that are used by other included modules are included. Themod_condsetting on system level is used as default for all applications.incl_condβ This parameter controls the application and escript inclusion policy. It defaults toderived, which means that the applications that do not have any explicitincl_condsetting will only be included if any other (explicitly or implicitly included) application uses it. The valueincludeimplies that all applications and escripts that do not have any explicitincl_condsetting will be included.excludeimplies that all applications and escripts that do not have any explicitincl_condsetting will be excluded. πboot_relβ A target system may have several releases but the one given asboot_relwill be used as default when the system is booting up.relβ Release specific configuration. Each release maps to arel,scriptandbootfile. See the modulesystoolsfor more info about the details. Each release has a name, a version and a set of applications with a few release specific parameters such astypeandincluded applications.relocatableβ This parameter controls whether theerlexecutable in the target system should automatically determine where it is installed, or if it should use a hardcoded path to the installation. In the latter case the target system must be installed withreltool:install/2before it can be used. If the system is relocatable, the file tree containing the target system can be moved to another location without re-installation. The default istrue.profileβ The creation of the specification for a target system is performed in two steps. In the first step a complete specification is generated. It will likely contain much more files than you are interested in in your customized target system. In the second step the specification will be filtered according to your filters. There you have the ability to specify filters per application as well as system wide filters. You can also select a profile for your system. Depending on the profile, different default filters will be used. There are three different profiles to choose from:development,embeddedandstandalone.developmentis default. The parameters that are affected by the profile are:incl_sys_filters,excl_sys_filters,incl_app_filtersandexcl_app_filters.app_fileβ This parameter controls the default handling of theappfiles when a target system is generated. It defaults tokeep, which means thatappfiles are copied to the target system and their contents are kept as they are.stripmeans that a newappfile is generated from the contents of the originalappfile, where the non included modules are removed from the file.alldoes also imply that a newappfile is generated from the contents of the originalappfile, with the difference that all included modules are added to the file. If the application does not have anyappfile a file will be created for all but not forkeepandstrip.debug_infoβ Thedebug_infoparameter controls what debug information in thebeamfile should be kept or stripped.keepkeeps all debug info,stripstrips all debug info, and a list ofchunkids keeps only those chunks.excl_libβ WARNING: This option is experimental.
If the excl_lib option is set to otp_root then reltool will not copy anything from the Erlang/OTP installation ($OTPROOT) into the target structure. The goal is to create a "slim" release which can be used together with an existing Erlang/OTP installation. The target structure will therefore only contain a lib directory with the applications that were found outside of $OTPROOT (typically your own applications), and a releases directory with the generated .rel, .script and .boot files.
When starting this release, three things must be specified:
- Which releases directory to use β Tell the release handler to use the
releasesdirectory in our target structure instead of$OTPROOT/releases. This is done by setting theSASLenvironment variablereleases_dir, either from the command line (-sasl releases_dir <target-dir>/releases) or insys.config. - Which boot file to use β The default boot file is
$OTPROOT/bin/start, but in this case we need to specify a boot file from our target structure, typically<target-dir>/releases/<vsn>/<RelName>. This is done with the-bootcommand line option toerl. - The location of our applications β The generated
.script(and.boot) file uses the environment variable$RELTOOL_EXT_LIBas prefix for the paths to all applications. The-boot_varoption toerlcan be used for specifying the value of this variable, typically-boot_var RELTOOL_EXT_LIB <target-dir>/lib.
Example:
erl -sasl releases_dir \"mytarget/releases\" -boot mytarget/releases/1.0/myrel\
-boot_var RELTOOL_EXT_LIB mytarget/lib
incl_sys_filtersβ This parameter normally contains a list of regular expressions that controls which files in the system should be included. Each file in the target system must match at least one of the listed regular expressions in order to be included. Further the files may not match any filter inexcl_sys_filtersin order to be included. Which application files should be included is controlled with the parametersincl_app_filtersandexcl_app_filters. This parameter defaults to[".*"].excl_sys_filtersβ This parameter normally contains a list of regular expressions that controls which files in the system should not be included in the target system. In order to be included, a file must match some filter inincl_sys_filtersbut not any filter inexcl_sys_filters. This parameter defaults to[].incl_app_filtersβ This parameter normally contains a list of regular expressions that controls which application specific files that should be included. Each file in the application must match at least one of the listed regular expressions in order to be included. Further the files may not match any filter inexcl_app_filtersin order to be included. This parameter defaults to[".*"].excl_app_filtersβ This parameter normally contains a list of regular expressions that controls which application specific files should not be included in the target system. In order to be included, a file must match some filter inincl_app_filtersbut not any filter inexcl_app_filters. This parameter defaults to[].
π Escript level options π
On application (escript) level, the following options are supported:
incl_condβ The value of this parameter overrides the parameter with the same name on system level.
π§ Application (app) level options π§
On application (app) level, the following options are supported:
vsnβ The version of the application. In an installed system there may exist several versions of an application. Thevsnparameter controls which version of the application will be chosen. π
Heads up bestie: this parameter is mutual exclusive withlib_dir. Ifvsnandlib_dirare both omitted, the latest version will be chosen.
Note that for reltool to sort application versions and thereby be able to select the latest, it is required that the version id for the application consists of integers and dots only, for example1,2.0or3.17.1. β¨π’
lib_dirβ The directory to read the application from. This parameter can be used to point out a specific location to fetch the application from. This is useful for instance if the parent directory for some reason is no good as a library directory on system level. π
This parameter is mutual exclusive with vsn. If vsn and lib_dir are both omitted, the latest version will be chosen. π
Note that for reltool to sort application versions and thereby be able to select the latest, it is required that the version id for the application consists of integers and dots only, for example1,2.0or3.17.1. π
modβ Module specific configuration. A module has a mandatory name and module level options that are described below. π§©mod_condβ The value of this parameter overrides the parameter with the same name on system level. πincl_condβ The value of this parameter overrides the parameter with the same name on system level. πapp_fileβ The value of this parameter overrides the parameter with the same name on system level. πdebug_infoβ The value of this parameter overrides the parameter with the same name on system level. πincl_app_filtersβ The value of this parameter overrides the parameter with the same name on system level. πexcl_app_filtersβ The value of this parameter overrides the parameter with the same name on system level. π
On module (mod) level, the following options are supported: π
incl_condβ This parameter controls whether the module is included or not. By default themod_condparameter on application and system level will be used to control whether the module is included or not. The value ofincl_condoverrides the module inclusion policy.includeimplies that the module is included, whileexcludeimplies that the module is not included.derivedimplies that the module is included if it is used by any other included module. β βdebug_infoβ The value of this parameter overrides the parameter with the same name on application level. π
π DATA TYPES π
okay so here's the entire type menu, bestie β memorize it or just come back when you need it, no pressure π
app() ::
{vsn, app_vsn()} |
{lib_dir, lib_dir()} |
{mod, mod_name(), [mod()]} |
{mod_cond, mod_cond()} |
{incl_cond, incl_cond()} |
{app_file, app_file()} |
{debug_info, debug_info()} |
{incl_app_filters, incl_app_filters()} |
{excl_app_filters, excl_app_filters()}.
app_file() :: keep | strip | all.
app_name() :: atom().
app_type() :: permanent | transient | temporary | load | none.
app_vsn() :: string().
base_dir() :: dir().
base_file() :: file().
boot_rel() :: rel_name().
config() :: {sys, [sys()]}.
debug_info() :: keep | strip | [beam_lib:chunkid()].
dir() :: file:filename().
escript() :: {incl_cond, incl_cond()}.
escript_file() :: file().
excl_app_filters() :: regexps().
excl_lib() :: otp_root.
excl_sys_filters() :: regexps().
file() :: file:filename().
incl_app() :: app_name().
incl_app_filters() :: regexps().
incl_cond() :: include | exclude | derived.
incl_defaults() :: boolean().
incl_derived() :: boolean().
incl_sys_filters() :: regexps().
lib_dir() :: dir().
mod() :: {incl_cond, incl_cond()} | {debug_info, debug_info()}.
mod_cond() :: all | app | ebin | derived | none.
mod_name() :: atom().
option() ::
{wx_debug, term()} |
{trap_exit, boolean()} |
config() |
{config, config() | file()}.
options() :: [option()].
profile() :: development | embedded | standalone.
re_regexp() :: string().
reason() :: string().
regexps() ::
[re_regexp()] | {add, [re_regexp()]} | {del, [re_regexp()]}.
rel_app() ::
app_name() |
{app_name(), app_type()} |
{app_name(), [incl_app()]} |
{app_name(), app_type(), [incl_app()]}.
rel_file() :: term().
rel_name() :: string().
rel_opt() :: {load_dot_erlang, boolean()}.
rel_vsn() :: string().
relocatable() :: boolean().
root_dir() :: dir().
script_file() :: term().
server() :: server_pid() | options().
server_pid() :: pid().
sys() ::
{mod_cond, mod_cond()} |
{incl_cond, incl_cond()} |
{debug_info, debug_info()} |
{app_file, app_file()} |
{profile, profile()} |
{excl_lib, excl_lib()} |
{incl_sys_filters, incl_sys_filters()} |
{excl_sys_filters, excl_sys_filters()} |
{incl_app_filters, incl_app_filters()} |
{excl_app_filters, excl_app_filters()} |
{root_dir, root_dir()} |
{lib_dirs, [lib_dir()]} |
{boot_rel, boot_rel()} |
{rel, rel_name(), rel_vsn(), [rel_app()]} |
{rel, rel_name(), rel_vsn(), [rel_app()], [rel_opt()]} |
{relocatable, relocatable()} |
{erts, app()} |
{escript, escript_file(), [escript()]} |
{app, app_name(), [app()]}.
target_dir() :: dir().
target_spec() ::
[target_spec()] |
{create_dir, base_dir(), [target_spec()]} |
{create_dir, base_dir(), top_dir(), [target_spec()]} |
{copy_file, base_file()} |
{copy_file, base_file(), top_file()} |
{write_file, base_file(), binary()} |
{strip_beam_file, base_file()}.
top_dir() :: file().
top_file() :: file().
warning() :: string().
window_pid() :: pid().
π₯ FUNCTIONS π₯
create_target(server(), target_dir()) -> ok | {error, reason()}.
Create a target system. β¨
Gives the same result as {ok,TargetSpec}=reltool:get_target_spec(Server) and reltool:eval_target_spec(TargetSpec,RootDir,TargetDir). π
eval_target_spec(target_spec(), root_dir(), target_dir()) -> ok | {error, reason()}.
Create the actual target system from a specification generated by reltool:get_target_spec/1. π οΈ
The creation of the specification for a target system is performed in two steps. In the first step a complete specification will be generated. It will likely contain much more files than you are interested in your target system. In the second step the specification will be filtered according to your filters. There you have the ability to specify filters per application as well as system wide filters. You can also select a profile for your system. Depending on the profile, different default filters will be used. ποΈ
The top directories bin, releases and lib are treated differently from other files. All other files are by default copied to the target system. The releases directory contains generated rel, script, and boot files. The lib directory contains the applications. Which applications are included and if they should be customized (stripped from debug info etc.) is specified with various configuration parameters. The files in the bin directory are copied from the erts-vsn/bin directory, but only those files that were originally included in the bin directory of the source system. π
If the configuration parameter relocatable was set to true there is no need to install the target system with reltool:install/2 before it can be started. In that case the file tree containing the target system can be moved without re-installation. π
In most cases, the RootDir parameter should be set to the same as the root_dir configuration parameter used in the call to reltool:get_target_spec/1 (or code:root_dir/0 if the configuration parameter is not set). In some cases it might be useful to evaluate the same target specification towards different root directories. This should, however, be used with great care as it requires equivalent file structures under all roots. β οΈ
get_config(server(), incl_defaults(), incl_derived()) -> {ok, config()} | {error, reason()}.
Get reltool configuration. π
Normally, only the explicit configuration parameters with values that differ from their defaults are interesting. But the builtin default values can be returned by setting InclDefaults to true. The derived configuration can be returned by setting InclDerived to true. π
get_rel(server(), rel_name()) -> {ok, rel_file()} | {error, reason()}.
Get contents of a release file. See rel for more details. π
get_script(server(), rel_name()) -> {ok, script_file()} | {error, reason()}.
Get contents of a boot script file. See script for more details. π
get_server(window_pid()) -> {ok, server_pid()} | {error, reason()}.
Return the process identifier of the server process. π
get_status(server()) -> {ok, [warning()]} | {error, reason()}.
Get status about the configuration. π
get_target_spec(server()) -> {ok, target_spec()} | {error, reason()}.
Return a specification of the target system. The actual target system can be created with reltool:eval_target_spec/3. π―
install(rel_name(), dir()) -> ok | {error, reason()}.
Install a created target system. π¦
start() -> {ok, window_pid()} | {error, reason()}.
Start a main window process with default options. πͺ
start(options()) -> {ok, window_pid()} | {error, reason()}.
Start a main window process with options. πͺ
start_link(options()) -> {ok, window_pid()} | {error, reason()}.
Start a main window process with options. The process is linked. π
start_server(options()) -> {ok, server_pid()} | {error, reason()}.
Start a server process with options. The server process identity can be given as an argument to several other functions in the API. π₯οΈ
stop(server_pid() | window_pid()) -> ok | {error, reason()}.
Stop a server or window process. π
And that's the whole vibe, bestie! This manual page is brought to you by Ericsson AB, reltool version 1.1, and the man page is reltool(3). Stay iconic! πβ¨π
π¦ where this page comes from
- nixos 26.05: erlang 29.1.2
- nixpkgs unstable: erlang 29.1.2
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms