Skip to content
Snippets Groups Projects
Commit ee44ba8e authored by Daniel Barlow's avatar Daniel Barlow
Browse files

tools which will be useful for cclan package creators

parent a00661f0
No related branches found
No related tags found
No related merge requests found
(in-package :cl-user)
(defpackage :cclan (:use #:cl #:asdf)
:export #:make-tar-file)
(defpackage :cclan-system (:use #:cl #:asdf))
(defsystem 'cclan
:components
(:file "cclan-package")
(:file "cclan" :depends-on ("cclan-package")))
\ No newline at end of file
(in-package :cclan)
;;;; This file contains functions, classes etc that are not part of
;;;; asdf itself, but extend it in various ways useful for maintainers
;;;; of new-style cCLan packages
;;;; This file does not contain references to asdf internals - or
;;;; shouldn't, anyway. Send bug reports
(defun mapappend (function list)
(let ((f (coerce function 'function)))
(loop for i in list append (funcall f i))))
(defgeneric list-files (component))
(defmethod list-files ((c source-file))
(list (component-pathname c)))
(defmethod list-files ((c module))
(mapappend 'list-files (module-components c)))
(defun make-tar-file (system)
"Make a tar file named SYSTEM-NAME_VERSION.tar containing all the files in SYSTEM. The file is created in the directory containing the system directory. Returns T on success"
(let* ((system (find-system system))
(sys-path (component-pathname system))
(base-path (make-pathname
:directory (butlast (pathname-directory sys-path))
:defaults sys-path))
(files
(mapcar (lambda (x) (enough-namestring x base-path))
(cons
(truename (system-definition-pathname system))
(list-files system)))))
(= 0
(run-shell-command "cd ~A && tar cf ~A_~A.tar ~{~D ~}"
(namestring base-path)
(component-name system)
(component-version system)
files))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment