|
13 | 13 | ;; You should have received a copy of the GNU General Public License |
14 | 14 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
|
16 | | -;; Use: |
17 | | - |
18 | | -;; Clone quicklisp-projects and quicklisp-controller repositories. |
19 | | -;; Setup quicklisp-controller: (quicklisp-controller:setup-directories "~/src/lisp/quicklisp-projects/") |
20 | | -;; Update the list of Quicklisp systems using QUICKLISP-CONTROLLER::UPDATE-WHAT-YOU-CAN. |
21 | | -;; Load all ASDF systems available in *QUICKLISP-CONTROLLER-DIRECTORY* using REGISTER-ALL-ASDF-FILES |
22 | | -;; Then use WRITE-SYSTEMS-FILE to serialize to a QUICKLISP-SYSTEM distribution file. |
23 | | - |
24 | 16 | (require :dexador) |
25 | 17 | (require :asdf) |
26 | 18 | (require :quicklisp) |
|
30 | 22 |
|
31 | 23 | (in-package #:quicklisp-systems) |
32 | 24 |
|
33 | | -(defparameter *quicklisp-controller-directory* #p"~/quicklisp-controller/") |
34 | 25 | (defvar *systems-file* (merge-pathnames "systems" (uiop/pathname:pathname-directory-pathname *load-pathname*))) |
35 | | -(defvar *failed-asdf-files* nil |
36 | | - "Contains a list of ASDF files that failed to be loaded and the error, after calling REGISTER-ALL-ASDF-FILES.") |
37 | | -(defparameter *conflictive-asdf-files* '("cl-quakeinfo" "qt-libs" "cl-geocode" "cl-geoip") |
38 | | - "Some ASDF files cause conflicts when trying to be loaded. These are ignored.") |
39 | | -(defparameter *systems-file-url* "https://bitbucket.org/mmontone/quicklisp-systems/downloads/systems") |
| 26 | +(defparameter *systems-file-url* "https://bitbucket.org/mmontone/quicklisp-systems/downloads/systems" |
| 27 | + "The URL from where to download the file with Quicklisp systems descriptions.") |
40 | 28 |
|
41 | 29 | (defmacro do-systems ((system &optional (path *systems-file*)) &body body) |
42 | 30 | (let ((f (gensym))) |
|
46 | 34 | while ,system |
47 | 35 | do ,@body))))) |
48 | 36 |
|
49 | | -(defun find-files-do (path pattern function &optional (include-subdirectories t)) |
50 | | - "Find files in PATH using PATTERN. Invokes FUNCTION on found files. |
51 | | -If INCLUDE-SUBDIRECTORIES is T, then work recursively." |
52 | | - (dolist (file (uiop/filesystem:directory-files path pattern)) |
53 | | - (funcall function file)) |
54 | | - (when include-subdirectories |
55 | | - (dolist (subdir (uiop/filesystem:subdirectories path)) |
56 | | - (find-files-do subdir pattern function include-subdirectories)))) |
57 | | - |
58 | | -(defun register-all-asdf-files (&optional (quicklisp-controller-directory *quicklisp-controller-directory*)) |
59 | | - "Load all ASDF system definition files found in QUICKLISP-CONTROLLER-DIRECTORY." |
60 | | - (setf *failed-asdf-files* nil) |
61 | | - (format *standard-output* "Finding ASDF files...~%") |
62 | | - (find-files-do |
63 | | - (merge-pathnames #p"upstream-cache/" quicklisp-controller-directory) |
64 | | - "*.asd" |
65 | | - (lambda (file) |
66 | | - ;; conflictive asdf system files |
67 | | - (when (not (some (lambda (conflictive-system-name) |
68 | | - (search conflictive-system-name (princ-to-string file) :test 'equalp)) |
69 | | - *conflictive-asdf-files*)) |
70 | | - (format *standard-output* "Loading ~a" file) |
71 | | - (handler-case (progn |
72 | | - (asdf/find-system:load-asd file) |
73 | | - (format *standard-output* ". Success.~%")) |
74 | | - (error (e) |
75 | | - ;;(error e) |
76 | | - (push (cons file e) *failed-asdf-files*) |
77 | | - (format *standard-output* ". ERROR.~%") |
78 | | - )))))) |
79 | | - |
80 | | -(defun serialize-asdf-systems (systems stream) |
81 | | - "Serialize all ASDF SYSTEMS to STREAM." |
82 | | - (loop for system in systems |
83 | | - do |
84 | | - (prin1 `(:name ,(slot-value system 'asdf/component::name) |
85 | | - :description ,(asdf/component:component-description system) |
86 | | - :long-description ,(asdf/component:component-long-description system) |
87 | | - :author ,(slot-value system 'asdf/system::author) |
88 | | - :mailto ,(slot-value system 'asdf/system::mailto) |
89 | | - :maintainer ,(slot-value system 'asdf/system::maintainer) |
90 | | - :homepage ,(slot-value system 'asdf/system::homepage) |
91 | | - :bug-tracker ,(slot-value system 'asdf/system::bug-tracker) |
92 | | - :version ,(slot-value system 'asdf/system::version) |
93 | | - :license ,(slot-value system 'asdf/system::licence) |
94 | | - :depends-on ,(remove-if-not 'stringp (slot-value system 'asdf/system::depends-on))) |
95 | | - stream) |
96 | | - (terpri stream))) |
97 | | - |
98 | | -(defun write-systems-file (&optional (path *systems-file*)) |
99 | | - (with-open-file (f path :direction :output :external-format :utf-8 |
100 | | - :if-exists :supersede) |
101 | | - (serialize-asdf-systems (asdf/system-registry:registered-systems*) |
102 | | - f))) |
103 | | - |
104 | 37 | (defun check-systems-list () |
105 | 38 | (and (probe-file *systems-file*) t)) |
106 | 39 |
|
|
0 commit comments