From fc24dae0a7ba8ccbe7633584da2b26846f37a48e Mon Sep 17 00:00:00 2001
From: Kambiz Darabi <darabi@m-creations.net>
Date: Fri, 1 Jan 2016 13:13:50 +0100
Subject: [PATCH] Replace make ext target and its documentation

With the ext/ subdirectories being an integral part
of the repo, as they were added with git subtree,
there is no need to init/deinit/clean etc. When
this repo is checked out, the test and build dependencies
are also checked out.

make ext reads the file ext/dependencies.lisp-expr and
performs a git subtree pull for all packages in ext to
update them to the specified treeish (use 'master' to
update to the latest HEAD)
---
 Makefile                   | 12 +++---------
 README.md                  | 34 ++++------------------------------
 ext/dependencies.lisp-expr | 14 ++++++++++++++
 make.bat                   | 12 ------------
 make.sh                    | 10 +---------
 tools/git.lisp             | 26 +++++++++-----------------
 tools/main.lisp            |  2 +-
 7 files changed, 32 insertions(+), 78 deletions(-)
 create mode 100644 ext/dependencies.lisp-expr

diff --git a/Makefile b/Makefile
index 3347f315..9457de81 100644
--- a/Makefile
+++ b/Makefile
@@ -5,12 +5,6 @@
 #
 # Vendors, you may want to test your implementation with:
 #   make test l=sbcl
-# BUT you first need have installed the development-time external dependencies of ASDF;
-# this will be done automatically if you are using quicklisp;
-# you can do it manually with your favorite tools (e.g. clbuild or git);
-# or you can do it using `git submodule update` which is also available as:
-#   make ext
-# To undo the `git submodule update` you can use: `make noext`
 #
 # Other targets are for maintainer use only. If you want a list of all of the targets, use
 #   make help
@@ -55,11 +49,11 @@ all ext noext driver_files defsystem_files: force
 build_asdf build/asdf.lisp: force
 	${MAKE_SCRIPT} build_asdf
 
-.PHONY: force all ext noext driver_files defsystem_files build_asdf
+.PHONY: force all driver_files defsystem_files build_asdf
 
 # The text below was automaticaly generated by `make --silent makefile-targets`
 # then manually inserted here to provide for completion:
-.PHONY: archive build-asdf bump bump-version check-all-results check-all-scripts-results check-all-upgrade-results clean debian-package doc ext-clear ext-init ext-reset ext-update extract extract-all-tagged-asdf extract-tagged-asdf fix-local-git-tags fix-remote-git-tags git-all-committed-p help install install-asdf link-archive load make-and-publish-archive make-archive makefile-targets merge-master-into-release publish-archive publish-debian-package push re show-commands t test test-all test-all-clean-load test-all-no-stop test-all-no-upgrade test-all-no-upgrade-no-stop test-all-scripts test-all-scripts-no-stop test-all-upgrade test-all-upgrade-no-stop test-ascii test-basic test-clean-load test-load-systems test-scripts test-upgrade u wc website
+.PHONY: archive build-asdf bump bump-version check-all-results check-all-scripts-results check-all-upgrade-results clean debian-package doc ext extract extract-all-tagged-asdf extract-tagged-asdf fix-local-git-tags fix-remote-git-tags git-all-committed-p help install install-asdf link-archive load make-and-publish-archive make-archive makefile-targets merge-master-into-release publish-archive publish-debian-package push re show-commands t test test-all test-all-clean-load test-all-no-stop test-all-no-upgrade test-all-no-upgrade-no-stop test-all-scripts test-all-scripts-no-stop test-all-upgrade test-all-upgrade-no-stop test-ascii test-basic test-clean-load test-load-systems test-scripts test-upgrade u wc website
 
-archive build-asdf bump bump-version check-all-results check-all-scripts-results check-all-upgrade-results clean debian-package doc ext-clear ext-init ext-reset ext-update extract extract-all-tagged-asdf extract-tagged-asdf fix-local-git-tags fix-remote-git-tags git-all-committed-p help install install-asdf link-archive load make-and-publish-archive make-archive makefile-targets merge-master-into-release publish-archive publish-debian-package push re show-commands t test test-all test-all-clean-load test-all-no-stop test-all-no-upgrade test-all-no-upgrade-no-stop test-all-scripts test-all-scripts-no-stop test-all-upgrade test-all-upgrade-no-stop test-ascii test-basic test-clean-load test-load-systems test-scripts test-upgrade u wc website: force
+archive build-asdf bump bump-version check-all-results check-all-scripts-results check-all-upgrade-results clean debian-package doc ext extract extract-all-tagged-asdf extract-tagged-asdf fix-local-git-tags fix-remote-git-tags git-all-committed-p help install install-asdf link-archive load make-and-publish-archive make-archive makefile-targets merge-master-into-release publish-archive publish-debian-package push re show-commands t test test-all test-all-clean-load test-all-no-stop test-all-no-upgrade test-all-no-upgrade-no-stop test-all-scripts test-all-scripts-no-stop test-all-upgrade test-all-upgrade-no-stop test-ascii test-basic test-clean-load test-load-systems test-scripts test-upgrade u wc website: force
 	${MAKE_SCRIPT} l='$l' L='$L' u='$u' U='$U' v='$v' s='$s' t='$t' $@
