raco pkg update: allow --update-deps with a linked package

The linked package cannot be updated, but maybe its dependencies
can, so just alert the user that the linked package is skipped
instead of rejecting the request.
This commit is contained in:
Matthew Flatt 2014-12-07 07:06:54 -07:00
parent 8d2e32855e
commit 1cf985031d

View File

@ -1013,7 +1013,10 @@
pkg-name)) pkg-name))
null)) null))
(define (skip/update-dependencies) (define (skip/update-dependencies kind)
(download-printf "Skipping update of ~a: ~a\n"
kind
pkg-name)
(hash-set! update-cache pkg-name #t) (hash-set! update-cache pkg-name #t)
(update-dependencies)) (update-dependencies))
@ -1027,7 +1030,7 @@
pkg-name pkg-name
(simple-form-path (simple-form-path
(path->complete-path orig-pkg-dir (pkg-installed-dir)))) (path->complete-path orig-pkg-dir (pkg-installed-dir))))
(skip/update-dependencies))] (skip/update-dependencies "linked package"))]
[`(dir ,_) [`(dir ,_)
(if must-update? (if must-update?
(pkg-error (~a "cannot update packages installed locally;\n" (pkg-error (~a "cannot update packages installed locally;\n"
@ -1035,7 +1038,7 @@
" package was installed via a local directory\n" " package was installed via a local directory\n"
" package name: ~a") " package name: ~a")
pkg-name) pkg-name)
(skip/update-dependencies))] (skip/update-dependencies "package installed locally"))]
[`(file ,_) [`(file ,_)
(if must-update? (if must-update?
(pkg-error (~a "cannot update packages installed locally;\n" (pkg-error (~a "cannot update packages installed locally;\n"
@ -1043,7 +1046,7 @@
" package was installed via a local file\n" " package was installed via a local file\n"
" package name: ~a") " package name: ~a")
pkg-name) pkg-name)
(skip/update-dependencies))] (skip/update-dependencies "package installed locally"))]
[_ [_
(define-values (orig-pkg-source orig-pkg-type orig-pkg-dir) (define-values (orig-pkg-source orig-pkg-type orig-pkg-dir)
(if (eq? 'clone (car orig-pkg)) (if (eq? 'clone (car orig-pkg))
@ -1101,7 +1104,8 @@
(define update-cache (make-hash)) (define update-cache (make-hash))
(define catalog-lookup-cache (make-hash)) (define catalog-lookup-cache (make-hash))
(define to-update (append-map (packages-to-update download-printf db (define to-update (append-map (packages-to-update download-printf db
#:must-update? (not all-mode?) #:must-update? (and (not all-mode?)
(not update-deps?))
#:deps? (or update-deps? #:deps? (or update-deps?
all-mode?) ; avoid races all-mode?) ; avoid races
#:implies? update-implies? #:implies? update-implies?