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?]{
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?)]
@ -280,7 +283,10 @@ then @racket[names] should be empty.}
[#:override? override? boolean? #f])
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)]

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{catalog} @nonterm{catalog} --- Query @nonterm{catalog} instead of the currently configured
@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.}
@item{@DFlag{override} --- Changes merging so that new information takes precedence
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
(url-query addr/no-query)
(list
(cons 'version (version))))]))
(cons 'version (current-pkg-scope-version))))]))
(define (package-catalog-lookup pkg details? download-printf)
(or

View File

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