Skip to content

Commit 8e2cbdb

Browse files
authored
Merge pull request #15 from christophejunke/master
Archive submodules
2 parents f71b73d + a50041b commit 8e2cbdb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

upstream-git.lisp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,32 @@
6363
(:method ((source git-at-commit-source))
6464
(format nil "~A" (commit source))))
6565

66+
(defun submodule-git-archive-command (prefix directory)
67+
(flet ((concat (&rest strings)
68+
(apply #'concatenate 'string strings)))
69+
(let* ((tardir (concat (native-directory-string directory) "$path/"))
70+
(tarfile (concat tardir "$name.tar")))
71+
(format nil
72+
"mkdir -p ~S ~
73+
&& git archive HEAD --format=tar --prefix=~S > ~S"
74+
tardir (concat prefix "$path/") tarfile))))
75+
6676
(defmethod make-release-tarball ((source git-source) output-file)
6777
(let ((prefix (release-tarball-prefix source))
6878
(checkout (ensure-source-cache source)))
6979
(in-temporary-directory prefix
7080
(let ((temptar (merge-pathnames "package.tar"))
71-
(tempgz (merge-pathnames "package.tar.gz")))
81+
(tempgz (merge-pathnames "package.tar.gz"))
82+
(tempsub (merge-pathnames "submodules/")))
83+
(ensure-directories-exist tempsub)
7284
(with-posix-cwd checkout
7385
(with-binary-run-output temptar
7486
(run "git" "archive" :format "tar" :prefix prefix
7587
(target-ref source)))
88+
(run "git" "submodule" "foreach" :recursive :quiet
89+
(submodule-git-archive-command prefix tempsub))
90+
(dolist (archive (directory (merge-pathnames "**/*.tar" tempsub)))
91+
(run "tar" "Af" temptar archive))
7692
(run "gzip" "-vn9" temptar)
7793
(copy tempgz output-file))))))
7894

0 commit comments

Comments
 (0)