switch raco pkg create' to file/tar' and `file/zip'

This commit is contained in:
Matthew Flatt 2012-11-20 10:05:53 -07:00
parent 376b1f373a
commit df4563588e

View File

@ -4,7 +4,6 @@
openssl/sha1 openssl/sha1
racket/contract racket/contract
racket/match racket/match
racket/system
racket/path racket/path
racket/file racket/file
setup/link setup/link
@ -19,6 +18,8 @@
unstable/debug unstable/debug
racket/string racket/string
file/untgz file/untgz
file/tar
file/zip
file/unzip file/unzip
"util.rkt" "util.rkt"
"util-plt.rkt") "util-plt.rkt")
@ -756,15 +757,25 @@
"")) ""))
(match create:format (match create:format
["tgz" ["tgz"
(unless (system* (find-executable-path "tar") "-cvzf" pkg "-C" dir ".") (define pkg/complete (path->complete-path pkg))
(delete-file pkg) (when (file-exists? pkg/complete)
(error 'planet2 "Package creation failed"))] (delete-file pkg/complete))
["zip"
(define orig-pkg (normalize-path pkg))
(parameterize ([current-directory dir]) (parameterize ([current-directory dir])
(unless (system* (find-executable-path "zip") "-r" orig-pkg ".") (with-handlers ([exn? (lambda (exn)
(delete-file pkg) (when (file-exists? pkg/complete)
(error 'planet2 "Package creation failed")))] (delete-file pkg/complete))
(raise exn))])
(apply tar-gzip pkg/complete (directory-list))))]
["zip"
(define pkg/complete (path->complete-path pkg))
(when (file-exists? pkg/complete)
(delete-file pkg/complete))
(parameterize ([current-directory dir])
(with-handlers ([exn? (lambda (exn)
(when (file-exists? pkg/complete)
(delete-file pkg/complete))
(raise exn))])
(apply zip pkg/complete (directory-list))))]
["plt" ["plt"
(pack-plt pkg pkg-name (list dir) (pack-plt pkg pkg-name (list dir)
#:as-paths (list "."))] #:as-paths (list "."))]