From bc55560f8dcef2780c2b64a95c2fc89513e3f447 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 25 Apr 2018 09:45:53 -0600 Subject: [PATCH] raco pkg update: add `---unclone` as a kind of alias for `--lookup` It's difficult to remember that the opposite of `--clone` is effectively `--lookup`. --- pkgs/racket-doc/pkg/scribblings/pkg.scrbl | 6 +++++- pkgs/racket-test/tests/pkg/tests-clone.rkt | 4 +++- racket/collects/pkg/main.rkt | 25 +++++++++++++++------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/pkgs/racket-doc/pkg/scribblings/pkg.scrbl b/pkgs/racket-doc/pkg/scribblings/pkg.scrbl index b3ec96cab2..eb9ada0875 100644 --- a/pkgs/racket-doc/pkg/scribblings/pkg.scrbl +++ b/pkgs/racket-doc/pkg/scribblings/pkg.scrbl @@ -707,6 +707,9 @@ the given @nonterm{pkg-source}s. To convert a clone-linked package to a normal installation, use @command-ref{update} either with the @DFlag{lookup} flag or with a replacement @tech{package source} that is not a package name.} +@item{@DFlag{unclone} --- An alias for @DFlag{lookup}, which (absent + @DFlag{clone}) has the effect of replacing a link to a repository + clone with a normal package installation.} @item{@DFlag{binary} --- Same as for @command-ref{install}.} @item{@DFlag{source} --- Same as for @command-ref{install}.} @item{@DFlag{scope} @nonterm{scope} --- Selects a @tech{package scope}, the same as for @command-ref{install}.} @@ -742,7 +745,8 @@ the given @nonterm{pkg-source}s. #:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag, and changed the @DFlag{deps} default to depend only on interactive mode.} #:changed "6.1.1.8" @elem{Added the @DFlag{skip-uninstalled} and @DFlag{pull} flags.} - #:changed "6.4.0.14" @elem{Added the @DFlag{dry-run} flag.}]} + #:changed "6.4.0.14" @elem{Added the @DFlag{dry-run} flag.} + #:changed "6.90.0.27" @elem{Added the @DFlag{unclone} flag.}]} @subcommand{@command/toc{remove} @nonterm{option} ... @nonterm{pkg} ... --- Attempts to remove the given packages. By default, if a package is the dependency diff --git a/pkgs/racket-test/tests/pkg/tests-clone.rkt b/pkgs/racket-test/tests/pkg/tests-clone.rkt index 0d63d22afa..53d25ef671 100644 --- a/pkgs/racket-test/tests/pkg/tests-clone.rkt +++ b/pkgs/racket-test/tests/pkg/tests-clone.rkt @@ -457,7 +457,9 @@ (when (eq? mode 'convert) (shelly-case "Converting back to non-clone" - $ "raco pkg update --multi-clone convert --lookup one" + $ (~a "raco pkg update --multi-clone convert " + (if three? "--unclone" "--lookup") ; try either alias, arbitrarily tied to `three?` + " one") $ "racket -l two" =stdout> "2\n" (when three? (shelly-begin diff --git a/racket/collects/pkg/main.rkt b/racket/collects/pkg/main.rkt index 3ee8c1d18c..965f9a46d8 100644 --- a/racket/collects/pkg/main.rkt +++ b/racket/collects/pkg/main.rkt @@ -150,7 +150,9 @@ #:install-force-flags (install-force-flags ...) #:install-clone-flags (install-clone-flags ...) #:update-deps-flags (update-deps-flags ...) - #:install-copy-flags (install-copy-flags ...) + #:install-copy-flags/pre-clone (install-copy-flags/pre-clone ...) + #:install-copy-flags/unclone (install-copy-flags/unclone ...) + #:install-copy-flags/post-clone (install-copy-flags/post-clone ...) #:install-copy-defns (install-copy-defns ...) #:install-copy-checks (install-copy-checks ...)) (replace-context @@ -173,7 +175,8 @@ #:once-each update-deps-flags ... #:once-any - install-copy-flags ... + install-copy-flags/pre-clone ... + install-copy-flags/post-clone ... #:once-any scope-flags ... #:once-each @@ -269,7 +272,9 @@ #:once-each update-deps-flags ... #:once-any - install-copy-flags ... + install-copy-flags/pre-clone ... + install-copy-flags/unclone ... + install-copy-flags/post-clone ... #:once-any scope-flags ... #:once-each @@ -306,13 +311,14 @@ install-copy-checks ... (define clone-path (and (eq? a-type 'clone) (path->complete-path clone))) + (define lookup? (or lookup unclone)) (define setup-collects (with-pkg-lock (parameterize ([current-pkg-catalogs (and catalog (list (catalog->url catalog)))]) (pkg-update (for/list ([pkg-source (in-list pkg-source)]) (cond - [lookup + [lookup? (pkg-desc pkg-source a-type name checksum #f #:path clone-path)] [else @@ -341,7 +347,7 @@ (and binary 'binary) (and binary-lib 'binary-lib)) #:force-strip? force - #:lookup-for-clone? lookup + #:lookup-for-clone? lookup? #:multi-clone-behavior (or multi-clone (if batch 'fail @@ -710,12 +716,15 @@ #:update-deps-flags ([#:bool update-deps () "For `search-ask' or `search-auto', also update dependencies"] [#:bool ignore-implies () "When updating, treat `implies' like other dependencies"]) - #:install-copy-flags + #:install-copy-flags/pre-clone ([#:bool link () ("Link a directory package source in place (default for a directory)")] [#:bool static-link () ("Link in place, promising collections do not change")] [#:bool copy () ("Treat directory sources the same as other sources")] - [(#:str dir #f) clone () ("Clone Git and GitHub package sources to and link")] - [#:bool source () ("Strip packages' built elements before installing; implies --copy")] + [(#:str dir #f) clone () ("Clone Git and GitHub package sources to and link")]) + #:install-copy-flags/unclone + ([#:bool unclone () ("Unclones when currently a clone; alias for --lookup")]) + #:install-copy-flags/post-clone + ([#:bool source () ("Strip packages' built elements before installing; implies --copy")] [#:bool binary () ("Strip packages' source elements before installing; implies --copy")] [#:bool binary-lib () ("Strip source & documentation before installing; implies --copy")]) #:install-copy-defns