5.93
6.2 Package Management Functions
The
pkg/lib library provides
building blocks on which the
pkg library and
raco pkg
commands are built. It re-exports the bindings of
pkg/path.
Evaluates the
bodys while holding a lock to prevent
concurrent modification to the package database for the current
package scope. Use the
with-pkg-lock/read-only form
for read-only access. The lock is reentrant but not upgradable from
read-only.
Use these form to wrap uses of functions from pkg/lib
that are documented to require the lock. Other functions from
pkg/lib take the lock as needed.
Parameters that determine
package scope for management
operations and, in the case of
'user scope, the relevant
installation name/version.
A parameter whose value is used to report errors that are normally
intended for end uses. The arguments to the procedure are the same
as for
error, except that an initial symbol argument is
omitted.
The default value uses error with 'pkg as the first
argument. The raco pkg command sets this parameter to use
raise-user-error with the sub-command name as its first
argument.
Parameters that determine the download cache location and limits. If
a parameter’s value is #f, then the user’s configuration is
used.
Returns the directory that holds the installation of the installed
(in any scope) package name, or #f if no such package
is installed.
A
pkg-desc value describes a package source plus details of its
intended interpretation, where the
auto? field indicates that
the package is should be treated as installed automatically for a
dependency.
Locates the implementation of the package specified by desc
and downloads and unpacks it to a temporary directory (as needed).
If desc refers to an existing directory and
in-place? is true, then the directory is used in place.
The namespace argument is passed along to
get-info/full when the package’s "info.rkt" is
loaded.
If strip is not #f, then files and directories are
removed from the prepared directory the same as when creating the
corresponding kind of package. A directory that is staged in-place
cannot be stripped.
The result is the package name, the directory containing the unpacked package content,
the checksum (if any) for the unpacked package, whether the
directory should be removed after the package content is no longer
needed, and a list of module paths provided by the package.
If from-command-line? is true, error messages may suggest
specific command-line flags for raco pkg config.
The package lock must be held (allowing writes if set? is true); see
with-pkg-lock.
Unless quiet? is true, information about the output is
reported to the current output port. If from-command-line?
is true, error messages may suggest specific command-line flags for
raco pkg create.
(pkg-install | | descs | | | [ | #:dep-behavior dep-behavior | | | | #:update-deps? update-deps? | | | | #:force? force? | | | | #:ignore-checksums? ignore-checksums? | | | | #:quiet? boolean? | | | | #:from-command-line? from-command-line? | | | | #:strip strip | | | | #:link-dirs? link-dirs?]) | |
|
|
descs : (listof pkg-desc?) |
| dep-behavior | | : | | (or/c #f 'fail 'force 'search-ask 'search-auto) | | | | = | | #f |
|
update-deps? : boolean? = #f |
force? : boolean? = #f |
ignore-checksums? : boolean? = #f |
boolean? : quiet? = #f |
from-command-line? : boolean? = #f |
strip : (or/c #f 'source 'binary) = #f |
link-dirs? : boolean? = #f |
Implements
pkg-install-command. The result indicates which
collections should be setup via
raco setup:
'skip
means that no setup is needed,
#f means all, and a list means
only the indicated collections.
The link-dirs? argument determines whether package sources
inferred to be directory paths should be treated as links or copied
(like other package sources). Note that the default is #f,
unlike the default built into pkg-install-command.
Status information and debugging details are mostly reported to a logger
named 'pkg, but information that is especially relevant to a
user (such as a download action) is reported to the current output
port, unless quiet? is true.
If from-command-line? is true, error messages may suggest
specific command-line flags for raco pkg install.
The package lock must be held; see with-pkg-lock.
(pkg-update | | names | | | [ | #:all? all? | | | | #:dep-behavior dep-behavior | | | | #:update-deps? update-deps? | | | | #:force? force? | | | | #:ignore-checksums? ignore-checksums? | | | | #:quiet? boolean? | | | | #:from-command-line? from-command-line? | | | | #:strip strip | | | | #:link-dirs? link-dirs?]) | |
|
|
names : (listof (or/c string? pkg-desc?)) |
all? : boolean? = #f |
| dep-behavior | | : | | (or/c #f 'fail 'force 'search-ask 'search-auto) | | | | = | | #f |
|
update-deps? : boolean? = #f |
force? : boolean? = #f |
ignore-checksums? : boolean? = #f |
boolean? : quiet? = #f |
from-command-line? : boolean? = #f |
strip : (or/c #f 'source 'binary) = #f |
link-dirs? : boolean? = #f |
A string in names refers to an installed package that should
be checked for updates. A pkg-desc in names indicates
a package source that should replace the current installation.
If from-command-line? is true, error messages may suggest
specific command-line flags for raco pkg update.
The package lock must be held; see with-pkg-lock.
(pkg-remove | | names | | | [ | #:demote? demote? | | | | #:auto? auto? | | | | #:force? force? | | | | #:quiet? boolean? | | | | #:from-command-line? from-command-line?]) | |
|
|
names : (listof string?) |
demote? : boolean? = #f |
auto? : boolean? = #f |
force? : boolean? = #f |
boolean? : quiet? = #f |
from-command-line? : boolean? = #f |
If from-command-line? is true, error messages may suggest
specific command-line flags for raco pkg remove.
The package lock must be held; see with-pkg-lock.
The package lock must be held to allow reads; see
with-pkg-lock/read-only.
(pkg-migrate | | from-version | | | [ | #:dep-behavior dep-behavior | | | | #:force? force? | | | | #:ignore-checksums? ignore-checksums? | | | | #:quiet? boolean? | | | | #:from-command-line? from-command-line? | | | | #:strip strip]) | |
|
|
from-version : string? |
| dep-behavior | | : | | (or/c #f 'fail 'force 'search-ask 'search-auto) | | | | = | | #f |
|
force? : boolean? = #f |
ignore-checksums? : boolean? = #f |
boolean? : quiet? = #f |
from-command-line? : boolean? = #f |
strip : (or/c #f 'source 'binary) = #f |
If from-command-line? is true, error messages may suggest
specific command-line flags for raco pkg migrate.
The package lock must be held; see with-pkg-lock.
The current-pkg-scope-version parameter determines the version
included in the catalog query.
The current-pkg-scope-version parameter determines the version
for extracting existing catalog information.
Consults the user’s configured
package catalogs (like
pkg-catalog-copy) and package servers (if
consult-packages? is true) to populate the database
catalog-file with information about available packages and the
modules that they implement.
Consults catalog-file and returns a list of available packages
that provide the module specified by module-path.
The default catalog-file is (current-pkg-catalog-file)
if that file exists, otherwise a file in the racket installation is
tried.
Consults
package catalogs to obtain a hash table of available
package names mapped to details about the package. Details for
a particular package are provided by a hash table that maps symbols
such as
'source,
'checksum, and
'author.
For some single-collection packages, the package’s single collection
is the package name; if the package name is different from the
directory name, supply name.
Determining a single-collection package’s collection name may require
loading an "info.rkt" file, in which case namespace
is passed on to get-info/full.
Gets information about the content of the package specified by
desc. The information is determined inspecting the
package—
resolving a
package name, downloading, and unpacking
into a temporary directory as necessary.
The results are as follows:
The checksum, if any, for the downloaded package.
A list of module paths that are provided by the package.
Each module path is normalized in the sense of
collapse-module-path.
Information extracted from the package’s metadata. By default,
this information is the package’s dependencies, but in general
it is the result of extract-proc, which receives an
information-getting function (or #f) as returned by
get-info.
Returns packages dependencies reported by the
info procedure
(normally produced by
get-info).
If build-deps? is true, then the result includes both
run-time dependencies and build-time dependencies.
If filter? is true, then platform-specific dependencies are
removed from the result list when they do not apply to the current
platform, and other information is stripped so that the result list is
always a list of strings.
Returns a list of module paths (normalized in the sense of
collapse-module-path) that are provided by the package
represented by
dir and named
pkg-name.