From 35ed3e788ee00096db70b939dcfa1cf2d7c7ff93 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 15 May 2021 14:52:46 +0100 Subject: [PATCH] debian/: Add packaging support. This is quite fancy, and arranges to dump images for new Lisp systems as they get installed. --- Makefile.am | 10 ++++++ debian/changelog | 6 ++++ debian/compat | 1 + debian/control | 16 ++++++++++ debian/copyright | 27 ++++++++++++++++ debian/rules | 16 ++++++++++ debian/runlisp.config | 76 ++++++++++++++++++++++++++++++++++++++++++++++ debian/runlisp.dirs | 3 ++ debian/runlisp.install | 23 ++++++++++++++ debian/runlisp.installdirs | 3 ++ debian/runlisp.postinst | 23 ++++++++++++++ debian/runlisp.postrm | 9 ++++++ debian/runlisp.prerm | 17 +++++++++++ debian/runlisp.templates | 24 +++++++++++++++ debian/runlisp.triggers | 6 ++++ 15 files changed, 260 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100755 debian/runlisp.config create mode 100644 debian/runlisp.dirs create mode 100644 debian/runlisp.install create mode 100644 debian/runlisp.installdirs create mode 100755 debian/runlisp.postinst create mode 100755 debian/runlisp.postrm create mode 100755 debian/runlisp.prerm create mode 100644 debian/runlisp.templates create mode 100644 debian/runlisp.triggers diff --git a/Makefile.am b/Makefile.am index b13d107..f79b77d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -201,4 +201,14 @@ dist-hook:: EXTRA_DIST += config/auto-version EXTRA_DIST += config/confsubst +## Debian. +EXTRA_DIST += debian/changelog debian/copyright debian/compat +EXTRA_DIST += debian/control debian/rules + +EXTRA_DIST += debian/runlisp.install debian/runlisp.dirs +EXTRA_DIST += debian/runlisp.config debian/runlisp.templates +EXTRA_DIST += debian/runlisp.postinst +EXTRA_DIST += debian/runlisp.prerm debian/runlisp.postrm +EXTRA_DIST += debian/runlisp.triggers + ###----- That's all, folks -------------------------------------------------- diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9843dad --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +runlisp (0.99.99~) experimental; urgency=medium + + * Preparation for initial release. + + -- Mark Wooding Mon, 01 Mar 2021 01:24:02 +0000 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..edf435e --- /dev/null +++ b/debian/control @@ -0,0 +1,16 @@ +Source: runlisp +Section: lisp +Priority: extra +Maintainer: Mark Wooding +Build-Depends: autoconf, autoconf-archive, automake, clisp, cl-asdf, + debhelper (>= 10), ecl, groff, gsfonts, sbcl +Standards-Version: 3.1.1 + +Package: runlisp +Architecture: any +Depends: ${shlibs:Depends} +Description: Utility for running scripts written in Common Lisp. + `runlisp' is a small C program intended to be run from a script `#!' + line. It selects and invokes a Common Lisp implementation, so as to run + the script. In this sense, `runlisp' is a partial replacement for + `cl-launch'. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..90ecc72 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,27 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Copyright: 2020--2021 Mark Wooding, Straylight/Edgeware +Upstream-Name: tripe +Upstream-Contact: Mark Wooding +Source: https://ftp.distorted.org.uk/pub/mdw/ +License: GPL-3.0+ + +Files: * +Copyright: 2020--2021 Mark Wooding, Straylight/Edgeware +License: GPL-3.0+ + +License: GPL-3.0+ + runlisp is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at + your option) any later version. + . + runlisp is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + . + You should have received a copy of the GNU General Public License + along with runlisp. If not, see . + . + On Debian systems, the full text of the GNU General Public License + version 3 can be found in the file `/usr/share/common-licenses/GPL-3'. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..9b128d0 --- /dev/null +++ b/debian/rules @@ -0,0 +1,16 @@ +#! /usr/bin/make -f + +DH_OPTIONS = --parallel -Bdebian/build + +OVERRIDES += auto_configure +dh_auto_configure_OPTS = -- +dh_auto_configure_OPTS += --with-imagedir=/var/lib/runlisp + +OVERRIDES += auto_install +dh_auto_install_OPTS = --destdir=debian/tmp + +%:; dh $@ $(DH_OPTIONS) + +$(foreach o, $(sort $(OVERRIDES)), dh-$o-hook)::; @: +$(foreach o, $(sort $(OVERRIDES)), override_dh_$o): override_dh_%: dh-%-hook + dh_$* $(addprefix -O, $(DH_OPTIONS)) $(dh_$*_OPTS) diff --git a/debian/runlisp.config b/debian/runlisp.config new file mode 100755 index 0000000..e370b1b --- /dev/null +++ b/debian/runlisp.config @@ -0,0 +1,76 @@ +#! /bin/sh -e + +. /usr/share/debconf/confmodule +db_capb backup + +## Main state machine. +state=0 +while :; do + case $state in + + 0) + db_input medium runlisp/dump-custom-images || : + ;; + + 1) + db_get runlisp/dump-custom-images + case $RET in select) ;; *) state=2; continue ;; esac + + ## Determine the configured Lisp systems. + sects=$(query-runlisp-config -LM) + unset lisps + for s in $sects; do + case $s in @*) continue ;; esac + if ! query-runlisp-config -M -p$s:dump-image >/dev/null 2>&1 + then continue; fi + lisps=${lisps+$lisps, }$s + done + db_subst runlisp/selected-implementations lisps "$lisps" + + ## See if the list has changed recently. + db_get runlisp/available-implementations + case $RET in + "$lisps") + ch=nil prio=medium + ;; + *) + ch=t prio=high + db_set runlisp/available-implementations "$lisps" + ;; + esac + + ## Filter nonexistent implementations from the active list. + db_get runlisp/selected-implementations + case $RET in + -) + v=$lisps + ;; + *) + unset v + for i in $(echo "$RET" | tr , " "); do + case " $lisps," in *" $i,"*) v=${v+$v, }$i ;; esac + done + ;; + esac + db_set runlisp/selected-implementations "$v" + case $ch in + t) db_fset runlisp/selected-implementations seen false ;; + esac + db_input $prio runlisp/selected-implementations || : + ;; + + -1) + exit 10 + ;; + *) + break + ;; + esac + + set +e; db_go; rc=$?; set -e + case $rc in + 0) state=$(( $state + 1 )) ;; + 30) state=$(( $state - 1 )) ;; + *) exit $rc ;; + esac +done diff --git a/debian/runlisp.dirs b/debian/runlisp.dirs new file mode 100644 index 0000000..b418dc2 --- /dev/null +++ b/debian/runlisp.dirs @@ -0,0 +1,3 @@ +### -*-conf-*- + +/var/lib/runlisp diff --git a/debian/runlisp.install b/debian/runlisp.install new file mode 100644 index 0000000..b566ff6 --- /dev/null +++ b/debian/runlisp.install @@ -0,0 +1,23 @@ +### -*-conf-*- + +etc/runlisp/runlisp.conf +etc/runlisp/runlisp.d/ + +usr/bin/dump-runlisp-image +usr/bin/query-runlisp-config +usr/bin/runlisp + +README.org /usr/share/doc/runlisp +doc/README.pdf /usr/share/doc/runlisp +usr/share/doc/runlisp/dump-runlisp-image.pdf +usr/share/doc/runlisp/query-runlisp-config.pdf +usr/share/doc/runlisp/runlisp.conf.pdf +usr/share/doc/runlisp/runlisp.pdf + +usr/share/man/man1/dump-runlisp-image.1 +usr/share/man/man1/query-runlisp-config.1 +usr/share/man/man1/runlisp.1 +usr/share/man/man5/runlisp.conf.5 + +usr/share/runlisp/dump-ecl +usr/share/runlisp/eval.lisp diff --git a/debian/runlisp.installdirs b/debian/runlisp.installdirs new file mode 100644 index 0000000..ac10ed4 --- /dev/null +++ b/debian/runlisp.installdirs @@ -0,0 +1,3 @@ +### -*-conf-*- + +/var/lib/runlisp \ No newline at end of file diff --git a/debian/runlisp.postinst b/debian/runlisp.postinst new file mode 100755 index 0000000..9288e1b --- /dev/null +++ b/debian/runlisp.postinst @@ -0,0 +1,23 @@ +#! /bin/sh -e + +. /usr/share/debconf/confmodule + +db_get runlisp/dump-custom-images +mode=$RET + +{ echo ";;; -*-conf-*-"; echo + case $mode in + select) + db_get runlisp/selected-implementations + echo "dump = $RET" + ;; + esac +} >/etc/runlisp/runlisp.d/8debconf.new +mv /etc/runlisp/runlisp.d/8debconf.new /etc/runlisp/runlisp.d/8debconf + +case $mode in + none) ;; + *) dump-runlisp-image -aiRU ;; +esac + +#DEBHELPER# diff --git a/debian/runlisp.postrm b/debian/runlisp.postrm new file mode 100755 index 0000000..a0c5e30 --- /dev/null +++ b/debian/runlisp.postrm @@ -0,0 +1,9 @@ +#! /bin/sh -e + +case $1 in + purge) + rm -f /etc/runlisp/runlisp.d/8debconf + ;; +esac + +#DEBHELPER# diff --git a/debian/runlisp.prerm b/debian/runlisp.prerm new file mode 100755 index 0000000..ec5c62a --- /dev/null +++ b/debian/runlisp.prerm @@ -0,0 +1,17 @@ +#! /bin/sh -e + +. /usr/share/debconf/confmodule + +db_get runlisp/dump-custom-images +mode=$RET + +case $1 in + deconfigure | remove) + case $mode in + none) ;; + *) dump-runlisp-image -arRU ;; + esac + ;; +esac + +#DEBHELPER# diff --git a/debian/runlisp.templates b/debian/runlisp.templates new file mode 100644 index 0000000..6fd1340 --- /dev/null +++ b/debian/runlisp.templates @@ -0,0 +1,24 @@ +Template: runlisp/dump-custom-images +Type: select +Choices: none, all, select +Default: all +Description: Dump custom Lisp images for faster startup? + `runlisp' often works significantly faster if it can build and use custom + Lisp images, rather than having to use the vanilla images from the + installation package. + . + You can opt to dump custom images for selected Lisp implementations, for all + supported Lisps installed, or not to dump images at all. + +Template: runlisp/selected-implementations +Type: multiselect +Choices: ${lisps} +Default: - +Description: Which Lisp implementations should have custom images dumped? + You have opted to dump images only for explicitly selected Lisp + implementations. + +Template: runlisp/available-implementations +Type: string +Default: +Description: (internal use only) diff --git a/debian/runlisp.triggers b/debian/runlisp.triggers new file mode 100644 index 0000000..5317ee9 --- /dev/null +++ b/debian/runlisp.triggers @@ -0,0 +1,6 @@ +### -*-conf-*- + +interest-noawait /usr/bin/clisp +interest-noawait /usr/bin/cmucl +interest-noawait /usr/bin/ecl +interest-noawait /usr/bin/sbcl -- 2.11.0