Subject: bug#36504: asdf build system: Add support for component-less .asd

From: Pierre Neidhardt <[email-masked]>
Date: Thu, 04 Jul 2019 19:33:23 +0200

I've just packaged sbcl-trivia (hooray!), which implied packaging the
component-less trivia.trivial subsystem.

If you look at the package definition, I had to do this in order to
compile successfully:

--8<---------------cut here---------------start------------->8---
(replace 'create-asd-file
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (lib (string-append out "/lib/sbcl"))
                    (level2 (assoc-ref inputs "trivia.level2")))
               (mkdir-p lib)
               (install-file "trivia.trivial.asd" lib)
               ;; XXX: This .asd does not have any component and the build
               ;; system fails to work in this case.  We should update the
               ;; build system to handle component-less .asd.
               ;; TODO: How do we append to file in Guile?  It seems that
               ;; (open-file ... "a") gets a "Permission denied".
               (substitute* (string-append lib "/trivia.trivial.asd")
                 (("\"\\)")
                  (string-append "\")

(progn (asdf/source-registry:ensure-source-registry)
       (setf (gethash
               \"trivia.level2\"
               asdf/source-registry:*source-registry*)
             #p\""
                                 level2
                                 "/share/common-lisp/sbcl-bundle-systems/trivia.level2.asd\"))"))))))
--8<---------------cut here---------------end--------------->8---

Basically our build system fails when the .asd has no component, which
is done sometime in Common Lisp packages where a system is only used as an
indirection of a union of other systems.

I suggest we update `make-asd-file' file in `lisp-utils.scm' to take
that into account.

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/