Requiring -a on 'raco pkg update' to update all packages

This commit is contained in:
Jay McCarthy 2012-11-12 06:46:21 -07:00
parent fbed04db70
commit a2b1d4186b
5 changed files with 11 additions and 6 deletions

View File

@ -667,11 +667,12 @@
(dict-ref meta 'dependency empty))
(define (update-packages in-pkgs
#:all? [all? #f]
#:dep-behavior [dep-behavior #f]
#:deps? [deps? #f])
(define pkgs
(cond
[(empty? in-pkgs)
[(and all? (empty? in-pkgs))
(filter update-is-possible? (hash-keys (read-pkg-db)))]
[deps?
(append-map
@ -791,6 +792,7 @@
[update-packages
(->* ((listof string?))
(#:dep-behavior dep-behavior/c
#:all? boolean?
#:deps? boolean?)
void)]
[remove-packages

View File

@ -38,6 +38,7 @@
"Update packages"
[#:bool dont-setup () "Don't run 'raco setup' after changing packages (generally not a good idea)"]
[#:bool installation ("-i") "Operate on the installation-wide package database"]
[#:bool all ("-a") "Update all packages (if no packages are given on the command line)"]
[(#:sym #f) deps ()
("Specify the behavior for dependencies."
"Options are: fail, force, search-ask, search-auto."
@ -50,6 +51,7 @@
(parameterize ([current-install-system-wide? installation])
(with-package-lock
(update-packages pkgs
#:all? all
#:dep-behavior deps
#:deps? update-deps)
(setup dont-setup)))]

View File

@ -157,8 +157,7 @@ sub-sub-commands:
@item{@exec{update pkg ...} -- Checks the list of packages for
@tech{package updates}. If no packages are given, checks every
installed package. If an update is found, but it cannot be
@tech{package updates}. If an update is found, but it cannot be
installed (e.g. it is conflicted with another installed package), then
this command fails atomically. It accepts the following options:
@ -167,6 +166,8 @@ this command fails atomically. It accepts the following options:
@item{@DFlag{installation} -- Same as for @exec{install}.}
@item{@Flag{i} -- Same as for @exec{install}.}
@item{@DFlag{deps} @exec{dep-behavior} -- Same as for @exec{install}.}
@item{@DFlag{all} -- Update all packages, if no packages are given in the argument list.}
@item{@Flag{a} -- Alias for @DFlag{all}.}
@item{@DFlag{update-deps} -- Checks the named packages, and their dependencies (transitively) for updates.}
]
}

View File

@ -60,7 +60,7 @@
(file->string "test-pkgs/pkg-a-second.plt.CHECKSUM")
'source
"http://localhost:9999/pkg-a-second.plt"))
$ "raco pkg update" =exit> 0
$ "raco pkg update -a" =exit> 0
$ "racket -e '(require pkg-a)'" =exit> 43
$ "raco pkg remove pkg-b"
$ "raco pkg show" =stdout> #rx"Package\\(auto\\?\\) Checksum Source\npkg-a\\* [a-f0-9]+ \\(pns pkg-a\\)\n"

View File

@ -69,11 +69,11 @@
"http://localhost:9999/update-test/planet2-test1.zip"
"planet2-test1"
$ "raco pkg install test-pkgs/planet2-test2.zip"
$ "raco pkg update" =exit> 0 =stdout> "No updates available\n"
$ "raco pkg update -a" =exit> 0 =stdout> "No updates available\n"
$ "racket -e '(require planet2-test1/update)'" =exit> 42
$ "cp -f test-pkgs/planet2-test1-v2.zip test-pkgs/update-test/planet2-test1.zip"
$ "cp -f test-pkgs/planet2-test1-v2.zip.CHECKSUM test-pkgs/update-test/planet2-test1.zip.CHECKSUM"
$ "raco pkg update" =exit> 0
$ "raco pkg update -a" =exit> 0
$ "racket -e '(require planet2-test1/update)'" =exit> 43
$ "raco pkg remove planet2-test2")
(finally