Documentation
Install Helpers
Functions for placing files in the recipe's output (out) and for using a package manager inside the domain. Most recipes need none of the copying helpers: FILES places files from the sources, and Recipe moves them into place.
Overview
build(src, out) writes into out, the output folder, which already holds the files FILES placed. Recipe publishes the output and installs it.
fn build(src, out) {
mkdir(join_path(out, "bin"));
copy_file(join_path(src.source, "myapp"), join_path(out, "bin/myapp"));
chmod(join_path(out, "bin/myapp"), 0o755);
mkdir(join_path(out, "share/man/man1"));
copy_into_dir(join_path(src.source, "man/*.1"), join_path(out, "share/man/man1"));
} Copying Files
| Helper | Behavior |
|---|---|
| copy_file(src, dst) | Copy one file to the exact path dst. |
| copy_file_reflink(src, dst) | Copy with a reflink where the filesystem supports it, else a checked copy. |
| copy_into_dir(pattern, dest_dir) | Copy every file matching the glob into the existing dest_dir; matching nothing is an error. |
| copy_tree_contents(src, dest) | Copy a directory's contents, keeping hardlinks, symlink bytes and modes. |
| copy_first_existing(sources, dst) | Copy the first source in the array that exists; returns its path. |
make install and CMake
Build systems that install themselves go through a staging folder, because out is the package folder itself:
let staged = join_path(WORK, "staged");
exec_checked("make", ["install", "DESTDIR=" + staged], #{ cwd: src.source });
rm(out);
mv(staged + PREFIX, out); check_disk_space
check_disk_space(path, required_bytes) throws if the filesystem holding path has less free space than required. Use it before a large build or extraction.
Package Managers in the Domain
These run the image's own package tools inside the domain, so they need that tool in the image, its stores, and a network grant for any repository they reach. Payloads they fetch still need verification.
| Helper | Returns |
|---|---|
| dnf_install(packages) / dnf_install_allow_erasing(packages) | () |
| dnf_download(packages, dest_dir, arches[, resolve]) | Array of downloaded paths |
| dnf_add_repo(url) / dnf_package_available(name) | () / bool |
| rpm_installed(name) / rpm_version(name) | bool / String |
| apk_install(packages) / apk_download(packages, dest_dir) | () / Array of paths |
| apk_add_repo(url) / apk_package_available(name) | () / bool |
| apk_installed(name) / apk_version(name) | bool / String |