On this page:
build-pkgs
vm?
docker-vm
vbox-vm
steps-in

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
Builds packages by
  • 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:

procedure

(vm? v)  boolean?

  v : any/c
Recognizes a VM crreated by docker-vm or vbox-vm.

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
Creates a VM that specifies a Docker image and container. The given name will be used to name a new image (replacing any existing name image) that is built starting with from-image and that holds the Racket installation. At the time of writing, "racket/pkg-build:pkg-build-deps" and/or "racket/pkg-build:pkg-build-deps-min" is suitable as from-image. The given name is also used for a container that is an instance of the image; the container is created fresh (replacing any existing name container) for each package to build.

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
Creates a VM that specifies a VirtualBox virtual machine with the given name. The host string specifies the IP address of the machine to access it using ssh, and user is the user for that ssh. You must configure the virtual machine and the host’s SSH settings so that ssh works without a password. The ssh-key argument can name a file containing private key to use for ssh as user.

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.

procedure

(steps-in start end)  (listof symbol?)

  start : symbol?
  end : symbol?
A helper to generate a #:steps argument to build-pkgs that has steps start through end inclusive. See build-pkgs for the allowed step symbols.