From b14722e02903a57d10e3b9846bf94764c4356350 Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <fare@tunes.org>
Date: Thu, 13 Oct 2016 23:27:03 -0400
Subject: [PATCH] Improve the match between ways of concatenating asdf.lisp

Make sure that bundle-op, concatenate-source-op, Makefile,
make-asdf.sh, make-asdf.bat and tools/release.lisp all agree
on "the" proper order of files in uiop and asdf.
---
 Makefile                     |  4 ++--
 asdf.asd                     |  8 ++++----
 concatenate-source.lisp      |  2 +-
 make-asdf.bat                |  4 ++--
 make-asdf.sh                 |  4 ++--
 test/test-sysdef-asdf.script |  4 ++--
 tools/release.lisp           | 15 +++------------
 uiop/uiop.asd                |  2 +-
 8 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile
index 5bd7f144c..3f139b905 100644
--- a/Makefile
+++ b/Makefile
@@ -78,8 +78,8 @@ SCL ?= scl
 XCL ?= xcl
 
 header_lisp := header.lisp
-driver_lisp := uiop/package.lisp uiop/common-lisp.lisp uiop/utility.lisp uiop/os.lisp uiop/pathname.lisp uiop/filesystem.lisp uiop/stream.lisp uiop/image.lisp uiop/run-program.lisp uiop/lisp-build.lisp uiop/configuration.lisp uiop/backward-driver.lisp uiop/driver.lisp
-defsystem_lisp := upgrade.lisp component.lisp system.lisp cache.lisp find-system.lisp find-component.lisp operation.lisp action.lisp lisp-action.lisp plan.lisp operate.lisp output-translations.lisp source-registry.lisp parse-defsystem.lisp bundle.lisp concatenate-source.lisp package-inferred-system.lisp backward-internals.lisp backward-interface.lisp interface.lisp user.lisp footer.lisp
+driver_lisp := uiop/package.lisp uiop/common-lisp.lisp uiop/utility.lisp uiop/os.lisp uiop/pathname.lisp uiop/filesystem.lisp uiop/stream.lisp uiop/image.lisp uiop/lisp-build.lisp uiop/run-program.lisp uiop/configuration.lisp uiop/backward-driver.lisp uiop/driver.lisp
+defsystem_lisp := upgrade.lisp cache.lisp component.lisp system.lisp find-system.lisp find-component.lisp operation.lisp action.lisp lisp-action.lisp plan.lisp operate.lisp parse-defsystem.lisp bundle.lisp concatenate-source.lisp output-translations.lisp source-registry.lisp package-inferred-system.lisp backward-interface.lisp backward-internals.lisp interface.lisp user.lisp footer.lisp
 all_lisp := $(header_lisp) $(driver_lisp) $(defsystem_lisp)
 
 print-%  : ; @echo $* = $($*)
