Reference
Single-page view · as markdown
Commands
Pekit / Reference
The pekit command has a subcommand for each kind of work. This page says
what each is for and where to read about it. pekit(1) is the authority
for every command, option, exit status, environment variable, and file,
and pekit <command> --help summarizes one command.
The commands #
These are the commands, in the order you're likely to meet them:
| Command | Does | Read |
|---|---|---|
pekit build | Builds targets. | Building a First Program |
pekit test | Runs tests, every test below this directory by default. | Writing and Running Tests |
pekit run | Runs a script, or the program a build gives. | Running Scripts and Programs |
pekit query deps | Lists the steps and files targets reach. | Querying What Targets Reach |
pekit query rdeps | Lists the targets that read a file. | Querying What Targets Reach |
pekit lock | Pins the libraries the workspace imports. | Pinning Libraries |
pekit sources | Records what each recipe's packages are built from in pekit.sources. | Recording Corresponding Source |
pekit package | Packs packages with the workspace's packagers. | Packaging |
pekit publish | Packs packages and publishes them into a store. | Packaging |
pekit release | Builds a package from HEAD strictly, publishes it, and tags it. | Releasing |
pekit clean | Removes pekit-out/, and with --cache the store. | Managing the Store |
pekit store stats | Shows the store's size, its limit, and whether a build is using it. | Managing the Store |
pekit store evict | Evicts the store to within its limit now. | Managing the Store |
pekit store verify | Hashes every file of the store again, and with --repair repairs what is wrong. | Managing the Store |
Options the building commands share #
build, test, run, query, package, publish, and sources take
the same options for how they build:
| Option | Does | Read |
|---|---|---|
--jobs | Limits how many programs this build runs at once. | Targets and Steps, Sharing the Machine |
--evaluating | Limits how many targets this build evaluates at once. | Sharing the Machine |
--platform | Builds for another platform. | Building for Another Platform |
--profile | Chooses the keychain's profile. | Using Secrets |
--rebuild | Runs every step, reusing nothing from the store. | Reuse and the Store |
--check-reproducible | Runs every step twice and compares the outputs. | Checking That a Build Is Reproducible |
--strict | Builds as a release does. | Hermetic and Strict Builds |
--fail-fast | Stops the build at the first target that fails. | Naming Targets |
--no-dynamic | Fails a target that waits for a step's result. | Targets and Steps |
--trace | Writes a timeline of the build. | Profiling a Build |
--gcsl-profile | Writes a profile of the build's GCSL code. | Profiling a Build |
--remote-cache, --remote-instance, --remote-header | Looks for steps in a remote cache. | Sharing a Remote Cache |
--remote-upload | Writes the steps a build records to the remote cache. | Sharing a Remote Cache |
Definition Types and Attributes
Pekit / Reference
GCSL's prelude declares the definition types and attributes that build files use. Plain GCSL runs them as ordinary calls; pekit gives them their meaning as a build system. This page lists what each means to pekit. GCSL's Attributes and Definition Types and Metadata pages describe them as language features.
Definition types #
Each definition type declares a kind of target, which one command acts on:
| Definition type | Declares | Its body gives | Command |
|---|---|---|---|
build | Something to build. | Any value: a file, a directory, or a record or list of them. | pekit build |
test | A check. Its body is a step, unless marked #[hermetic(false)]. | Nothing. The test passes if the body succeeds. | pekit test |
package | A package of any format. | A version and the files it installs under /usr. | pekit package, pekit publish, pekit release |
script | A task you run by hand. Only a script can call a script. | Any value. | pekit run |
Toolchain::<kind> | A toolchain of a kind, to register in pekitconf. | Its platforms and the files it provides. | None; libraries ask for it. |
A definition can declare parameters with defaults, as
def test runs(prog: File = build app()). The defaults are worked out
where the definition is called, outside any step, so a test is given what
it tests.
Attributes #
These attributes change how pekit runs a function. Put them on the lines
before a fn or def:
| Attribute | Means to pekit |
|---|---|
#[hermetic] | A call of the function from a target's code is a step: run in a sandbox, and its result kept in the store. #[hermetic(false)] turns this off, as for a test that needs the network. |
#[retry(n)] | A step that fails runs again from the start, up to n more times. One that passes only on a retry is reported as flaky. |
#[timeout(limit)] | A step that runs longer than limit, such as 5m, fails. The limit covers all its attempts together. |
#[device("kvm")] | The step's sandbox has /dev/kvm, where the machine has it. It doesn't key the step. |
#[scratch] | The step has a directory at /pekit-scratch that pekit keeps between its runs. It doesn't key the step. |
#[track_caller] | An error in the function's body is reported where it was called. |
#[retry], #[timeout], and #[track_caller] mean the same in plain
GCSL. #[hermetic], #[device], and #[scratch] mean nothing to plain
GCSL, which runs such a call at once, as any call.
Paths in a Step
Pekit / Reference
A step's sandbox has the same layout on every machine and in every checkout. This table lists each path a step can have, in the order a step is likely to use them. Step Sandboxes explains why the layout is as it is.
| Path | Holds | Writable | There when |
|---|---|---|---|
/w/<path> | A workspace file or directory the step was given, at its path in the workspace. | No | The step was given it. |
/w/.gcsl/libraries/<library>/ | A library's own files the step was given. | No | The step was given one. |
/pekit-out/.steps/<function>/<identity>/ | The step's own directory, where its programs start and its outputs go. | Yes | Always. |
/pekit-out/<path> | Another step's output the step was given. | No | The step was given it. |
/pekit-out/.fetch/<sha256>/<name> | A fetched file the step was given. | No | The step was given it. |
/pekit-out/.unpack/<key>/ | An unpacked archive the step was given. | No | The step was given it. |
/pekit-out/.git/<key>/<name>/ | A git commit's files the step was given. | No | The step was given them. |
/tmp | An empty directory of the step's own. | Yes | Always. |
/pekit-scratch | A directory pekit keeps between the step's runs. | Yes | The step is marked #[scratch]. |
/pekit-secrets/<profile>/<name> | A secret file. | No | The step was given the secret. |
/usr, /bin, /lib, /lib64, /sbin | The host's own programs and libraries. | No | The build isn't strict. |
/etc/alternatives, /etc/ld.so.cache | What the host's programs need to start. | No | The build isn't strict. |
/etc/passwd, /etc/group | A fixed user database of root, pekit and nobody, the same in every step. | No | Always. |
/dev | null, zero, full, random, urandom, tty, and the standard streams. | Yes, as devices allow | Always. |
/dev/kvm | The machine's KVM device. | Yes | The step is marked #[device("kvm")] and the machine has KVM. |
/proc | The step's own processes. | No | Always. |
A program the step runs starts in the step's own directory, with PATH
set to /usr/bin:/bin:/usr/sbin:/sbin unless its exec sets one. It runs
as the user pekit, number 1000, with LOGNAME and USER set to pekit
unless its exec sets them. pekit's home, /nonexistent, isn't there.