11. The ScmPkg Package System

ScmPkg is a package distribution system for Scheme. It is currently supported by Bigloo and STklos. This package system provides new APIs to Scheme (e.g., network programming, cryptography, encoding, …​) and it manages automatic package installation, deinstallation and testing.

11.1. ScmPkg "tutorial"

stklos-pkg is the command which gives access to ScmPkg in STklos. This is the only command necessary to manage ScmPkg packages. For instance, this command manages a local cache of the ScmPkg server, permits (de)installation of ScmPkg packages, the test of packages, …​

To start, we can synchronize our local repository with the ScmPkg servers. This can be done by the following command:

$ stklos-pkg --sync

This will download a description of the ScmPkg packages which are available. The list of these packages can be displayed with:

$ stklos-pkg --list
_bigloo-1.0.1 (tuning)
_bigloo-regexp-0.0.1
_bigloo-stdlib-0.0.1 (tuning)
_chicken-0.0.1 (tuning)
_chicken-net-0.0.1 (tuning)
_chicken-os-0.0.1
rfc3339-0.2.0
srfi1-0.0.1 (tuning)
$

Packages whose name start by an underscore are packages needed for alien language support (e.g. the package "bigloo" is necessary to run a package written in the Bigloo Scheme dialect, or the package "_chicken-net" is necessary for the packages using the network primitives of the Chicken Scheme dialect). Some packages may offer a tuning. A tuned package is a package which has been specially tuned for _STklos (e.g. the generic "srfi1" package which implement SRFI-1 has been tuned to be more efficient in STklos)

To download a new package (and all its dependencies), one can simply issue the following command:

$ stklos-pkg --extract PKG --directory /tmp/Test

This command downloads the package PKG, its dependencies and (eventually) its tuning. It also creates a Makefile for compiling the package. The --directory option specifies where the files must be extracted in the /tmp/Test directory (instaed of the current directory). The generated Makefile offers the following main targets

  • all : the default target

  • test: to launch the package tests

  • install: to install the package for the user

  • system-install: to install the package system wide (privilegied access rights are probably needed)

To test a package, one can also use the following command:

\type{$} stklos-pkg --test PKG

This downloads the necessary files in a temporary directory, and launches the tests of the package PKG

To install a package, one can also use the following command:

$ stklos-pkg --install PKG

This command downloads the necessary files in a temporary directory, and installs the package PKG.

This completes the basis ScmPkg tutorial. See below for the list of all stklos-pkg options

11.2. stklos-pkg options

Here are the options supported by the stklos-pkg command

Usage: stklos-pkg [options] [parameter ...]
Actions
  --extract=<pkg>, -e <pkg>    Extract <pkg>. Don't install it
  --test=<pkg>, -t <pkg>       Test <pkg>.
  --install=<pkg>, -i <pkg>    Extract, compile, Install <pkg>.
  --uninstall=<pkg>            un-install package <pkg>
Repository administration
  --sync, -s                   synchronize with remote server servers
  --add=<sb>, -a <sb>          Add <sb> pkgball to the local repository
  --download=<pkg>             download <pkg>
  --fill-cache                 fill cache with available distant packages
  --clear-cache                delete packages present in cache
  --reset                      reset stklos-pkg repository. USE WITH CAUTION
  --build-sync-file=<dir>      Build a synchronization file from <dir>
Informations
  --list, -l                   list available packages
  --depends=<pkg>              Show all the dependencies of <pkg>
  --installed                  Show installed packages
Misc
  --conf-dir=<dir>, -D <dir>   Use <dir> as stklos main configuration directory
  --directory=<dir>, -C <dir>  Change to directory <dir> (extract/download)
  --verbose, -v                be verbose (can be cumulated)
  --system-wide, -S            do a system wide (de)installation
  --version, -V                print the version and exit
  --help, -h                   display this help
  --options                    display program options
  --cp                         INTERNAL USE ONLY. Do not use this option

1. Documentation about hygienic macros has been stolen in the SLIB manual
1. In fact define-module on a given name defines a new module only the first time it is invoked on this name. By this way, interactively reloading a module does not define a new entity, and the other modules which use it are not altered.
2. This transcript uses the default toplevel loop which displays the name of the current module in the evaluator prompt.
1. Under Unix, you can simply connect to a listening socket with the telnet of netcat command. For the given example, this can be achieved with netcat localhost 12345
2. Port 13, if open, can used for testing: making a connection to it permits to know the distant system’s idea of the time of day.
1. This section is an adaptation of Jeff Dalton’s (J.Dalton@ed.ac.uk) "Brief introduction to CLOS" which can be found at http://www.aiai.ed.ac.uk/~jeff/clos-guide.html