fix problem with path->collects-relative
An internal error could be triggered by a path immediately inside the "pkgs" directory.
This commit is contained in:
parent
e44b15c032
commit
b3ab82c5f9
|
@ -1,5 +1,6 @@
|
|||
#lang racket/base
|
||||
(require pkg/path)
|
||||
(require pkg/path
|
||||
setup/dirs)
|
||||
|
||||
(module+ test
|
||||
(require rackunit)
|
||||
|
@ -18,6 +19,9 @@
|
|||
(check-equal? (path->pkg (find-system-path 'temp-dir))
|
||||
#f)
|
||||
|
||||
(check-equal? (path->pkg (build-path (find-pkgs-dir) "pkgs.rktd"))
|
||||
#f)
|
||||
|
||||
(check-equal? (call-with-values
|
||||
(lambda () (path->pkg+subpath+collect (collection-file-path "serve-catalog.rkt" "distro-build")))
|
||||
list)
|
||||
|
|
|
@ -111,13 +111,15 @@
|
|||
;; name followed by "+<n>")
|
||||
(define len (length d))
|
||||
(define pkg-name (path-element->string (list-ref p len)))
|
||||
(values (if (regexp-match? #rx"[+]" pkg-name) ; +<n> used as an alternate path, sometimes
|
||||
(regexp-replace #rx"[+].*$" pkg-name "")
|
||||
pkg-name)
|
||||
(build-path* (list-tail p (add1 len)))
|
||||
(and want-collect?
|
||||
(let ([i (hash-ref (read-pkg-db/cached) pkg-name #f)])
|
||||
(and i (sc-pkg-info? i) (sc-pkg-info-collect i)))))]
|
||||
(if (regexp-match? #rx"pkgs[.]rktd" pkg-name)
|
||||
(values #f #f #f) ; don't count the database as a package
|
||||
(values (if (regexp-match? #rx"[+]" pkg-name) ; +<n> used as an alternate path, sometimes
|
||||
(regexp-replace #rx"[+].*$" pkg-name "")
|
||||
pkg-name)
|
||||
(build-path* (list-tail p (add1 len)))
|
||||
(and want-collect?
|
||||
(let ([i (hash-ref (read-pkg-db/cached) pkg-name #f)])
|
||||
(and i (sc-pkg-info? i) (sc-pkg-info-collect i))))))]
|
||||
[else
|
||||
;; Maybe it's a linked package
|
||||
(define pkgs-dir (get-pkgs-dir scope))
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
(define-values (pkg subpath pkg-collect)
|
||||
(path->pkg+subpath+collect simple-p #:cache cache))
|
||||
(cond
|
||||
[pkg
|
||||
[(and pkg (not (eq? 'same subpath)))
|
||||
(define p-l (map path-element->string (reverse (explode-path subpath))))
|
||||
(define new-c-l (let ([l (reverse (cdr p-l))])
|
||||
(if pkg-collect
|
||||
|
|
Loading…
Reference in New Issue
Block a user