diff --git a/README.md b/README.md
index 3f10c448..69e54124 100644
--- a/README.md
+++ b/README.md
@@ -90,32 +90,6 @@ bootstrap a copy of `build/asdf.lisp` with:
 Testing it
 ----------
 
-Before you may run tests, you need a few CL libraries.
-The simplest way to get them is as follows, but read below:
-
-    make ext
-
-The above make target uses `git submodule update --init` to download
-all these libraries using git. If you don't otherwise maintain your
-own set of carefully controlled CL libraries, that's what you want to use.
-However, if you do maintain your own set of carefully controlled CL libraries
-then you will want to use whichever tools you use (e.g. `quicklisp`, `clbuild`,
-or your own scripts around `git`) to download these libraries:
-`alexandria`, `asdf-encodings`, `cl-launch`, `closer-mop`, `cl-ppcre`,
-`cl-scripting`, `fare-mop`, `fare-quasiquote`, `fare-utils`, `inferior-shell`,
-`lisp-invocation`, `named-readtables`, `optima`.
-
-If you are a CL developer, you may already have them, or may want
-to use your own tools to download a version of them you control.
-If you use [Quicklisp](https://www.quicklisp.org/), you may let
-Quicklisp download those you don't have.
-In these cases, you may NOT want to use the git submodules from `make ext`.
-Otherwise, if you want to let ASDF download known-working versions
-of its dependencies, you can do it with:
-
-    make ext
-
-
 ASDF by default uses Clozure Common Lisp (CCL) to run the scripts that orchestrate its tests.
 By defining and exporting the variable LISP to be one of `ccl`, `sbcl` or `allegro`, you
 can have it use an alternate Common Lisp implementation instead.
@@ -231,9 +205,9 @@ How do I navigate this source tree?
         * `fasls/` -- output files while running tests.
 
 * [ext/](ext/)
-    * external dependencies, that can be populated with `make ext`
-      or equivalently with `git submodule update --init`.
-      Depopulate it with `make noext`.
+  * external dependencies, that can be updated with `make ext` which
+    reads the file ext/dependencies.lisp-expr which contains a list of
+    packages, their git repos and the version which is used
 
 * [README.md](README.md)
     * this file
@@ -242,4 +216,4 @@ How do I navigate this source tree?
     * plenty of ideas for how to further improve ASDF.
 
 
-Last updated Saturday, September 19th, 2015.
+Last updated Friday, January 1st, 2016.
diff --git a/ext/dependencies.lisp-expr b/ext/dependencies.lisp-expr
new file mode 100644
index 00000000..cd60b59b
--- /dev/null
+++ b/ext/dependencies.lisp-expr
@@ -0,0 +1,14 @@
+(setf asdf-tools::*ext-dependencies*
+      '(("alexandria" "master" "https://gitlab.common-lisp.net/alexandria/alexandria.git")
+        ("asdf-encodings" "master" "https://gitlab.common-lisp.net/asdf/asdf-encodings.git")
+        ("cl-launch" "master" "https://gitlab.common-lisp.net/xcvb/cl-launch.git")
+        ("cl-ppcre" "master" "https://github.com/edicl/cl-ppcre")
+        ("cl-scripting" "master" "https://github.com/fare/cl-scripting.git")
+        ("closer-closer-mop" "master" "git://git.code.sf.net/p/closer/closer-mop")
+        ("fare-mop" "master" "https://gitlab.common-lisp.net/frideau/fare-mop.git")
+        ("fare-quasiquote" "master" "https://gitlab.common-lisp.net/frideau/fare-quasiquote.git")
+        ("fare-utils" "master" "https://gitlab.common-lisp.net/frideau/fare-utils.git")
+        ("inferior-shell" "master" "https://gitlab.common-lisp.net/qitab/inferior-shell.git")
+        ("lisp-invocation" "master" "https://gitlab.common-lisp.net/qitab/lisp-invocation.git")
+        ("named-readtables" "master" "https://github.com/melisgl/named-readtables.git")
+        ("optima" "master" "https://github.com/m2ym/optima.git")))
diff --git a/make.bat b/make.bat
index e9851913..4d3cf917 100644
--- a/make.bat
+++ b/make.bat
@@ -13,8 +13,6 @@ cd %~p0
 if "%~1"=="" goto all
 if "%~1"=="all" goto all
 if "%~1"=="build_asdf" goto build_asdf
