raco pkg update: adjust --update-deps
handling, again
Still trying to get the dependencies-have-changed-for-a-link case right without breaking other cases.
This commit is contained in:
parent
ebd817f278
commit
9b9546c0bf
|
@ -1,5 +1,6 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
(require racket/file
|
(require racket/file
|
||||||
|
racket/format
|
||||||
"shelly.rkt"
|
"shelly.rkt"
|
||||||
"util.rkt")
|
"util.rkt")
|
||||||
|
|
||||||
|
@ -109,4 +110,42 @@
|
||||||
$ "raco pkg update pkg-a" =exit> 1
|
$ "raco pkg update pkg-a" =exit> 1
|
||||||
$ "racket -e '(require pkg-a)'" =exit> 0
|
$ "racket -e '(require pkg-a)'" =exit> 0
|
||||||
$ "racket -e '(require pkg-b)'" =exit> 43
|
$ "racket -e '(require pkg-b)'" =exit> 43
|
||||||
$ "racket -e '(require pkg-b/contains-dep)'" =exit> 0)))
|
$ "racket -e '(require pkg-b/contains-dep)'" =exit> 0))
|
||||||
|
|
||||||
|
(with-fake-root
|
||||||
|
(shelly-case
|
||||||
|
"dependency changes for a link"
|
||||||
|
|
||||||
|
$ "raco pkg config --set catalogs http://localhost:9990"
|
||||||
|
(hash-set! *index-ht-1* "pkg-a"
|
||||||
|
(hasheq 'checksum
|
||||||
|
(file->string "test-pkgs/pkg-a-first.plt.CHECKSUM")
|
||||||
|
'source
|
||||||
|
"http://localhost:9997/pkg-a-first.plt"))
|
||||||
|
|
||||||
|
(define b-dir (make-temporary-file "~a-b" 'directory))
|
||||||
|
(copy-directory/files "test-pkgs/pkg-b-first" (build-path b-dir "pkg-b"))
|
||||||
|
$ (~a "raco pkg install " (build-path b-dir "pkg-b"))
|
||||||
|
|
||||||
|
(delete-directory/files (build-path b-dir "pkg-b"))
|
||||||
|
(copy-directory/files "test-pkgs/pkg-b-second" (build-path b-dir "pkg-b"))
|
||||||
|
$ "raco pkg update pkg-b"
|
||||||
|
=exit> 1
|
||||||
|
=stderr> #rx"cannot update linked packages"
|
||||||
|
$ (~a "raco pkg update --deps force " (build-path b-dir "pkg-b"))
|
||||||
|
$ (~a "raco pkg update --batch --update-deps " (build-path b-dir "pkg-b"))
|
||||||
|
=exit> 1
|
||||||
|
=stderr> #rx"missing dependencies"
|
||||||
|
|
||||||
|
$ (~a "raco pkg update --deps search-auto --update-deps " (build-path b-dir "pkg-b"))
|
||||||
|
|
||||||
|
(delete-directory/files b-dir)))
|
||||||
|
|
||||||
|
(with-fake-root
|
||||||
|
(shelly-case
|
||||||
|
"using --update-deps with dependency changes doesn't break update"
|
||||||
|
|
||||||
|
(init-update-deps-test)
|
||||||
|
|
||||||
|
$ "raco pkg update --auto pkg-b"
|
||||||
|
$ "racket -e '(require pkg-a)'")))
|
||||||
|
|
|
@ -1000,12 +1000,12 @@
|
||||||
pkg-name)
|
pkg-name)
|
||||||
null))
|
null))
|
||||||
|
|
||||||
|
(define (check-missing-dependencies k)
|
||||||
(define missing-deps
|
(define missing-deps
|
||||||
(for/list ([dep (in-list deps)]
|
(for/list ([dep (in-list deps)]
|
||||||
#:unless (equal? dep "racket")
|
#:unless (equal? dep "racket")
|
||||||
#:unless (package-info dep #:db db #f))
|
#:unless (package-info dep #:db db #f))
|
||||||
dep))
|
dep))
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
[(pair? missing-deps)
|
[(pair? missing-deps)
|
||||||
;; A dependency is missing. Treat the dependent package as
|
;; A dependency is missing. Treat the dependent package as
|
||||||
|
@ -1013,7 +1013,7 @@
|
||||||
;; that the user is asked about installing dependencies, etc.
|
;; that the user is asked about installing dependencies, etc.
|
||||||
(log-pkg-debug "Missing dependencies of ~s: ~s" pkg-name missing-deps)
|
(log-pkg-debug "Missing dependencies of ~s: ~s" pkg-name missing-deps)
|
||||||
(update-loop (pkg-info->desc pkg-name info) #f #t #t)]
|
(update-loop (pkg-info->desc pkg-name info) #f #t #t)]
|
||||||
[else
|
[else (k)]))
|
||||||
|
|
||||||
(define (update-dependencies)
|
(define (update-dependencies)
|
||||||
(hash-set! update-cache (box pkg-name) #t)
|
(hash-set! update-cache (box pkg-name) #t)
|
||||||
|
@ -1025,11 +1025,13 @@
|
||||||
null))
|
null))
|
||||||
|
|
||||||
(define (skip/update-dependencies kind)
|
(define (skip/update-dependencies kind)
|
||||||
|
(check-missing-dependencies
|
||||||
|
(lambda ()
|
||||||
(unless (or all-mode? (not report-skip?))
|
(unless (or all-mode? (not report-skip?))
|
||||||
(download-printf "Skipping update of ~a: ~a\n"
|
(download-printf "Skipping update of ~a: ~a\n"
|
||||||
kind
|
kind
|
||||||
pkg-name))
|
pkg-name))
|
||||||
(update-dependencies))
|
(update-dependencies))))
|
||||||
|
|
||||||
(match orig-pkg
|
(match orig-pkg
|
||||||
[`(,(or 'link 'static-link) ,orig-pkg-dir)
|
[`(,(or 'link 'static-link) ,orig-pkg-dir)
|
||||||
|
@ -1089,7 +1091,7 @@
|
||||||
(list (pkg-desc orig-pkg-source orig-pkg-type pkg-name #f auto?
|
(list (pkg-desc orig-pkg-source orig-pkg-type pkg-name #f auto?
|
||||||
orig-pkg-dir))))
|
orig-pkg-dir))))
|
||||||
;; Continue with dependencies, maybe
|
;; Continue with dependencies, maybe
|
||||||
(update-dependencies))])]))]
|
(check-missing-dependencies update-dependencies))]))]
|
||||||
[else null])))
|
[else null])))
|
||||||
|
|
||||||
(define (pkg-update in-pkgs
|
(define (pkg-update in-pkgs
|
||||||
|
|
Loading…
Reference in New Issue
Block a user