-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1587 from clasp-developers/tarball
Add archive function for koga
- Loading branch information
Showing
17 changed files
with
80 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
(in-package #:koga) | ||
|
||
(defun read-file-form (path &optional tag) | ||
(if tag | ||
(read-from-string (run-program-capture (format nil "git show ~a:~a" tag path))) | ||
(uiop:read-file-form path))) | ||
|
||
(defun archive (&rest initargs | ||
&key archive extensions tag | ||
&allow-other-keys) | ||
(declare (ignore initargs)) | ||
(let* ((prefix (format nil "clasp-~a/" | ||
(getf (read-file-form #P"version.sexp" tag) :version))) | ||
(tar-name (concatenate 'string (if (stringp archive) archive "archive") ".tar")) | ||
(gz-name (concatenate 'string tar-name ".gz"))) | ||
(uiop:delete-file-if-exists tar-name) | ||
(uiop:delete-file-if-exists gz-name) | ||
(message nil "Creating main archive...") | ||
(run-program (format nil "git archive --output=~a --prefix=~a --format=tar ~a" | ||
tar-name prefix (or tag "HEAD"))) | ||
(uiop:call-with-temporary-file | ||
(lambda (temp-path) | ||
(loop for source in (read-file-form #P"repos.sexp" tag) | ||
for name = (getf source :name) | ||
for directory = (getf source :directory) | ||
for extension = (getf source :extension) | ||
when (or (not extension) | ||
(member extension extensions)) | ||
do (message nil "Creating ~(~a~) archive..." name) | ||
(run-program (format nil "git archive --output=~a --format=tar --prefix=~a~a ~a" | ||
temp-path prefix directory | ||
(if tag | ||
(or (getf source :branch) | ||
(getf source :commit)) | ||
"HEAD")) | ||
:directory directory) | ||
(run-program (format nil "tar --concatenate --file ~a ~a" | ||
tar-name temp-path)))) | ||
:want-stream-p nil) | ||
(message nil "Compressing archive...") | ||
(run-program (format nil "gzip ~a" tar-name)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.