-if "%~1"=="ext" goto ext
-if "%~1"=="noext" goto noext
 if "%~1"=="driver_files" goto driver_files
 if "%~1"=="defsystem_files" goto defsystem_files
 
@@ -42,16 +40,6 @@ goto :end
  rename %a%.tmp asdf.lisp
  goto end
 
-:ext
-:: Download all the development-time dependencies of ASDF:
- git submodule update --init
- goto end
-
-:noext
-:: Remove all the development-time dependencies of ASDF:
- git submodule deinit .
- goto end
-
 :driver_files
 :: These targets are used during tests to ensure the Makefile is in synch with the .asd files.
  echo %driver_lisp%
diff --git a/make.sh b/make.sh
index 1ccb42e6..c19d0690 100755
--- a/make.sh
+++ b/make.sh
@@ -23,14 +23,6 @@ build_asdf () {
     mv -f ${a}.tmp ${a}
   fi
 }
-ext () {
-  # Download all the development-time dependencies of ASDF:
-  git submodule update --init
-}
-noext () {
-  # Remove all the development-time dependencies of ASDF:
-  git submodule deinit .
-}
 driver_files () {
   # These targets are used during tests to ensure the Makefile is in synch with the .asd files.
   echo ${driver_lisp}
@@ -42,6 +34,6 @@ defsystem_files () {
 
 case "$1" in
   "") all ;;
-  all|build_asdf|ext|noext|driver_files|defsystem_files) "$@" ;;
+  all|build_asdf|driver_files|defsystem_files) "$@" ;;
   *) build_asdf ; exec ${here}/tools/asdf-tools env "$@" ;;
 esac ; exit
diff --git a/tools/git.lisp b/tools/git.lisp
index 08cc22ab..c3a08ec2 100644
--- a/tools/git.lisp
+++ b/tools/git.lisp
@@ -57,20 +57,12 @@
   (match (first (nth-value 2 (git '(status) :output :lines)))
     ((ppcre "^# On branch (.*)$" x) x)))
 
-(deftestcmd ext-init ()
-  "Populate the ext/ directory if not already populated.
-Same as `make ext` in the bootstrap make script."
-  (git '(submodule update --init)))
-
-(deftestcmd ext-clear ()
-  "Depopulate the ext/ directory.
-Same as `make noext` in the bootstrap make script."
-  (git '(submodule deinit ".")))
-
-(deftestcmd ext-reset ()
-  "Reset the ext/ directory to the contents specified by the current git checkout."
-  (git '(submodule update --init)))
-
-(deftestcmd ext-update ()
-  "Update the ext/ directory to the latest version from remote repositories."
-  (git '(submodule update --remote)))
+(deftestcmd ext ()
+  "Update the ext/ directory with the content of ext/dependencies.lisp-expr."
+  (let (*ext-dependencies*)
+    (load (pn "ext/dependencies.lisp-expr")))
+  (dolist (dep *ext-dependencies*)
+    (destructuring-bind (package treeish repo) dep
+      (let* ((prefix (format nil "--prefix=ext/~A" package))
+             (message (format nil "Updated ~A to ~A from repo ~A\n\ngit subtree pull ~A --squash ~A ~A" prefix treeish repo prefix repo treeish)))
+        (git `(subtree pull ,prefix --squash ,repo ,treeish))))))
diff --git a/tools/main.lisp b/tools/main.lisp
index 63005940..d6299d73 100644
--- a/tools/main.lisp
+++ b/tools/main.lisp
@@ -45,7 +45,7 @@ The UNIX-y name will be downcased, and any % prefix will be dropped."
   ;; :when (and (eq x (find-command x)) (documentation x 'function)) :collect x)
   '(build-asdf doc website wc ;; build
     clean %push merge-master-into-release fix-local-git-tags fix-remote-git-tags ;; git
-    ext-init ext-clear ext-reset ext-update ;; extension
+    ext ;; extension
     git-all-committed-p
     bump-version bump ;; version
     test-load-systems test-clean-load test-basic test-ascii %load install-asdf ;; test-basic
-- 
GitLab