Skip to content

Commit

Permalink
Execute zip directly
Browse files Browse the repository at this point in the history
  • Loading branch information
borodust committed Aug 11, 2019
1 parent dde98d9 commit 9945079
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions distribution/utils.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
(defun wrap-executable-name (name)
(format nil "~A~A" name #+windows ".exe" #-windows ""))

(defun zip (relative-directory archive-name &optional (executable "zip"))
(list (wrap-executable-name executable) "-v" "-r" archive-name relative-directory))


(defvar *lisp* (first (uiop:raw-command-line-arguments)))
(defvar *zip* (wrap-executable-name "zip"))
(defvar *zip* #'relative-directory)


(defun distribution-system-path ()
Expand Down Expand Up @@ -99,14 +103,18 @@
(last-path-el (enough-namestring (fad:canonical-pathname path) parent-path))
(name (or name (file last-path-el))))
(multiple-value-bind (output error-output code)
(inferior-shell:run/nil (list (wrap-executable-name "sh")
"-c" (inferior-shell:token-string
(list "cd " (namestring parent-path) " && "
*zip* " -v -r " name ".zip "
last-path-el)))
:output :string
:error-output :string
:show t
:on-error nil)
(uiop:with-current-directory ((namestring parent-path))
(inferior-shell:run/nil (if (functionp *zip*)
(funcall *zip* last-path-el
(inferior-shell:token-string
(list name ".zip")))
(zip last-path-el
(inferior-shell:token-string
(list name ".zip"))
*zip*))
:output :string
:error-output :string
:show t
:on-error nil))
(unless (= code 0)
(error "~A~&~A" output error-output)))))

0 comments on commit 9945079

Please sign in to comment.