diff --git a/asdf.asd b/asdf.asd
index 8bc59906b..9ac3a5223 100644
--- a/asdf.asd
+++ b/asdf.asd
@@ -44,9 +44,9 @@
   :encoding :utf-8
   :components
   ((:file "upgrade")
+   (:file "cache" :depends-on ("upgrade"))
    (:file "component" :depends-on ("upgrade"))
    (:file "system" :depends-on ("component"))
-   (:file "cache" :depends-on ("upgrade"))
    (:file "find-system" :depends-on ("system" "cache"))
    (:file "find-component" :depends-on ("find-system"))
    (:file "operation" :depends-on ("find-system"))
@@ -54,14 +54,14 @@
    (:file "lisp-action" :depends-on ("action"))
    (:file "plan" :depends-on ("lisp-action"))
    (:file "operate" :depends-on ("plan"))
-   (:file "output-translations" :depends-on ("operate"))
-   (:file "source-registry" :depends-on ("find-system"))
    (:file "parse-defsystem" :depends-on ("cache" "system" "lisp-action" "operate"))
    (:file "bundle" :depends-on ("lisp-action" "operate" "parse-defsystem"))
    (:file "concatenate-source" :depends-on ("plan" "parse-defsystem" "bundle"))
+   (:file "output-translations" :depends-on ("operate"))
+   (:file "source-registry" :depends-on ("find-system"))
    (:file "package-inferred-system" :depends-on ("system" "find-system" "parse-defsystem"))
-   (:file "backward-internals" :depends-on ("find-system" "parse-defsystem"))
    (:file "backward-interface" :depends-on ("operate" "output-translations"))
+   (:file "backward-internals" :depends-on ("find-system" "parse-defsystem"))
    (:file "interface" :depends-on
           ("parse-defsystem" "concatenate-source"
            "output-translations" "source-registry" "package-inferred-system"
diff --git a/concatenate-source.lisp b/concatenate-source.lisp
index e01500f98..5e5281578 100644
--- a/concatenate-source.lisp
+++ b/concatenate-source.lisp
@@ -63,7 +63,7 @@ into a single file"))
           :with around-compile = (around-compile-hook s)
           :with other-around-compile = '()
           :for c :in (required-components
-                      s :goal-operation 'compile-op
+                      s :goal-operation 'load-op
                         :keep-operation 'compile-op
                         :other-systems (operation-monolithic-p operation))
           :append
diff --git a/make-asdf.bat b/make-asdf.bat
index 8655e52f1..8c6d1cd52 100644
--- a/make-asdf.bat
+++ b/make-asdf.bat
@@ -4,8 +4,8 @@
 
 set here=%~dp0
 set header_lisp=header.lisp
-set driver_lisp=uiop\package.lisp + uiop\common-lisp.lisp + uiop\utility.lisp + uiop\os.lisp + uiop\pathname.lisp + uiop\filesystem.lisp + uiop\stream.lisp + uiop\image.lisp + uiop\run-program.lisp + uiop\lisp-build.lisp + uiop\configuration.lisp + uiop\backward-driver.lisp + uiop\driver.lisp
-set defsystem_lisp=upgrade.lisp + component.lisp + system.lisp + cache.lisp + find-system.lisp + find-component.lisp + operation.lisp + action.lisp + lisp-action.lisp + plan.lisp + operate.lisp + output-translations.lisp + source-registry.lisp + parse-defsystem.lisp + bundle.lisp + concatenate-source.lisp + package-inferred-system.lisp + backward-internals.lisp + backward-interface.lisp + interface.lisp + user.lisp + footer.lisp
+set driver_lisp=uiop\package.lisp + uiop\common-lisp.lisp + uiop\utility.lisp + uiop\os.lisp + uiop\pathname.lisp + uiop\filesystem.lisp + uiop\stream.lisp + uiop\image.lisp + uiop\lisp-build.lisp + uiop\run-program.lisp + uiop\configuration.lisp + uiop\backward-driver.lisp + uiop\driver.lisp
+set defsystem_lisp=upgrade.lisp + cache.lisp + component.lisp + system.lisp + find-system.lisp + find-component.lisp + operation.lisp + action.lisp + lisp-action.lisp + plan.lisp + operate.lisp + parse-defsystem.lisp + bundle.lisp + concatenate-source.lisp + output-translations.lisp + source-registry.lisp + package-inferred-system.lisp + backward-interface.lisp + backward-internals.lisp + interface.lisp + user.lisp + footer.lisp
 
 %~d0
 cd %~p0
diff --git a/make-asdf.sh b/make-asdf.sh
index dbb6ab439..5b1d55603 100755
--- a/make-asdf.sh
+++ b/make-asdf.sh
@@ -5,8 +5,8 @@
 here="$(dirname $0)"
 
 header_lisp="header.lisp"
-driver_lisp="uiop/package.lisp uiop/common-lisp.lisp uiop/utility.lisp uiop/os.lisp uiop/pathname.lisp uiop/filesystem.lisp uiop/stream.lisp uiop/image.lisp uiop/run-program.lisp uiop/lisp-build.lisp uiop/configuration.lisp uiop/backward-driver.lisp uiop/driver.lisp"
-defsystem_lisp="upgrade.lisp component.lisp system.lisp cache.lisp find-system.lisp find-component.lisp operation.lisp action.lisp lisp-action.lisp plan.lisp operate.lisp output-translations.lisp source-registry.lisp parse-defsystem.lisp bundle.lisp concatenate-source.lisp package-inferred-system.lisp backward-internals.lisp backward-interface.lisp interface.lisp user.lisp footer.lisp"
+driver_lisp="uiop/package.lisp uiop/common-lisp.lisp uiop/utility.lisp uiop/os.lisp uiop/pathname.lisp uiop/filesystem.lisp uiop/stream.lisp uiop/image.lisp uiop/lisp-build.lisp uiop/run-program.lisp uiop/configuration.lisp uiop/backward-driver.lisp uiop/driver.lisp"
+defsystem_lisp="upgrade.lisp cache.lisp component.lisp system.lisp find-system.lisp find-component.lisp operation.lisp action.lisp lisp-action.lisp plan.lisp operate.lisp parse-defsystem.lisp bundle.lisp concatenate-source.lisp output-translations.lisp source-registry.lisp package-inferred-system.lisp backward-interface.lisp backward-internals.lisp interface.lisp user.lisp footer.lisp"
 
 all () {
   # Default action: bootstrap asdf.lisp
diff --git a/test/test-sysdef-asdf.script b/test/test-sysdef-asdf.script
index 14d396ecc..11e2f2c38 100644
--- a/test/test-sysdef-asdf.script
+++ b/test/test-sysdef-asdf.script
@@ -71,8 +71,8 @@
 
 (DBG "Checking that the bootstrap script and asdf.asd are in synch")
 (defun system-lisp-files (system)
-  (loop :for f :in (required-components system :keep-component 'cl-source-file)
-        :collect (enough-pathname (component-pathname f) *asdf-directory*)))
+  (loop :for f :in (input-files 'concatenate-source-op system)
+    :collect (enough-pathname f *asdf-directory*)))
 
 (defun bootstrap-lisp-files (target)
   (let ((target (format nil "~a := " target)))
diff --git a/tools/release.lisp b/tools/release.lisp
index c481c591b..27661584b 100644
--- a/tools/release.lisp
+++ b/tools/release.lisp
@@ -13,18 +13,9 @@
         :collect (enough-namestring! p b)))
 
 (defun system-source-files (system &key monolithic)
-  (let* ((sys (find-system system))
-         (components
-           (required-components system
-                                :other-systems monolithic
-                                :goal-operation 'load-op
-                                :keep-operation 'load-op
-                                :keep-component 'file-component))
-         (dir (ensure-pathname
-               (system-source-directory sys)
-               :want-absolute t :want-directory t))
-         (pathnames (mapcar 'component-pathname components)))
-    (enough-namestrings dir pathnames)))
+  (let ((system (find-system system)))
+    (enough-namestrings (system-source-directory system)
+                        (input-files 'concatenate-source-op system))))
 
 
 ;;; Making release tarballs for asdf, asdf/defsystem, uiop.
diff --git a/uiop/uiop.asd b/uiop/uiop.asd
index 9a48ee38b..6a15c9829 100644
--- a/uiop/uiop.asd
+++ b/uiop/uiop.asd
@@ -42,8 +42,8 @@ you already have a matching UIOP loaded."
    (:file "filesystem" :depends-on ("os" "pathname"))
    (:file "stream" :depends-on ("filesystem"))
    (:file "image" :depends-on ("stream"))
-   (:file "run-program" :depends-on ("stream"))
    (:file "lisp-build" :depends-on ("image"))
+   (:file "run-program" :depends-on ("stream"))
    (:file "configuration" :depends-on ("image"))
    (:file "backward-driver" :depends-on ("lisp-build" "run-program" "configuration"))
    (:file "driver" :depends-on ("backward-driver"))))
-- 
GitLab