5 Package-Building API
(require pkg-build) | package: pkg-build |
The build-pkgs function drive a package build, but it relies on a set of VMs that are created by docker-vm or vbox-vm.
procedure
(build-pkgs [ #:work-dir work-dir] #:snapshot-url snapshot-url [ #:installer-name installer-name #:installer-platform-name installer-platform-name] #:vms vms [ #:pkg-catalogs pkg-catalogs #:pkgs-for-version pkgs-for-version #:extra-packages extra-packages #:only-packages only-packages #:only-sys+subpath only-sys+subpath #:compile-any? compile-any? #:steps steps #:timeout timeout #:test-timeout test-timeout #:jobs jobs #:on-empty-pkg-updates on-empty-pkg-updates #:install-doc-list-file install-doc-list-file #:run-tests? run-tests? #:built-at-site? built-at-site? #:site-url site-url #:site-starting-point site-starting-point #:compress-site? compress-site? #:summary-omit-pkgs summary-omit-pkgs #:max-build-together max-build-together #:server-port server-port]) → void? work-dir : path-string? = (current-directory) snapshot-url : string? installer-name : (or/c string? #f) = #f installer-platform-name : (or/c string? #f) = #f vms : (listof vm?)
pkg-catalogs : (listof string?) = (list "https://pkgs.racket-lang.org/") pkgs-for-version : string? = (version) extra-packages : (listof string?) = null only-packages : (or/c #f (listof string?)) = #f only-sys+subpath : (or/c #f (cons string? string?)) = null compile-any? : any/c = #f steps : (listof symbol?) = (steps-in 'download 'summary) timeout : real? = 600 test-timeout : (or/c #f real?) = #f jobs : (or/c #f exact-positive-integer?) = #f on-empty-pkg-updates : (-> any) = void install-doc-list-file : (or/c #f path-string?) = #f run-tests? : any/c = t built-at-site? : any/c = #f site-url : (or/c #f string?) = #f site-starting-point : (or/c #f string?) = #f compress-site? : any/c = #t summary-omit-pkgs : (listof string?) = null max-build-together : exact-positive-integer? = 1 server-port : (or/c #f (integer-in 1 65535)) = 18333
using work-dir as the work directory;
downloading initial packages from snapshot-url, which can be something like "https://mirror.racket-lang.org/releases/7.6/";
using either installer-name or installer-platform-name (exactly one of them must be supplied as non-#f) to locate an installer at snapshot-url, where installer-name is something like "racket-x86_64-linux-natipkg.tgz", or installer-platform-name is something like "{1} Racket | {3} Linux | {3} x64_64 (64-bit), natipkg; built on Debian 8 (Jessie)"; in the latter case, the name should be one of the entries in "installers/table.rktd" relative to snapshot-url; in both cases, it should be a natipkg option consistent with the VMs specified by vms; if a minimal installer is used and package tests will be run, include "compiler-lib" in extra-packages;
running the VMs machines specified by vms, which is a list of results from docker-vm and/or vbox-vm;
installing additional packages from pkg-catalogs individually in VMs.
Additional configuration options:
pkgs-for-version —
The Racket version to use in queries to archived catalogs. This version should be consistent with snapshot-url. extra-packages —
Extra packages to install within an installation so that they’re treated like packages that are included in the installer. These should be built packages (normally from the snapshot site), or else the generated built packages will not work right (especially when using multiple VMs). only-packages —
When not #f, specifies a subset of packages available from pkg-catalogs to be built and recorded in a catalog. Any dependencies of a specified package are also included. only-sys+subpath —
When not #f and when only-packages is not #f, considers only dependencies for the indicated specific platform. The platform is described by consing a symbol matching the result of (system-type) to a string matching the result of (system-library-subpath #f). compile-any? —
When not #f, compiles bytecode in built packages to machine-independent form. The installer specified by installer-name or installer-platform-name and the packages provided by pkg-catalogs must also have machine-independent bytecode. steps —
Steps to perform the package-build process. The possible steps, in order, are 'download: download installer from snapshot site.
'archive: archive catalogs byt downloading all packages to the work directory.
'install: run the installer to set up each VM.
'build: build packages that have changed.
'docs: extract and assemble documentation.
'summary: summarize the results as a web page.
'site: assemble web-friendly pieces to an archive.
You can skip steps at the beginning if you know that they’re already done, and you can skip tests at the end if you don’t want them, but any included steps must be contiguous and in order.
timeout —
Timeout in seconds for any one package or step. test-timeout —
If not #f, supplied with --timeout to raco test to configure the default testing timeout. jobs —
If not #f, supplied with --jobs to raco pkg install, raco setup, and/or raco test to configure the number of concurrent jobs that run. on-empty-pkg-updates —
A thunk that is called in the case that no packages need to be rebuilt. install-doc-list-file —
If not #f, save a list of files in the original installation’s "doc" directory to the specified file as part of the 'install step. run-tests? —
Determines whether each package’s tests are run after building the package. built-at-site? —
Determines whether to include a catalog of built packages in an assembled site. site-url —
The URL where the assemble site will be made available (for, e.g., showing help about the catalog). site-starting-point —
Text for help to describes the starting point, where #f means “the current release.” compress-site? —
Selects whether the 'site step produces "site.tgz" (if true) or "site.tar" (otherwise). summary-omit-pkgs —
A list of packages to omit from the build summary. max-build-together —
Number of packages to build at once in a single VM. Building more than one package at a time can be faster, but it is not recommended: building multiple packages risks success when a build should have failed due to missing dependencies, and it risks corruption due to broken or nefarious packages. server-port —
A TCP port to use for serving packages from the build machine to VirtualBox VMs. This server is not started if vms contains only Docker VMs.
procedure
(docker-vm #:name name #:from-image from-image [ #:dir dir #:env env #:shell shell #:memory-mb memory-mb #:swap-mb swap-mb #:minimal-variant minimal-variant]) → vm? name : string? from-image : string? dir : string? = "/home/root/" env : (listof (cons/c string? string?)) = null shell : (listof string?) = '("/bin/sh" "-c") memory-mb : (or/c #f exact-positive-integer?) = #f swap-mb : (or/c #f exact-positive-integer?) = #f minimal-variant : (or/c #f vm?) = #f
The dir argument specifies a working directory within the Docker container; it must be a complete-path?, when viewed as a unix path, i.e., (complete-path? (bytes->path (string->bytes/utf-8 dir) 'unix)) must return #t.
The env argument specifies environment variable settings that prefix every command.
The shell argument determines the shell command that is used to run shell-command strings in the container.
The memory-mb and swap-mb arguments set memory-use constraints on the created container. The memory-mb value corresponds to “real” memory in megabytes, and swap-mb is additional swap space. If either is non-#f, the same value is used in place of a #f for the other. If both are #f, no specific limit is imposed.
The minimal-variant argument, if not #f, specifies a VM to try before this one. If installation fails with the minimal-variant VM, it is tried again with this one. Tests run in this VM, however, instead of minimal-variant.
procedure
(vbox-vm #:name name #:host host [ #:user user #:ssh-key ssh-key #:dir dir #:env env #:shell shell #:init-shapshot init-snapshot #:installed-shapshot installed-snapshot #:minimal-variant minimal-variant]) → vm? name : string? host : string? user : string? = "racket" ssh-key : (or/c #f path-string?) = #f dir : string? = "/home/racket/build-pkgs" env : (listof (cons/c string? string?)) = null shell : (listof string?) = '("/bin/sh" "-c") init-snapshot : string? = "init" installed-snapshot : string? = "installed" minimal-variant : (or/c #f vm?) = #f
The dir argument specifies a working directory within the virtual machine, with the same checks as docker-vm’s dir argument.
The env argument specifies environment variable settings that prefix every command.
The shell argument determines the shell command that is used to run shell-command strings in the virtual machine.
The init-snapshot string names a snapshot that exists as the starting point in the virtual machine, so that it can be reset to a state before any Racket installation. You must configure the virtual machine to have this snapshot.
The installed-snapshot string names a snapshot that will be created by build-pkgs after it installs Racket in the virtual machine. If a snapshot using this name already exists, it may be replaced.
The minimal-variant argument, if not #f, specifies a VM to try before this one. If installation fails with the minimal-variant VM, it is tried again with this one. Tests run in this VM, however, instead of minimal-variant.