File: asdf-files.lisp

package info (click to toggle)
buildapp 1.5.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: lisp: 802; makefile: 23; sh: 8
file content (42 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
;;;; asdf-files.lisp

(in-package #:buildapp)

(defun manifest-file-files (file)
  "Return a list of all system files contained in FILE. The syntax is
one namestring per line. Relative namestrings are resolved relative to
the truename of FILE."
  (let ((truename (truename file)))
    (remove-if #'null
               (mapcar (lambda (namestring)
                         (probe-file (merge-pathnames namestring
                                                      truename)))
                       (file-lines file)))))

(defun asdf-path-files (pathname)
  (directory (merge-pathnames "*.asd" pathname)))

(defun asdf-tree-files (pathname)
  (directory (merge-pathnames "**/*.asd" pathname)))

(defun asdf-directive-files (directive-list)
  "Convert a list of directives to a list of pathnames. No two
  pathnames in th eresult have the same pathname-name. A directive
  should be a list of a symbol and a pathname. The directive can be
  one of :MANIFEST-FILE, :ASDF-PATH, or :ASDF-TREE."
  (let ((result '())
        (table (make-hash-table :test 'equalp)))
    (flet ((add-files (files)
             (dolist (file files)
               (unless (gethash (pathname-name file) table)
                 (setf (gethash (pathname-name file) table) file)
                 (push file result)))))
      (loop for (directive pathname) in directive-list
            do (ecase directive
                 (:manifest-file
                  (add-files (manifest-file-files pathname)))
                 (:asdf-path
                  (add-files (asdf-path-files pathname)))
                 (:asdf-tree
                  (add-files (asdf-tree-files pathname)))))
      (nreverse result))))