Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/install.x
Package installation into the x2c home.
Functions
| Function | Summary |
|---|---|
install_command | Installs the package named by the request’s one operand and returns 0. |
install_require | Returns the row that records name at version, installing the package under the x2c home first unless one already records that version. |
install_rows | Returns the package rows of text: its lines holding the six fields name version kind platform url sha256, where kind is source or bundle and a source row’s platform is -. |
install_version | Returns the version an installed package records, or NULL when no package of that name is installed or it records no version. |
list_command | Lists installed packages as name version kind lines and returns 0. |
remove_command | Removes the installed package named by the request’s one operand. |
Functions
install_command
int install_command(CliRequest request)
Installs the package named by the request’s one operand and returns 0.
The operand is a local directory, a local .tar.gz, a URL with
--sha256, or a name resolved through the package index. A bundle is
verified against this compiler’s version unless --force; a pure-x2c
source package is built by this compiler. Failures exit with status 2.
Source: src/install.x:316
install_require
List install_require( CliRequest request, String name, String version, List locked)
Returns the row that records name at version, installing the package
under the x2c home first unless one already records that version.
locked is the lockfile row to reproduce, so a package a lockfile pins
comes from the archive that lockfile recorded; NULL resolves the index
instead. The row has the install_rows shape, and an already satisfied
dependency reaches no network. Failures exit with status 2.
Source: src/install.x:352
install_rows
List install_rows(String text)
Returns the package rows of text: its lines holding the six fields
name version kind platform url sha256, where kind is source or
bundle and a source row’s platform is -. Blank lines, # comments,
and lines with another field count are skipped. The package index and a
project lockfile share this format.
Source: src/install.x:115
install_version
String install_version(String name)
Returns the version an installed package records, or NULL when no package of that name is installed or it records no version. Reaches no network.
Source: src/install.x:342
list_command
int list_command(CliRequest request)
Lists installed packages as name version kind lines and returns 0.
Source: src/install.x:399
remove_command
int remove_command(CliRequest request)
Removes the installed package named by the request’s one operand. A directory without an install marker is left alone. Returns 0.
Source: src/install.x:380
Design notes
x2c install, remove, and list manage <home>/packages. Fetching
and extraction run host tools as child processes. A package is staged in
a sibling directory, built there when it is source, and published with
one rename. Installs and removals in one home run one at a time.