rudolfochrist / quickdist

Create a Quicklisp distribution from a directory of local projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

Quickdist creates and updates Quicklisp distributions from a directory of local projects. It maintains distinfo.txt, releases.txt, systems.txt and source archive - all that is needed for a distribution. Currently it requires GNU tar to work. (Configurable with *gnutar*, defaults to /bin/tar and /usr/local/bin/gtar on OSX.)

This is a fork

This fork contains following changes from borodust/quickdist:

  • Fixed path to gnutar on OSX;

  • Added support for package inferred systems (a way how dependencies are collected, was refactored completely).

  • Quickdist:quickdist function now returns a path to a distinfo file.

  • Discovering systems inside an asd file now looks which systems were added to the asdf/system-registry:*registered-systems* hash.

  • Command line utility quickdist.ros was added to easily generate quicklisp distribution and optionally to serve static files locally.

  • Now log4cl is used to output information about progress.

  • Fixed an error on system definitions having defsystem-depends-on mentioned another project. Now all sources are included into ASDF's source registries list.

  • Now additional metadata key is written into each distinfo.txt file: distinfo-template-url. It points to a template like:

    http://foo.com/foo/{{version}}/distinfo.txt
    

    and this template can be used to retrieve metadata about different versions of the distribution.

    Also, a custom template processor was replaced with a call to cl-mustache library.

  • Changed a way to ignore asd files and system dependencies.

Usage

Easiest way to use quickdist is to install it via Roswell:

ros install ultralisp/quickdist

And then to invoke it from the command line:

quickdist my-lisp-projects/

This command will generate a dists folder with a distribution which is static and can be served by any server.

For production usage, you need to specify the base-url of the server, because distribution information holds these urls and quicklisp will use them to fetch software from your server:

quickdist --base-url 'https://lisp.example.com/' my-lisp-projects/
rsync -avz dists/ lisp.example.com:/www/dists/

Also, you can set other options. Add --help to learn about all possibilities.

API

A few dynamic variables and one function are exported.

Dynamic variables determine the layout of files on disk and on the web server. Such are the defaults:

(defparameter *distinfo-template*
  "name: {name}
version: {version}
distinfo-subscription-url: {base-url}/{name}.txt
release-index-url: {base-url}/{name}/{version}/releases.txt
system-index-url: {base-url}/{name}/{version}/systems.txt
")
(defparameter *distinfo-file-template* "{dists-dir}/{name}.txt")
(defparameter *dist-dir-template*      "{dists-dir}/{name}/{version}")
(defparameter *archive-dir-template*   "{dists-dir}/{name}/archive")
(defparameter *archive-url-template*   "{base-url}/{name}/archive")

The only exported function is quickdist.

quickdist (&key name (version :today) base-url projects-dir dists-dir)

name, version, base-url and dists-dir provide values for the templates. A special default version :today is resolved to the current date in YYYYMMDD format. projects-dir is the directory each subdirectory of which is treated as a separate project to be included in the distribution.

Example

Suppose you have some projects in ~/projects/, you want to publish them from ~/dists/ and you name the distribution quickdist. Then after loading quickdist and hunchentoot:

cl-user> (quickdist:quickdist :name "quickdist" :base-url "http://localhost:4242/" :projects-dir "~/projects" :dists-dir "~/dists")
Processing {project1}...
Processing {project2}...
...
nil

cl-user> (push (hunchentoot:create-folder-dispatcher-and-handler "/" "~/dists/") hunchentoot:*dispatch-table*)
(#<CLOSURE (lambda # :in hunchentoot:create-prefix-dispatcher) {100A30DEAB}> hunchentoot:dispatch-easy-handlers)

cl-user> (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242))
#<hunchentoot:easy-acceptor (host *, port 4242)>

cl-user> (ql-dist:install-dist "http://localhost:4242/quickdist.txt")
127.0.0.1 - [2012-11-30 10:46:29] "get /quickdist.txt http/1.1" 200 241 "-" "quicklisp-client/2012112500 SBCL/1.1.0"
; Fetching #<url "http://localhost:4242/quickdist.txt">
; 0.24KB
==================================================
241 bytes in 0.00 seconds (0.00KB/sec)
Installing dist "quickdist" version "20121130".
Press Enter to continue.

127.0.0.1 - [2012-11-30 10:46:31] "get /quickdist/20121130/releases.txt http/1.1" 200 295 "-" "quicklisp-client/2012112500 SBCL/1.1.0"
; Fetching #<url "http://localhost:4242/quickdist/20121130/releases.txt">
; 0.29KB
==================================================
295 bytes in 0.00 seconds (0.00KB/sec)
127.0.0.1 - [2012-11-30 10:46:31] "get /quickdist/20121130/systems.txt http/1.1" 200 132 "-" "quicklisp-client/2012112500 SBCL/1.1.0"
; Fetching #<url "http://localhost:4242/quickdist/20121130/systems.txt">
; 0.13KB
==================================================
132 bytes in 0.00 seconds (128.91KB/sec)
#<ql-dist:dist quickdist 20121130>

cl-user> (ql:quickload :symbol-namestring) ; for example
To load "symbol-namestring":
  Load 1 ASDF system:
    named-readtables
  Install 1 Quicklisp release:
    symbol-namestring
127.0.0.1 - [2012-11-30 10:47:23] "get /quickdist/archive/symbol-namestring-20120812.tgz http/1.1" 200 14842 "-" "quicklisp-client/2012112500 SBCL/1.1.0"
; Fetching #<url "http://localhost:4242/quickdist/archive/symbol-namestring-20120812.tgz">
; 14.49KB
==================================================
14,842 bytes in 0.00 seconds (14494.14KB/sec)
; Loading "symbol-namestring"
[package symbol-namestring]
(:symbol-namestring)

cl-user> (ql-dist:uninstall (ql-dist:find-dist "quickdist")) ; no longer want this dist
t

Priorities of distributions

When multiple distributions provide the same system, the latest installed distribution is prefered by default. If this is not what you want, you can inspect priorities with (ql-dist:preference (ql-dist:find-dist "{dist}"))) and set them with setf. For a finer-grained control projects (ql-dist:find-release-in-dist) and systems (ql-dist:find-system-in-dist) have preferences too.

About

Create a Quicklisp distribution from a directory of local projects.


Languages

Language:Common Lisp 98.8%Language:Shell 1.2%