added checking on planet unlink
This commit is contained in:
parent
c1f76d418f
commit
1b843ea161
|
@ -21,6 +21,7 @@ PLANNED FEATURES:
|
|||
|
||||
(define erase? (make-parameter #f))
|
||||
(define displayer (make-parameter (λ () (show-installed-packages))))
|
||||
(define quiet-unlink? (make-parameter #f))
|
||||
|
||||
(define (start raco?)
|
||||
|
||||
|
@ -85,10 +86,12 @@ Install local file <plt-file> into the planet cache as though it had been downlo
|
|||
(add-hard-link-cmd owner pkg maj min path))]
|
||||
["unlink" "remove a package development link"
|
||||
"\nRemove development link associated with the given package"
|
||||
#:once-each
|
||||
[("-q" "--quiet") "don't signal an error on nonexistent links" (quiet-unlink? #t)]
|
||||
#:args (owner pkg maj min)
|
||||
(begin
|
||||
(verify-package-name pkg)
|
||||
(remove-hard-link-cmd owner pkg maj min))]
|
||||
(remove-hard-link-cmd owner pkg maj min (quiet-unlink?)))]
|
||||
["fetch" "download a package file without installing it"
|
||||
"\nDownload the given package file without installing it"
|
||||
#:args (owner pkg maj min)
|
||||
|
@ -264,10 +267,12 @@ This command does not unpack or install the named .plt file."
|
|||
(fail "Invalid major/minor version"))
|
||||
(add-hard-link ownerstr pkgstr maj min path)))
|
||||
|
||||
(define (remove-hard-link-cmd ownerstr pkgstr majstr minstr)
|
||||
(define (remove-hard-link-cmd ownerstr pkgstr majstr minstr quiet?)
|
||||
(let* ([maj (read-from-string majstr)]
|
||||
[min (read-from-string minstr)])
|
||||
(remove-hard-link ownerstr pkgstr maj min)))
|
||||
(unless (and (integer? maj) (integer? min) (> maj 0) (>= min 0))
|
||||
(fail "Invalid major/minor version"))
|
||||
(remove-hard-link ownerstr pkgstr maj min quiet?)))
|
||||
|
||||
(define (get-download-url ownerstr pkgstr majstr minstr)
|
||||
(let ([fps (params->full-pkg-spec ownerstr pkgstr majstr minstr)])
|
||||
|
|
|
@ -197,7 +197,7 @@ Various common pieces of code that both the client and server need to access
|
|||
original-table))])
|
||||
(save-hard-link-table new-table))))
|
||||
|
||||
;; filter-link-table! : (row -> boolean) -> void
|
||||
;; filter-link-table! : (row -> boolean) (row -> any/c) -> void
|
||||
;; removes all rows from the hard link table that don't match the given predicate.
|
||||
;; also updates auxiliary datastructures that might have dangling pointers to
|
||||
;; the removed links
|
||||
|
|
|
@ -68,7 +68,8 @@
|
|||
[add-hard-link
|
||||
(-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c path? void?)]
|
||||
[remove-hard-link
|
||||
(-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c void?)]
|
||||
(-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c boolean?
|
||||
void?)]
|
||||
[remove-pkg
|
||||
(-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c void?)]
|
||||
[erase-pkg
|
||||
|
@ -766,12 +767,16 @@
|
|||
(path->string path))))
|
||||
(add-hard-link! pkg-name (list owner) maj min path))
|
||||
|
||||
;; remove-hard-link : string string num num -> void
|
||||
;; remove-hard-link : string string num num boolean -> void
|
||||
;; removes any development association from the given package spec
|
||||
(define (remove-hard-link owner pkg-name maj min)
|
||||
(define (remove-hard-link owner pkg-name maj min quiet?)
|
||||
(define (matching-link? row)
|
||||
(points-to? row pkg-name (list owner) maj min))
|
||||
(when (and (empty? (filter matching-link? (get-hard-link-table)))
|
||||
(not quiet?))
|
||||
(error "no existing links match the given specification"))
|
||||
(filter-link-table!
|
||||
(lambda (row)
|
||||
(not (points-to? row pkg-name (list owner) maj min)))
|
||||
(lambda (row) (not (matching-link? row)))
|
||||
(lambda (row)
|
||||
(let ([p (row->package row)])
|
||||
(when p
|
||||
|
|
Loading…
Reference in New Issue
Block a user