raco pkg': treat ".plt" format consistently with raco setup -A'

An old package intended for use with `raco setup -A' can be
installed with `raco pkg install'.

A package created with `raco pkg create --format plt' can be
installed with `raco setup -A', although it could leave behind
weird "MANIFEST.rktd" and other files in the "collects" directory.

An old package created with `raco pkg create --format plt' still
can be used with `raco pkg install', although not with `raco setup -A'.

The change from previous 'raco pkg' behavior is that package content
now claims to be in a "collects" directory that is
installation-relative, and unpacking redirects "collects" to the
package-staging area. At the same time, unpacking still works the
same as before on ".plt" archives that are not installation-relative.
This commit is contained in:
Matthew Flatt 2012-11-28 10:18:43 -07:00
parent abe4c1143f
commit 3c253b0e2b
2 changed files with 19 additions and 6 deletions

View File

@ -21,8 +21,7 @@
file/tar
file/zip
file/unzip
"util.rkt"
"util-plt.rkt")
"util.rkt")
(define current-install-system-wide?
(make-parameter #f))
@ -320,7 +319,12 @@
[#"zip"
(unzip pkg (make-filesystem-entry-reader #:dest pkg-dir))]
[#"plt"
(unplt pkg pkg-dir)]
(make-directory* pkg-dir)
(unpack pkg pkg-dir
(lambda (x) (printf "~a\n" x))
(lambda () pkg-dir)
#f
(lambda (auto-dir main-dir file) pkg-dir))]
[x
(error 'pkg "Invalid package format: ~e" x)])
@ -818,8 +822,15 @@
(raise exn))])
(apply zip pkg/complete (directory-list))))]
["plt"
(pack-plt pkg pkg-name (list dir)
#:as-paths (list "."))]
(define dest (path->complete-path pkg))
(parameterize ([current-directory dir])
(define names (filter std-filter (directory-list)))
(define dirs (filter directory-exists? names))
(pack-plt dest pkg-name
names
#:plt-relative? #t
#:as-paths (map (lambda (v) (build-path "collects" v)) names)
#:collections (map list (map path->string dirs))))]
[x
(error 'pkg "Invalid package format: ~e" x)])
(define chk (format "~a.CHECKSUM" pkg))

View File

@ -119,7 +119,9 @@
(let ([location (string->loc (car v))])
(if (eq? location 'relative)
(apply build-path v)
(list location (apply build-path (cdr v)))))]
(if (null? (cdr v))
(list location (build-path/convention-type (system-path-convention-type) 'same))
(list location (apply build-path (cdr v))))))]
[else (error "malformed path description: " v)]))
;; string->loc : string -> location