raco pkg catalog-{show,copy}: add `--version' flag

This commit is contained in:
Matthew Flatt 2013-08-15 08:58:54 -06:00
parent 6235da4e58
commit fb62686d8a
4 changed files with 28 additions and 12 deletions

View File

@ -269,7 +269,10 @@ The package lock must be held; see @racket[with-pkg-lock].}
void?]{ void?]{
Implements @racket[pkg-catalog-show-command]. If @racket[all?] is true, Implements @racket[pkg-catalog-show-command]. If @racket[all?] is true,
then @racket[names] should be empty.} then @racket[names] should be empty.
The @racket[current-pkg-scope-version] parameter determines the version
included in the catalog query.}
@defproc[(pkg-catalog-copy [sources (listof path-string?)] @defproc[(pkg-catalog-copy [sources (listof path-string?)]
@ -280,7 +283,10 @@ then @racket[names] should be empty.}
[#:override? override? boolean? #f]) [#:override? override? boolean? #f])
void?]{ void?]{
Implements @racket[pkg-catalog-copy-command].} Implements @racket[pkg-catalog-copy-command].
The @racket[current-pkg-scope-version] parameter determines the version
for extracting existing catalog information.}
@defproc[(pkg-catalog-update-local [#:catalog-file catalog-file path-string? (current-pkg-catalog-file)] @defproc[(pkg-catalog-update-local [#:catalog-file catalog-file path-string? (current-pkg-catalog-file)]

View File

@ -530,6 +530,8 @@ View and modify configuration of the package manager itself, with the following
@item{@DFlag{modules} --- Show the modules that are implemented by a package.} @item{@DFlag{modules} --- Show the modules that are implemented by a package.}
@item{@DFlag{catalog} @nonterm{catalog} --- Query @nonterm{catalog} instead of the currently configured @item{@DFlag{catalog} @nonterm{catalog} --- Query @nonterm{catalog} instead of the currently configured
@tech{package catalogs}.} @tech{package catalogs}.}
@item{@DFlag{version} @nonterm{version} --- Query catalogs for a result specific to @nonterm{version},
instead of the installation's Racket version.}
] ]
} }
@ -557,6 +559,8 @@ View and modify configuration of the package manager itself, with the following
over new information.} over new information.}
@item{@DFlag{override} --- Changes merging so that new information takes precedence @item{@DFlag{override} --- Changes merging so that new information takes precedence
over information already in @nonterm{dest-catalog}.} over information already in @nonterm{dest-catalog}.}
@item{@DFlag{version} @nonterm{version} --- Copy catalog results specific to @nonterm{version}
(for catalogs that make a distinction), instead of the installation's Racket version.}
] ]
} }
@; ---------------------------------------- @; ----------------------------------------

View File

@ -335,7 +335,7 @@
[query (append [query (append
(url-query addr/no-query) (url-query addr/no-query)
(list (list
(cons 'version (version))))])) (cons 'version (current-pkg-scope-version))))]))
(define (package-catalog-lookup pkg details? download-printf) (define (package-catalog-lookup pkg details? download-printf)
(or (or

View File

@ -322,7 +322,7 @@
#:strip (or (and source 'source) (and binary 'binary)))))) #:strip (or (and source 'source) (and binary 'binary))))))
(setup no-setup setup-collects jobs)))] (setup no-setup setup-collects jobs)))]
[create [create
"Bundle a package from a directory or installed package" "Bundle package from a directory or installed package"
#:once-any #:once-any
[#:bool from-dir () "Treat <directory-or-package> as a directory (the default)"] [#:bool from-dir () "Treat <directory-or-package> as a directory (the default)"]
[#:bool from-install () "Treat <directory-or-package> as a package name"] [#:bool from-install () "Treat <directory-or-package> as a package name"]
@ -374,19 +374,22 @@
(with-pkg-lock/read-only (with-pkg-lock/read-only
(pkg-config #f key/val)))))] (pkg-config #f key/val)))))]
[catalog-show [catalog-show
"Show information about packages as reported by catalog" "Show package information as reported by a catalog"
#:once-any #:once-any
[(#:str catalog #f) catalog () "Use <catalog> instead of configured catalogs"] [(#:str catalog #f) catalog () "Use <catalog> instead of configured catalogs"]
#:once-each #:once-each
[#:bool all () "Show all packages"] [#:bool all () "Show all packages"]
[#:bool only-names () "Show only package names"] [#:bool only-names () "Show only package names"]
[#:bool modules () "Show implemented modules"] [#:bool modules () "Show implemented modules"]
[(#:str vers #f) version ("-v") "Show result for Racket <vers>"]
#:args pkg-name #:args pkg-name
(when (and all (pair? pkg-name)) (when (and all (pair? pkg-name))
((pkg-error 'catalog-show) "both `--all' and package names provided")) ((pkg-error 'catalog-show) "both `--all' and package names provided"))
(parameterize ([current-pkg-catalogs (and catalog (parameterize ([current-pkg-catalogs (and catalog
(list (catalog->url catalog)))] (list (catalog->url catalog)))]
[current-pkg-error (pkg-error 'catalog-show)]) [current-pkg-error (pkg-error 'catalog-show)]
[current-pkg-scope-version (or version
(current-pkg-scope-version))])
(pkg-catalog-show pkg-name (pkg-catalog-show pkg-name
#:all? all #:all? all
#:only-names? only-names #:only-names? only-names
@ -400,13 +403,16 @@
[#:bool merge () "Merge to existing database"] [#:bool merge () "Merge to existing database"]
#:once-each #:once-each
[#:bool override () "While merging, override existing with new"] [#:bool override () "While merging, override existing with new"]
[(#:str vers #f) version ("-v") "Copy information suitable for Racket <vers>"]
#:args catalog #:args catalog
(parameterize ([current-pkg-error (pkg-error 'catalog-copy)]) (parameterize ([current-pkg-error (pkg-error 'catalog-copy)])
(when (null? catalog) (when (null? catalog)
((current-pkg-error) "need a destination catalog")) ((current-pkg-error) "need a destination catalog"))
(pkg-catalog-copy (drop-right catalog 1) (parameterize ([current-pkg-scope-version (or version
(last catalog) (current-pkg-scope-version))])
#:from-config? from-config (pkg-catalog-copy (drop-right catalog 1)
#:force? force (last catalog)
#:merge? merge #:from-config? from-config
#:override? override))]) #:force? force
#:merge? merge
#:override? override)))])