Fix collects for setup with single-collect package

Before this commit, raco would try to setup each
subdirectory inside of a single collection package
as separate collects.
This commit is contained in:
Asumu Takikawa 2013-06-10 20:26:49 -04:00
parent a899083ff8
commit 03e0e4c43a
5 changed files with 34 additions and 15 deletions

View File

@ -1250,20 +1250,23 @@
(define (get-setup-collects pkg-directories metadata-ns)
(maybe-append
(for/list ([pkg-dir (in-list pkg-directories)])
(get-metadata metadata-ns pkg-dir
'setup-collects (lambda () (package-collections
pkg-dir
metadata-ns))
#:checker (lambda (v)
(unless (or (eq? v 'all)
(and (list? v)
(for ([c (in-list v)])
(or (path-string? c)
(and (list? c)
(pair? c)
(andmap path-string? c))))))
(pkg-error "bad 'setup-collects value\n value: ~e"
v)))))))
(define single-collect
(pkg-single-collection pkg-dir #:namespace metadata-ns))
(or (and single-collect (list single-collect))
(get-metadata metadata-ns pkg-dir
'setup-collects (lambda () (package-collections
pkg-dir
metadata-ns))
#:checker (lambda (v)
(unless (or (eq? v 'all)
(and (list? v)
(for ([c (in-list v)])
(or (path-string? c)
(and (list? c)
(pair? c)
(andmap path-string? c))))))
(pkg-error "bad 'setup-collects value\n value: ~e"
v))))))))
(define (pkg-install descs
#:old-infos [old-infos empty]

View File

@ -0,0 +1,3 @@
#lang setup/infotab
(define single-collection "pkg-test3")

View File

@ -0,0 +1,4 @@
#lang racket/base
(printf "pkg-test3/main loaded\n")
(exit 0)

View File

@ -0,0 +1,3 @@
This subdir exists to test that raco pkg correctly handles
single collections with subdirectories inside them.

View File

@ -27,4 +27,10 @@
$ "raco pkg create --format plt test-pkgs/raco-pkg"
$ "raco raco-pkg" =exit> 1
$ "raco pkg install test-pkgs/raco-pkg.plt"
$ "raco raco-pkg" =exit> 0)))
$ "raco raco-pkg" =exit> 0))
(with-fake-root
(shelly-case
"raco install uses raco setup with single collect"
$ "raco pkg install test-pkgs/pkg-test3-v3" =exit> 0)))