aboutsummaryrefslogtreecommitdiff
path: root/src/connection
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-09-16 18:23:55 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-10-23 10:51:30 -0700
commit446b8f4a8ef78cb4605cfb551255bb455be411f0 (patch)
tree0baa5401d38cc7144a750852bb7ba7aebe3d0670 /src/connection
parentd8f12a2c350ad788e1c9ce532f42460273990424 (diff)
downloadconsfigurator-446b8f4a8ef78cb4605cfb551255bb455be411f0.tar.gz
install system deps by searching for package managers on PATH
With this change we handle the situation in which we don't know the OS of a host on which we need to install system packages more cleanly than before. Also rely on the new PACKAGE:INSTALLED to install the OS bootstrapper in INSTALLER:CLEANLY-INSTALLED-ONCE. This allows us to simplify usage of the property by replacing the ORIGINAL-OS argument with ORIGINAL-OS-ARCHITECTURE. Making this change does mean that we now have two ways to specify the different names a package has on different OSs: (i) something like OS:ETYPECASE where each branch applies a property which invokes an OS-specific package manager; and (ii) the plists supplied to PACKAGE:INSTALLED. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection')
-rw-r--r--src/connection/sbcl.lisp38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/connection/sbcl.lisp b/src/connection/sbcl.lisp
index 206b5ab..db5ac7e 100644
--- a/src/connection/sbcl.lisp
+++ b/src/connection/sbcl.lisp
@@ -18,33 +18,35 @@
(in-package :consfigurator.connection.sbcl)
(named-readtables:in-readtable :consfigurator)
-(defproplist sbcl-available :posix ()
- (os:etypecase
- (debianlike (apt:installed "sbcl" "build-essential"))))
-
(defparameter *sbcl* '("sbcl" "--noinform" "--noprint"
"--disable-debugger" "--no-sysinit" "--no-userinit"))
-(defmethod establish-connection ((type (eql :sbcl)) remaining &key)
+(defmethod establish-connection
+ ((type (eql :sbcl)) remaining
+ &key (package-manager nil package-manager-supplied-p))
+ "Start up a remote Lisp image using SBCL.
+
+Specifying PACKAGE-MANAGER avoids the need to see what package managers are
+available on PATH, which can provide a performance improvement."
(when (lisp-connection-p)
(warn
"Looks like you might be starting a fresh Lisp image directly from the root
Lisp. This can mean that prerequisite data gets extracted from encrypted
stores and stored unencrypted under ~~/.cache, and as such is not
recommended."))
- (unless (zerop (mrun :for-exit "command" "-v" "sbcl"))
- ;; If we're not the final hop then we don't know the OS of the host to
- ;; which we're currently connected, so we can't apply SBCL-AVAILABLE.
- ;;
- ;; TODO In the case of INSTALLER:CLEANLY-INSTALLED-ONCE this code will
- ;; have us trying to use apt to install sbcl on a Fedora host, say, upon
- ;; the first connection, before Debian has been installed. Perhaps we
- ;; should just have some code which tries to install sbcl based on the
- ;; package manager(s) it can find on PATH. Could reuse that code for
- ;; CHROOT::%DEBOOTSTRAP-MANUALLY-INSTALLED.
- (if remaining
- (failed-change "sbcl not on PATH and don't know how to install.")
- (sbcl-available)))
+ ;; Allow the user to request no attempt to install the dependencies at all,
+ ;; perhaps because they know they're already manually installed.
+ (unless (and package-manager-supplied-p (not package-manager))
+ (handler-case (package:installed
+ package-manager '(:apt "sbcl")
+ package:*consfigurator-system-dependencies*)
+ ;; If we couldn't find any package manager on PATH, just proceed in the
+ ;; hope that everything we need is already installed; we'll find out
+ ;; whether it's actually a problem pretty quickly, when the remote SBCL
+ ;; tries to compile and load the ASDF systems.
+ (package:package-manager-not-found (c)
+ (apply #'warn (simple-condition-format-control c)
+ (simple-condition-format-arguments c)))))
(let ((requirements (asdf-requirements-for-host-and-features
(safe-read-from-string
(run :input "(prin1 *features*)" *sbcl*)