diff --git a/collects/planet2/lib.rkt b/collects/planet2/lib.rkt index 8f88b397a0..856baa612f 100644 --- a/collects/planet2/lib.rkt +++ b/collects/planet2/lib.rkt @@ -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 diff --git a/collects/planet2/main.rkt b/collects/planet2/main.rkt index 286495129f..4123907b34 100644 --- a/collects/planet2/main.rkt +++ b/collects/planet2/main.rkt @@ -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)))] diff --git a/collects/planet2/scribblings/planet2.scrbl b/collects/planet2/scribblings/planet2.scrbl index e20c228f49..f2c867c2c8 100644 --- a/collects/planet2/scribblings/planet2.scrbl +++ b/collects/planet2/scribblings/planet2.scrbl @@ -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.} ] } diff --git a/collects/tests/planet2/tests-update-auto.rkt b/collects/tests/planet2/tests-update-auto.rkt index 62e85ee5af..c5493eff9c 100644 --- a/collects/tests/planet2/tests-update-auto.rkt +++ b/collects/tests/planet2/tests-update-auto.rkt @@ -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" diff --git a/collects/tests/planet2/tests-update.rkt b/collects/tests/planet2/tests-update.rkt index 6179cba459..458541d938 100644 --- a/collects/tests/planet2/tests-update.rkt +++ b/collects/tests/planet2/tests-update.rkt @@ -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