From d39ccc1403762b19b9966493342867b115294a2e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 20 Mar 2021 12:39:58 -0700 Subject: add and use :CONSFIGURATOR named readtable Signed-off-by: Sean Whitton --- consfigurator.asd | 3 +++ debian/changelog | 6 ++++++ debian/control | 4 ++++ doc/ideas.rst | 4 ---- doc/introduction.rst | 2 +- src/connection.lisp | 2 +- src/connection/chroot.lisp | 1 + src/connection/chroot/fork.lisp | 1 + src/connection/chroot/shell.lisp | 1 + src/connection/debian-sbcl.lisp | 1 + src/connection/local.lisp | 1 + src/connection/shell-wrap.lisp | 2 +- src/connection/ssh.lisp | 3 +-- src/connection/sudo.lisp | 2 +- src/data.lisp | 1 + src/data/asdf.lisp | 1 + src/data/pgp.lisp | 1 + src/deployment.lisp | 1 + src/host.lisp | 1 + src/property.lisp | 2 +- src/property/apt.lisp | 2 +- src/property/chroot.lisp | 2 +- src/property/cmd.lisp | 1 + src/property/file.lisp | 2 +- src/property/os.lisp | 2 +- src/property/service.lisp | 2 +- src/property/user.lisp | 2 +- src/propspec.lisp | 1 + src/reader.lisp | 23 +++++++++++++++++++++++ src/util.lisp | 1 + 30 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 src/reader.lisp diff --git a/consfigurator.asd b/consfigurator.asd index ab95b69..d73c8e6 100644 --- a/consfigurator.asd +++ b/consfigurator.asd @@ -8,10 +8,13 @@ #:babel #:babel-streams #:cl-ppcre + #:cl-heredoc #:cl-interpol + #:named-readtables #:cffi #:trivial-macroexpand-all) :components ((:file "src/package") + (:file "src/reader") (:file "src/util") (:file "src/connection") (:file "src/property") diff --git a/debian/changelog b/debian/changelog index 437e408..3203c14 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +consfigurator (0.4.0-1) UNRELEASED; urgency=medium + + * Add deps and build-deps on cl-heredoc and cl-named-readtables. + + -- Sean Whitton Sat, 20 Mar 2021 12:31:53 -0700 + consfigurator (0.3.1-1) experimental; urgency=medium * New upstream release. diff --git a/debian/control b/debian/control index 0325333..3ca533c 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,9 @@ Build-Depends: cl-alexandria, cl-babel, cl-cffi, + cl-heredoc, cl-interpol, + cl-named-readtables, cl-ppcre, cl-trivial-macroexpand-all, debhelper-compat (= 13), @@ -27,7 +29,9 @@ Depends: cl-alexandria, cl-babel, cl-cffi, + cl-heredoc, cl-interpol, + cl-named-readtables, cl-ppcre, cl-trivial-macroexpand-all, emacsen-common, diff --git a/doc/ideas.rst b/doc/ideas.rst index f4f9947..86886f7 100644 --- a/doc/ideas.rst +++ b/doc/ideas.rst @@ -76,7 +76,3 @@ Project & packaging - Define a semantics for version numbers (probably just like Propellor's), start keeping a NEWS file, move from Debian experimental to unstable, start actually announcing releases to sgo-software-announce. - -- Provide a ``:consfigurator`` named readtable which enables both CL-INTERPOL - and CL-HEREDOC syntax. Use it in all source files, and for users in their - consfigs. diff --git a/doc/introduction.rst b/doc/introduction.rst index 5de0185..6931ac9 100644 --- a/doc/introduction.rst +++ b/doc/introduction.rst @@ -35,7 +35,7 @@ Try it out / quick start (in-package :com.example.consfig) (in-consfig "com.example.consfig") - (named-readtables:in-readtable :interpol-syntax) + (named-readtables:in-readtable :consfigurator) (try-register-data-source :pgp :location #P"/path/to/com.example.consfig.gpg") diff --git a/src/connection.lisp b/src/connection.lisp index 2817cfa..d1c87e2 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) ;;;; Connections diff --git a/src/connection/chroot.lisp b/src/connection/chroot.lisp index 92d6de6..f8c49a3 100644 --- a/src/connection/chroot.lisp +++ b/src/connection/chroot.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.connection.chroot) +(named-readtables:in-readtable :consfigurator) ;; currently we only check whether we're root, but, for example, on Linux, we ;; might have a CAP_* which lets us chroot as non-root diff --git a/src/connection/chroot/fork.lisp b/src/connection/chroot/fork.lisp index ab4ab72..4969539 100644 --- a/src/connection/chroot/fork.lisp +++ b/src/connection/chroot/fork.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.connection.chroot.fork) +(named-readtables:in-readtable :consfigurator) #+sbcl (eval-when (:compile-toplevel :load-toplevel :execute) (require "sb-posix")) diff --git a/src/connection/chroot/shell.lisp b/src/connection/chroot/shell.lisp index 77fbdbd..66b2845 100644 --- a/src/connection/chroot/shell.lisp +++ b/src/connection/chroot/shell.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.connection.chroot.shell) +(named-readtables:in-readtable :consfigurator) (defmethod establish-connection ((type (eql :chroot.shell)) remaining &key into) (declare (ignore remaining)) diff --git a/src/connection/debian-sbcl.lisp b/src/connection/debian-sbcl.lisp index 208655e..ac9925e 100644 --- a/src/connection/debian-sbcl.lisp +++ b/src/connection/debian-sbcl.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.connection.debian-sbcl) +(named-readtables:in-readtable :consfigurator) (defmethod establish-connection ((type (eql :debian-sbcl)) remaining &key) (mrun "which sbcl >/dev/null 2>&1 || apt-get -y install sbcl") diff --git a/src/connection/local.lisp b/src/connection/local.lisp index 5a7da2d..a689881 100644 --- a/src/connection/local.lisp +++ b/src/connection/local.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.connection.local) +(named-readtables:in-readtable :consfigurator) (defmethod establish-connection ((type (eql :local)) host &key) (make-instance 'local-connection)) diff --git a/src/connection/shell-wrap.lisp b/src/connection/shell-wrap.lisp index b1bafc4..dd27f92 100644 --- a/src/connection/shell-wrap.lisp +++ b/src/connection/shell-wrap.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.connection.shell-wrap) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) (defclass shell-wrap-connection (posix-connection) ()) diff --git a/src/connection/ssh.lisp b/src/connection/ssh.lisp index da32070..f4903b5 100644 --- a/src/connection/ssh.lisp +++ b/src/connection/ssh.lisp @@ -16,8 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.connection.ssh) - -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) (defmethod establish-connection ((type (eql :ssh)) remaining &key diff --git a/src/connection/sudo.lisp b/src/connection/sudo.lisp index 935fc5b..db0111a 100644 --- a/src/connection/sudo.lisp +++ b/src/connection/sudo.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.connection.sudo) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) ;; Note that a password needed to sudo is technically not a piece of ;; prerequisite data required by a deployment, because it is not used in diff --git a/src/data.lisp b/src/data.lisp index 5315762..b786c0c 100644 --- a/src/data.lisp +++ b/src/data.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator) +(named-readtables:in-readtable :consfigurator) ;;;; Prerequisite data diff --git a/src/data/asdf.lisp b/src/data/asdf.lisp index dc05d58..2d61c49 100644 --- a/src/data/asdf.lisp +++ b/src/data/asdf.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.data.asdf) +(named-readtables:in-readtable :consfigurator) ;; could we have both :asdf-monolithic and :asdf-something_else where in the ;; latter we filter out the names of systems already known to be available on diff --git a/src/data/pgp.lisp b/src/data/pgp.lisp index 0324177..51e8a2d 100644 --- a/src/data/pgp.lisp +++ b/src/data/pgp.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.data.pgp) +(named-readtables:in-readtable :consfigurator) ;; Simple PGP-encrypted file source of prerequisite data diff --git a/src/deployment.lisp b/src/deployment.lisp index 5f93f33..f8a8b17 100644 --- a/src/deployment.lisp +++ b/src/deployment.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator) +(named-readtables:in-readtable :consfigurator) ;;;; Deployments diff --git a/src/host.lisp b/src/host.lisp index f4f9ec2..1eae634 100644 --- a/src/host.lisp +++ b/src/host.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator) +(named-readtables:in-readtable :consfigurator) ;;;; Hosts diff --git a/src/property.lisp b/src/property.lisp index 55ed83c..95bacd0 100644 --- a/src/property.lisp +++ b/src/property.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) ;;;; Properties diff --git a/src/property/apt.lisp b/src/property/apt.lisp index fa5948e..609b581 100644 --- a/src/property/apt.lisp +++ b/src/property/apt.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.property.apt) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) ;;;; Static definitions diff --git a/src/property/chroot.lisp b/src/property/chroot.lisp index 5a4928d..a3a49a0 100644 --- a/src/property/chroot.lisp +++ b/src/property/chroot.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.property.chroot) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) (defprop %debootstrapped :posix (root host &rest options) "Bootstrap The Universal Operating System into ROOT using debootstrap(1)." diff --git a/src/property/cmd.lisp b/src/property/cmd.lisp index 1e6a94c..39cc8dd 100644 --- a/src/property/cmd.lisp +++ b/src/property/cmd.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.property.cmd) +(named-readtables:in-readtable :consfigurator) (defprop single :posix (&rest args) "A property which can be applied by running a single shell command. ARGS is diff --git a/src/property/file.lisp b/src/property/file.lisp index ca9579f..6db1484 100644 --- a/src/property/file.lisp +++ b/src/property/file.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.property.file) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) (defun map-file-lines (file function) "Apply FUNCTION to the lines of FILE. Safe to use in a :POSIX property. diff --git a/src/property/os.lisp b/src/property/os.lisp index f80519d..dbfb861 100644 --- a/src/property/os.lisp +++ b/src/property/os.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.property.os) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) ;;;; Basic OS types diff --git a/src/property/service.lisp b/src/property/service.lisp index 7ab220b..9dd10d2 100644 --- a/src/property/service.lisp +++ b/src/property/service.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.property.service) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) ;;;; Controlling services using service(1) diff --git a/src/property/user.lisp b/src/property/user.lisp index d9569b1..3a5e918 100644 --- a/src/property/user.lisp +++ b/src/property/user.lisp @@ -16,7 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator.property.user) -(named-readtables:in-readtable :interpol-syntax) +(named-readtables:in-readtable :consfigurator) (defprop has-account :posix (user-name) "Ensure there is an account for USER-NAME." diff --git a/src/propspec.lisp b/src/propspec.lisp index d1fabd1..99eaa4f 100644 --- a/src/propspec.lisp +++ b/src/propspec.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator) +(named-readtables:in-readtable :consfigurator) ;;;; Property application specifications diff --git a/src/reader.lisp b/src/reader.lisp new file mode 100644 index 0000000..39314be --- /dev/null +++ b/src/reader.lisp @@ -0,0 +1,23 @@ +;;; Consfigurator -- Lisp declarative configuration management system + +;;; Copyright (C) 2021 Sean Whitton + +;;; This file 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, or (at your option) +;;; any later version. + +;;; This file 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 this program. If not, see . + +(in-package :consfigurator) + +(named-readtables:defreadtable :consfigurator + (:merge :standard) + (:dispatch-macro-char #\# #\? #'cl-interpol:interpol-reader) + (:dispatch-macro-char #\# #\> #'cl-heredoc:read-heredoc)) diff --git a/src/util.lisp b/src/util.lisp index 44ae5b7..3afc228 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -16,6 +16,7 @@ ;;; along with this program. If not, see . (in-package :consfigurator) +(named-readtables:in-readtable :consfigurator) (defun noop (&rest args) "Accept any arguments and do nothing." -- cgit v1.2.3