diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-05 11:40:39 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-05 11:40:39 -0700 |
commit | b44d416cd4ff27132f907d5822c286cc65488537 (patch) | |
tree | d91546523bc560a1e7c8f0a5708c4885aa089752 /src/property/apt.lisp | |
parent | 770cea2e860474e26a5e5ac2f9e2b73fe7e5825d (diff) | |
download | consfigurator-b44d416cd4ff27132f907d5822c286cc65488537.tar.gz |
call FLATTEN in various apt properties & functions
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/apt.lisp')
-rw-r--r-- | src/property/apt.lisp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/property/apt.lisp b/src/property/apt.lisp index f8152e6..e38fa85 100644 --- a/src/property/apt.lisp +++ b/src/property/apt.lisp @@ -42,22 +42,24 @@ (defprop installed :posix (&rest packages) "Ensure all of the apt packages PACKAGES are installed." (:desc #?"apt installed @{packages}") + (:preprocess (flatten packages)) (:hostattrs (declare (ignore packages)) (os:required 'os:debianlike)) (:check - (apply #'all-installed-p packages)) + (all-installed-p packages)) (:apply (with-maybe-update (apt-get :inform "-y" "install" packages)))) (defprop removed :posix (&rest packages) "Ensure all of the apt packages PACKAGES are removed." (:desc #?"apt removed @{packages}") + (:preprocess (flatten packages)) (:hostattrs (declare (ignore packages)) (os:required 'os:debianlike)) (:check - (apply #'none-installed-p packages)) + (none-installed-p packages)) (:apply (apt-get :inform "-y" "remove" packages))) @@ -199,13 +201,14 @@ only upgrade Debian stable." (defun all-installed-p (&rest packages) (loop with n = 0 - for line in (apt-cache-policy packages) + with packages* = (flatten packages) + for line in (apt-cache-policy packages*) when (re:scan apt-cache-policy-installed line) do (incf n) - finally (return (= n (length packages))))) + finally (return (= n (length packages*))))) (defun none-installed-p (&rest packages) - (loop for line in (apt-cache-policy packages) + (loop for line in (apt-cache-policy (flatten packages)) never (re:scan apt-cache-policy-installed line))) |