Skip to content
make-tarball 1.95 KiB
Newer Older
":" ; exec sbcl --script "$0" "$@" ; exit # -*- Lisp -*-
;;;;; Really runs on any decent Common Lisp implementation
(load (make-pathname :name "prelude" :type "lisp" :defaults *load-pathname*)
  :verbose nil :print nil)
;;;;; create tarball for the current version.
(in-package :asdf)

(asdf-debug)

(describe (find-system :asdf))

(defparameter *ad* (find-system :asdf-driver))
(defparameter *asdf-dir*
  (ensure-pathname (system-source-directory *ad*)
                   :want-existing t :want-absolute t))
(defun apath (x) (subpathname *asdf-dir* x))
(defun ann (x) (native-namestring (apath x)))
(defparameter *build-dir* (apath "build/"))
(defparameter /build-dir/ (ann "build/"))
(defun bpath (x) (subpathname *build-dir* x))
(defun bnn (x) (native-namestring (bpath x)))
  (list* "asdf-driver.asd" "version.lisp-expr"
         (loop :for c :in (operated-components
                           *ad* :goal-operation 'load-op
                                :keep-operation 'load-op)
               :for n = (enough-namestring (component-pathname c)
                                           *asdf-directory*)
               :when (typep c 'cl-source-file)
                 :collect n)))
(defparameter *version*
  (safe-read-first-file-form (apath "version.lisp-expr")))
(defparameter *name* (format nil "asdf-driver-~A" *version*))
(defparameter *tarname* (strcat *name* ".tar.gz"))
(defparameter dirname/ (strcat *name* "/"))
(defparameter *destination*
  (ensure-pathname (bpath dirname/)
                   :want-directory t :want-absolute t))
(assert (< 6 (length (pathname-directory *destination*))))
(defparameter /destination/ (native-namestring *destination*))
(run-program/ `("rm" "-rf" ,/destination/))
(ensure-directory-exists *destination*)
(run-program/ `("ln" ,@(mapcar 'ann *files*) ,/destination/))
(run-program/ (format nil "cd ~S && tar zcf ~S ~S"
                      ,/build-dir/, ,*tarname* ,dirname/))
(run-program/ `("rm" "-rf" ,/destination/))