+(defparameter *tar-program*
+ ;; Please do not "clean this up" by using a bunch of #+'s and one
+ ;; #-. When the conditional is written this way, adding a new
+ ;; special case only involves one change. If #- is used, two changes
+ ;; are needed. -- JES, 2007-02-12
+ (progn
+ "tar"
+ #+darwin "gnutar"
+ #+(or sunos netbsd) "gtar"))
+
+(defun get-tar-directory (packagename)
+ (let* ((tar (with-output-to-string (o)
+ (or
+ (sb-ext:run-program *tar-program*
+ (list "-tzf" (namestring packagename))
+ :output o
+ :search t
+ :wait t)
+ (error "can't list archive"))))
+ (first-line (subseq tar 0 (position #\newline tar))))
+ (if (find #\/ first-line)
+ (subseq first-line 0 (position #\/ first-line))
+ first-line)))
+
+(defun untar-package (source packagename)
+ (with-output-to-string (o)
+ (or
+ (sb-ext:run-program *tar-program*
+ (list "-C" (namestring source)
+ "-xzvf" (namestring packagename))
+ :output o
+ :search t
+ :wait t)
+ (error "can't untar"))))
+