7.6 Package Directories Catalog

► |  | Package Management in Racket

1 | Getting Started with Packages
2 | Package Concepts
3 | Using raco pkg
4 | Package Metadata
5 | Source, Binary, and Built Packages
6 | Developing Packages with Git
7 | Package APIs
8 | Package Catalog Protocol
9 | PLane T Compatibility
10 | FAQ
11 | Future Plans
12 | How Package Installation and Distribution Works

▼ | 7 | Package APIs

7.1 | Functions for raco pkg
7.2 | Package Management Functions
7.3 | Package Paths and Database
7.4 | Package Source Parsing
7.5 | Package Catalog Database
7.6 | Package Directories Catalog
7.7 | Package Management Environment Variables

On this page:

create-dirs-catalog

9.3
Racket
top contents ← prev up next →

### 7.6 Package Directories Catalog🔗ℹ

(require pkg/dirs-catalog) | package: base

The pkg/dirs-catalog module provides create-dirs-catalog, which generates a package catalog (as a directory) that refers to a set of packages that are found in a given set of directories. Packages are discovered in the given directory as subdirectories that have an "info.rkt" file.

For example, the main Racket development repository includes a "pkgs" directory that holds packages such as base, and create-dirs-catalog constructs a catalog to be used to install those packages.

When run directly as a program, pkg/dirs-catalog expects a destination catalog followed by any number paths for directories that hold packages:

racket -l- pkg/dirs-catalog ‹dest-catalog› ‹dir› ...

The --immediate, --link, --merge, --check-metadata, and --quiet flags correspond to optional keyword arguments of create-dirs-catalog.

Added in version 6.1.1.6 of package base.
Changed in version 6.90.0.4: Added --immediate.

> > procedure
> > (create-dirs-catalog |  | catalog-path |  |  |  |
> > |  | dirs |  |  |  |
> > | [ | #:immediate? immediate? |  |  |  |
> > |  | #:link? link? |  |  |  |
> > |  | #:merge? merge? |  |  |  |
> > |  | #:check-metadata? check-metadata? |  |  |  |
> > |  | #:status-printf status-printf]) |  | → |  | void?
> catalog-path : path-string?
> dirs : (listof path-string?)
> immediate? : any/c = #f
> link? : any/c = #f
> merge? : any/c = #f
> check-metadata? : any/c = #f
> status-printf : (string? any/c ... -> void?) = void

Creates or modifies catalog-path as a directory that works as a catalog (see Package Catalog Protocol) to list the packages that are contained in each directory specified by dirs. Packages are discovered in dirs as subdirectories that have an "info.rkt" file; if immediate? is true, then each directory in dirs is checked for an immediate "info.rkt" file before checking subdirectories.

If an "info.rkt" has a dirs-catalog definition, then it can adjust a directory traversal: an 'ignore value causes the directory to be skipped, and a 'subdirs value continues looking for packages as subdirectories while not treating the immediate directory as a package.

If link? is true, then the catalog specifies that the package should be installed as a directory link, as opposed to copies.

If merge? is true, then existing catalog entries in catalog-path are preserved, otherwise old catalog entries are removed.

To create author and description information for each package in the catalog, create-dirs-catalog looks for a pkg-authors and pkg-desc definition in each package’s "info.rkt" file. If either definition is missing and check-metadata? is true, an error is reported.

If a package’s "info.rkt" file defines pkg-name, then the defined name is used as the package’s name instead of the package directory’s name.

Changed in version 6.90.0.4 of package base: Added the #:immediate argument.
Changed in version 7.3.0.2: Added support for pkg-name to name a package.
Changed in version 9.2.0.3: Added support for dirs-catalog in "info.rkt".

top contents ← prev up next →