Recently Written · git

clapt

Archived: generate SBCL cores for lots of libraries.

git clone https://github.com/equwal/clapt

Log | Files | Refs


code/add.lisp (1056 bytes)

1 (in-package #:clapt)
2 
3 ;; TODO: Use actual conditions properly for the user.
4 ;; Use this when checking if the package exists.
5 ;; (warner error "~@{~a~}~%" "Could not add the " package " package.")
6 
7 (defun add (manager &rest packages)
8   (add-signal manager packages)
9   (warner user "~a~%" "run (clapt:update) to install them and die."))
10 
11 (defun add-signal (manager packages)
12   "Assumes already installed."
13   (with-open-file (f *init-file*
14                      :direction :output
15                      :if-exists :append)
16     (loop for p in packages
17           do (add-once manager p f))))
18 
19 (defun add-once (manager package stream)
20   (let ((pn (equalp (manager-packages manager)
21                     (pushnew-package manager package))))
22     (when (not pn)
23       (print
24        `(pushnew ',package ,(manager-packages-variable manager))
25        stream))
26     (if pn
27         (warner user "~@{~a~}~%" "Ignored the " package " package, "
28                 "since it is already installed.")
29         (warner user "~@{~a~}~%" "Added the " package " package."))
30     package))