Handle .tar, .tar.bz2
Fri May 8 07:38:08 PDT 2009 maciej@pasternacki.net
* Handle .tar, .tar.bz2
diff -rN -u old-cl-librarian/src/repo.lisp new-cl-librarian/src/repo.lisp
--- old-cl-librarian/src/repo.lisp 2014-07-28 09:33:37.000000000 -0700
+++ new-cl-librarian/src/repo.lisp 2014-07-28 09:33:37.000000000 -0700
@@ -132,19 +132,29 @@
,(string-right-trim '(#\/) (namestring target-dir))))
target-dir)
+;; TODO: generalize for e.g. ZIP files
(defclass tarball-repo (repo)
((type :allocation :class :initform "Tarball" :initarg :%type :reader %type)
(source :initarg :source :reader source))
(:documentation "Pseudo-repo that downloads package from tarball."))
+(defun string-ends-with (str ending)
+ (string-equal (subseq str (- (length str) (length ending)))
+ ending))
+
(defmethod vc-get ((repo tarball-repo) directory
&aux (target-dir (merge-directory-pathname (repo-name-as-string repo) directory)))
(ensure-directories-exist target-dir)
(let* ((tarball (get-file (source repo) target-dir)))
(external-program:run *tar-command*
`("-C" ,(namestring target-dir)
- "-xzvf" ,(#-openmcl namestring #+openmcl ccl::native-translated-namestring
- tarball)))) ; FIXME: namestring, .tar.bz2, ...
+ ,@(cond
+ ((string-ends-with (namestring tarball) ".tar") nil)
+ ((string-ends-with (namestring tarball) ".tar.gz") '("-z"))
+ ((string-ends-with (namestring tarball) ".tgz") '("-z"))
+ ((string-ends-with (namestring tarball) ".tar.bz2") '("-j")))
+ "-xvf",(#-openmcl namestring #+openmcl ccl::native-translated-namestring
+ tarball)))) ; FIXME: namestring, .tar.bz2, ...
target-dir)
(defmethod repo-systems-pathname ((repo tarball-repo))