raco pkg migrate: don't promote auto-installed

Upgrading an auto install to an explicit install runs into trouble if
the auto install is in a wider scope. It doens't seem necessary to
promote already-installed packages for migration, anyway.
This commit is contained in:
Matthew Flatt 2019-02-01 09:42:55 -07:00
parent afd8c8fcac
commit 1b11111da3
3 changed files with 11 additions and 2 deletions

View File

@ -32,4 +32,11 @@
$ "raco pkg migrate --dry-run -u other"
$ "raco pkg show -l -u -a" =stdout> " [none]\n"
$ "raco pkg migrate -u other"
$ "raco pkg show -l -u -a" =stdout> #rx"Package\\[\\*=auto\\] +Checksum +Source\npkg-a\\* +[a-f0-9.]+ \\(catalog \"pkg-a\"\\)\npkg-b +[a-f0-9.]+ +\\(catalog \"pkg-b\"\\)\n")))
$ "raco pkg show -l -u -a" =stdout> #rx"Package\\[\\*=auto\\] +Checksum +Source\npkg-a\\* +[a-f0-9.]+ \\(catalog \"pkg-a\"\\)\npkg-b +[a-f0-9.]+ +\\(catalog \"pkg-b\"\\)\n"
;; Don't promote auto-installed. Our real interest is not having to promote auto-installed
;; in a wider scope, but we can partly test that by checking non-promote in user-scope.
$ "raco pkg remove -u --demote pkg-b"
$ "raco pkg show -l -u -a" =stdout> #rx"Package\\[\\*=auto\\] +Checksum +Source\npkg-a\\* +[a-f0-9.]+ \\(catalog \"pkg-a\"\\)\npkg-b\\* +[a-f0-9.]+ +\\(catalog \"pkg-b\"\\)\n"
$ "raco pkg migrate -u other"
$ "raco pkg show -l -u -a" =stdout> #rx"Package\\[\\*=auto\\] +Checksum +Source\npkg-a\\* +[a-f0-9.]+ \\(catalog \"pkg-a\"\\)\npkg-b\\* +[a-f0-9.]+ +\\(catalog \"pkg-b\"\\)\n")))

View File

@ -855,6 +855,7 @@
#:strict-doc-conflicts? [strict-doc-conflicts? #f]
#:use-cache? [use-cache? #t]
#:skip-installed? [skip-installed? #f]
#:skip-auto-installed? [skip-auto-installed? #f]
#:pre-succeed [pre-succeed void]
#:dep-behavior [dep-behavior #f]
#:update-deps? [update-deps? #f]
@ -897,7 +898,7 @@
(filter (lambda (d)
(define pkg-name (desc->name d))
(define i (hash-ref all-scope-dbs pkg-name #f))
(or (not i) (pkg-info-auto? i)))
(or (not i) (and (not skip-auto-installed?) (pkg-info-auto? i))))
descs))
pkg-desc=?))

View File

@ -79,6 +79,7 @@
#:strict-doc-conflicts? strict-doc-conflicts?
#:use-cache? use-cache?
#:skip-installed? #t
#:skip-auto-installed? #t
#:dep-behavior (or dep-behavior 'search-auto)
#:quiet? quiet?
#:from-command-line? from-command-line?