root/trunk/thirdparty/asdf/cclan.lisp

Revision 2236, 3.4 kB (checked in by hhubner, 1 year ago)

update asdf from cvs

Line 
1 (in-package :cclan)
2
3 ;;;; This file contains functions, classes etc that are not part of
4 ;;;; asdf itself, but extend it in various ways useful for maintainers
5 ;;;; of new-style cCLan packages
6
7 ;;;; The public interface consists of the functions whose symbols are
8 ;;;; exported from the package
9
10 ;;;; This file does not contain references to asdf internals - or
11 ;;;; shouldn't, anyway.  Send bug reports
12
13    
14 (defun mapappend (function list)
15   (let ((f (coerce function 'function)))
16     (loop for i in list append (funcall f i))))
17
18 (defgeneric all-components (component))
19 (defmethod all-components ((source-file source-file))
20   (list source-file))
21
22 (defmethod all-components ((module module))
23   (cons module (mapappend #'all-components (module-components module))))
24
25 (defmethod all-components ((module symbol))
26   (all-components (find-system module)))
27
28 (defun cvs-tag-name (system)
29   (let* ((system (find-system system))
30          (version (component-version system)))
31     (format nil "release_~A"  (substitute #\_ #\. version))))
32  
33 (defun cvs-tag (system)
34   (let* ((system (find-system system))
35          (directory (component-pathname system)))
36     (run-shell-command "cd ~A && cvs tag -F ~A"
37                        (namestring directory)  (cvs-tag-name system))))
38
39
40 (defun write-readme-file (stream suggested-registry system-name)
41   "Write a README.install file detailing a possible sequence of commands to use the newly-untarred system."
42   (format stream "~
43 1.  Make a symlink in ~W[*] pointing to the .asd file
44 2.  Start your asdf-enabled lisp
45 2a. Ensure that ~W[*] is in asdf:*central-registry*
46 3.  At the lisp prompt, type '(asdf:operate 'asdf:load-op ~W)'. This
47     will compile and load the system into your running lisp.
48
49 [*] This path (~W) is only a suggestion; the important
50 thing is that asdf know where to find the .asd file.  asdf uses the
51 contents of the variable ASDF:*CENTRAL-REGISTRY* to find its system
52 definitions.
53
54 These instructions were automatically generated by cCLan software. Use
55 at your own peril.~%" suggested-registry suggested-registry system-name suggested-registry))
56
57 (defun write-package (system)
58   (let* ((parent-dir
59           (parse-namestring
60            (format nil "/tmp/~A.~A/"
61                    #+sbcl (sb-unix:unix-getpid)
62                    #-sbcl (random 1000000)
63                    (get-internal-run-time))))
64          (system (find-system system))
65          (sub-dir-name
66           (format nil "~A_~A"
67                   (component-name system) (component-version system)))
68          (cvsroot-file
69           (merge-pathnames "CVS/Root" (component-pathname system)))
70          (old-pwd *default-pathname-defaults*)
71          (*default-pathname-defaults* parent-dir))
72     (ensure-directories-exist parent-dir)
73     (cvs-tag system)
74     (and
75      (zerop (asdf:run-shell-command
76              "cd ~A && cvs -d `cat ~A` checkout -d ~A -r ~A -kv ~A"
77              (namestring parent-dir)
78              (namestring cvsroot-file)
79              sub-dir-name
80              (cvs-tag-name system)
81              (component-name system)))
82      (with-open-file (o (format nil "~A/INSTALL.asdf" sub-dir-name)
83                         :direction :output)
84        (write-readme-file o "$HOME/lisp/systems/" (component-name system))
85        t)
86      (zerop (asdf:run-shell-command "cd ~A && tar cf ~A~A.tar ~A"
87                                     (namestring parent-dir)
88                                     (namestring old-pwd) sub-dir-name
89                                     sub-dir-name))
90      (zerop (asdf:run-shell-command
91              "gzip -f9  ~A~A.tar"
92              (namestring old-pwd) sub-dir-name))
93      (format t "Now run~%  gpg -b -a  ~A~A.tar.gz~%in a shell with a tty"
94              (namestring old-pwd) sub-dir-name))))
95
96 (defun class-name-of (x)
97   (class-name (class-of x)))
98
99
Note: See TracBrowser for help on using the browser.