From 041a46ba57e15d82c5924bcff5d794d14fbf3e7e Mon Sep 17 00:00:00 2001 From: Christophe Junke Date: Sat, 27 Jan 2018 18:27:02 +0100 Subject: [PATCH 1/2] Archive submodules When making a release tarball, add a temporary submodules/ directory and create archives for all submodules, using "git submodules foreach". Concatenate the resulting archives into the main one. --- upstream-git.lisp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/upstream-git.lisp b/upstream-git.lisp index 3644494..1ffd982 100644 --- a/upstream-git.lisp +++ b/upstream-git.lisp @@ -63,16 +63,33 @@ (:method ((source git-at-commit-source)) (format nil "~A" (commit source)))) +(defun submodule-git-archive-command (prefix directory) + (flet ((concat (&rest strings) + (apply #'concatenate 'string strings))) + (let* ((tardir (concat (native-directory-string directory) "$path/")) + (tarfile (concat tardir "$name.tar"))) + (format nil + "mkdir -p ~S ~ + && git archive HEAD --format=tar --prefix=~S > ~S" + tardir (concat prefix "$path/") tarfile)))) + (defmethod make-release-tarball ((source git-source) output-file) (let ((prefix (release-tarball-prefix source)) (checkout (ensure-source-cache source))) (in-temporary-directory prefix (let ((temptar (merge-pathnames "package.tar")) - (tempgz (merge-pathnames "package.tar.gz"))) + (tempgz (merge-pathnames "package.tar.gz")) + (tempsub (merge-pathnames "submodules/"))) + (ensure-directories-exist tempsub) (with-posix-cwd checkout (with-binary-run-output temptar (run "git" "archive" :format "tar" :prefix prefix (target-ref source))) + (without-run-output + (run "git" "submodule" "foreach" :recursive :quiet + (submodule-git-archive-command prefix tempsub))) + (dolist (archive (directory (merge-pathnames "**/*.tar" tempsub))) + (run "tar" "Af" temptar archive)) (run "gzip" "-vn9" temptar) (copy tempgz output-file)))))) From a50041b0a3d4f5e1f18014aba54c1fba6b32d58c Mon Sep 17 00:00:00 2001 From: Christophe Junke Date: Sat, 27 Jan 2018 20:17:02 +0100 Subject: [PATCH 2/2] No need to redirect *command-output* --- upstream-git.lisp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/upstream-git.lisp b/upstream-git.lisp index 1ffd982..6d2d6a2 100644 --- a/upstream-git.lisp +++ b/upstream-git.lisp @@ -85,9 +85,8 @@ (with-binary-run-output temptar (run "git" "archive" :format "tar" :prefix prefix (target-ref source))) - (without-run-output - (run "git" "submodule" "foreach" :recursive :quiet - (submodule-git-archive-command prefix tempsub))) + (run "git" "submodule" "foreach" :recursive :quiet + (submodule-git-archive-command prefix tempsub)) (dolist (archive (directory (merge-pathnames "**/*.tar" tempsub))) (run "tar" "Af" temptar archive)) (run "gzip" "-vn9" temptar)