Commit 74940751 authored by Daniel Kochmański's avatar Daniel Kochmański Committed by Francois-Rene Rideau
Browse files

bundle: component-depends-on: simplify hairy code

Create a local function linkable-system, which given a system in the current
image, returns an equivalent linkable system.

This part of code was also buggy, because if it did found `uiop', it
didn't include `asdf', but if none was found, it included `uiop' *and*
`asdf' unconditionally. This inconsistent behaviour was fixed and now we
try to inject `uiop', and if not found – `asdf'.
parent bafb641a
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -540,17 +540,16 @@ for all the linkable object files associated with the system or its dependencies

  (defmethod component-depends-on :around ((o image-op) (c system))
    (destructuring-bind ((lib-op . deps)) (call-next-method)
      (flet ((has-it-p (x) (find x deps :test 'equal :key 'coerce-name)))
      (labels ((has-it-p (x) (find x deps :test 'equal :key 'coerce-name))
               (linkable-system (x) (unless (has-it-p x)
                  (if (system-source-directory x)
                    `(,(find-system x))
                    `(,(make-library-system x))))))
        `((,lib-op
           ,@(unless (or (no-uiop c) (has-it-p "cmp"))
               `(,(make-library-system "cmp")))
           ,@(unless (or (no-uiop c) (has-it-p "uiop") (has-it-p "asdf"))
               (cond
                 ((system-source-directory :uiop) `(,(find-system :uiop)))
                 ((system-source-directory :asdf) `(,(find-system :asdf)))
                 (t `(,@(if-let (uiop (system-module-pathname "uiop"))
                          `(,(make-library-system "uiop" uiop)))
                      ,(make-library-system "asdf")))))
           ,@(unless (no-uiop c)
               (append (linkable-system "cmp")
                       (or (linkable-system "uiop")
                           (linkable-system "asdf"))))
           ,@deps)))))

  (defmethod perform ((o link-op) (c system))