updating sbcl & slippery chicken - mdedwards/slippery-chicken GitHub Wiki
Updating SBCL & slippery chicken
SBCL is regularly updated, which is great.
Installing and updating via homebrew makes this really convenient.
Deleting all your .fasl
installation files and rebuilding slippery chicken with the latest SBCL, however, is time consuming and inelegant.
I'm a lazy programmer, so I wrote the following script to save me precious seconds.
Remove .fasl files
The following code uses the wonderful UIOP library (which comes installed as part of recent SBCL releases by default). It looks inside all of the "bin" directories that you supply (for sc with optional CMN & CLM) and deletes any .fasl
files. When you relaunch you lisp with M-x slime
, slippery chicken gets re-compiled with the latest version of SBCL.
Example
(rm-fasl-files "~/sc/bin"
:cmn-bin "~/lisp/cmn"
:clm-bin "~/lisp/clm-5"
:simulate nil)
The above code on my mac returns:
Deleted 77 files in /Users/danieljross/sc/bin
Deleted 21 files in /Users/danieljross/lisp/cmn
Deleted 15 files in /Users/danieljross/lisp/clm-5
=>
("/Users/danieljross/sc/bin" "/Users/danieljross/lisp/cmn"
"/Users/danieljross/lisp/clm-5")
Set :simulate
to t
if you want to run this code without actually deleting anything.
Installation
Copy and paste the code below into your REPL, or, save it as a file and load it.
Any problems, raise an issue.
I keep a copy of this here.
Happy lisping!
(require 'uiop)
(defun rm-fasl-files (sc-bin &key cmn-bin clm-bin simulate)
"Remove .fasl files from slippery chicken, CMN and CLM-5 folders"
(let ((dir-list (list sc-bin)))
(when cmn-bin (push cmn-bin dir-list))
(when clm-bin (push clm-bin dir-list))
(loop for dir in (reverse dir-list)
with ok = '()
with wild-dir do
(setf dir (uiop:native-namestring dir))
(if (not (probe-file dir))
(error "~%sc-rebuild: ~a is not a valid directory" dir)
(setf wild-dir
(make-pathname :directory
(list :absolute dir)
:name :wild :type "fasl")))
(loop for file in (directory wild-dir)
with count = 0 do
(unless simulate
(delete-file file)
(incf count))
finally
(return
(format t "~%Deleted ~a files in ~a" count dir)))
(push dir ok)
;; return list of directories
finally (return (reverse ok)))))