Skip to content

Commit fc54bbb

Browse files
committed
pkg: "module name resolver" and "index" -> "catalog"
This termonology change affects lots of function names from `pkg/lib' and `pkg/db' (former `pkg/pnr-db'), and it also affects some `raco pkg' commands. Existing package installations that are marked as 'pnr in a local configuration are converted automatically to 'catalog, but any existing "indexes" configuration must be changed to "catalogs".
1 parent 5970bbb commit fc54bbb

26 files changed

+529
-524
lines changed

collects/pkg/pnr-db.rkt renamed to collects/pkg/db.rkt

+115-115
Large diffs are not rendered by default.

collects/pkg/lib.rkt

+90-85
Large diffs are not rendered by default.

collects/pkg/main.rkt

+33-31
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
" (default for most packages)"
6363
" force: installs the package despite missing dependencies"
6464
" search-ask: looks for the dependencies on your package naming services"
65-
" (default if package is an indexed name) and asks if you would"
65+
" (default if package is a package name) and asks if you would"
6666
" like it installed"
6767
" search-auto: like 'search-ask' but does not ask for permission to install")]
6868
[#:bool force () "Ignores conflicts"]
@@ -103,7 +103,7 @@
103103
" (default for most packages)"
104104
" force: installs the package despite missing dependencies"
105105
" search-ask: looks for the dependencies on your package naming services"
106-
" (default if package is an indexed name) and asks if you would"
106+
" (default if package is an package name) and asks if you would"
107107
" like it installed"
108108
" search-auto: like 'search-ask' but does not ask for permission to install")]
109109
[#:bool update-deps () "Check named packages' dependencies for updates"]
@@ -121,14 +121,14 @@
121121
'update
122122
scope installation shared user
123123
(lambda ()
124-
(with-pkg-lock
125-
(define setup-collects
126-
(pkg-update pkg
127-
#:all? all
128-
#:dep-behavior deps
129-
#:deps? update-deps))
130-
(when setup-collects
131-
(setup no-setup setup-collects)))))]
124+
(with-pkg-lock
125+
(define setup-collects
126+
(pkg-update pkg
127+
#:all? all
128+
#:dep-behavior deps
129+
#:deps? update-deps))
130+
(when setup-collects
131+
(setup no-setup setup-collects)))))]
132132
[remove
133133
"Remove packages"
134134
#:once-each
@@ -225,36 +225,38 @@
225225
#:args (package-directory)
226226
(parameterize ([current-pkg-error (pkg-error 'create)])
227227
(pkg-create (if manifest 'MANIFEST (or format 'zip)) package-directory))]
228-
[index-show
229-
"Show information about packages as reported by index"
228+
[catalog-show
229+
"Show information about packages as reported by catalog"
230230
#:once-any
231-
[(#:str index #f) index () "Use <index> instead of configured indexes"]
231+
[(#:str catalog #f) catalog () "Use <catalog> instead of configured catalogs"]
232232
#:once-each
233233
[#:bool all () "Show all packages"]
234234
[#:bool only-names () "Show only package names"]
235235
#:args pkg-name
236236
(when (and all (pair? pkg-name))
237-
((pkg-error 'index-show) "both `--all' and package names provided"))
238-
(parameterize ([current-pkg-indexes (and index
239-
(list (string->url index)))]
240-
[current-pkg-error (pkg-error 'index-show)])
241-
(pkg-index-show pkg-name
242-
#:all? all
243-
#:only-names? only-names))]
244-
[index-copy
245-
"Copy/merge package name resolver information"
237+
((pkg-error 'catalog-show) "both `--all' and package names provided"))
238+
(parameterize ([current-pkg-catalogs (and catalog
239+
(list (string->url catalog)))]
240+
[current-pkg-error (pkg-error 'catalog-show)])
241+
(pkg-catalog-show pkg-name
242+
#:all? all
243+
#:only-names? only-names))]
244+
[catalog-copy
245+
"Copy/merge package name catalogs"
246246
#:once-each
247-
[#:bool from-config () "Include currently configured packages last"]
247+
[#:bool from-config () "Include currently configured catalogs last"]
248248
#:once-any
249249
[#:bool force () "Force replacement fo existing file/directory"]
250250
[#:bool merge () "Merge to existing database"]
251251
#:once-each
252252
[#:bool override () "While merging, override existing with new"]
253-
#:args index
254-
(parameterize ([current-pkg-error (pkg-error 'index-copy)])
255-
(pkg-index-copy (drop-right index 1)
256-
(last index)
257-
#:from-config? from-config
258-
#:force? force
259-
#:merge? merge
260-
#:override? override))])
253+
#:args catalog
254+
(parameterize ([current-pkg-error (pkg-error 'catalog-copy)])
255+
(when (null? catalog)
256+
((current-pkg-error) "need a destination catalog"))
257+
(pkg-catalog-copy (drop-right catalog 1)
258+
(last catalog)
259+
#:from-config? from-config
260+
#:force? force
261+
#:merge? merge
262+
#:override? override))])

collects/pkg/scribblings/apis.scrbl

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ building blocks and local-database support.
1414
@local-table-of-contents[]
1515

1616
@include-section["lib.scrbl"]
17-
@include-section["pnr-db.scrbl"]
17+
@include-section["db.scrbl"]

collects/pkg/scribblings/pnr-protocol.scrbl renamed to collects/pkg/scribblings/catalog-protocol.scrbl

+27-27
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
@(require scribble/bnf
33
"common.rkt")
44

5-
@title[#:tag "pnr-protocol"]{Package Name Resolver Protocol}
5+
@title[#:tag "catalog-protocol"]{Package Catalog Protocol}
66

7-
A @tech{package name resolver} is specified by a URL in one of three
7+
A @tech{package catalog} is specified by a URL in one of three
88
forms:
99

1010
@itemlist[
@@ -19,10 +19,10 @@ forms:
1919

2020
]
2121

22-
@section{Remote and Directory Indexes}
22+
@section{Remote and Directory Catalogs}
2323

24-
In the case of a remote URL or a local directory naming an
25-
@tech{index}, the URL/path is extended as follows to obtain
24+
In the case of a remote URL or a local directory naming a
25+
@tech{package catalog}, the URL/path is extended as follows to obtain
2626
information about packages:
2727

2828
@itemlist[
@@ -64,14 +64,14 @@ information about packages:
6464
]}
6565

6666
@item{@litchar{pkgs} path element: Obtains a list of package names
67-
that are mapped by the @tech{index}. An HTTP request for a remote URL
67+
that are mapped by the @tech{package catalog}. An HTTP request for a remote URL
6868
should respond with a @racket[read]-able list of strings. A
6969
path in a local directory formed by adding @filepath{pkg} and
7070
@nonterm{package} should refer to a file that similarly
7171
contains a @racket[read]-able list of strings.
7272

73-
This URL/path form is used by @command-ref{index-copy} and
74-
tools that allow a user to browse an index.
73+
This URL/path form is used by @command-ref{catalog-copy} and
74+
tools that allow a user to browse an catalog.
7575

7676
In the case of a local directory, if no @filepath{pkgs} file is
7777
available, a list is created by listing all files in the
@@ -98,67 +98,67 @@ Note that a local directory served as files through an HTTP server
9898
works as a remote URL, as long as the @filepath{pkgs} and
9999
@filepath{pkgs-all} files are present.
100100

101-
The source for the PLT-hosted @tech{package name resolvers} is in the
102-
@racket[(collection-file-path "pkg-index" "meta")]
101+
The source for the PLT-hosted @tech{package catalog} is in the
102+
@racket[(collection-file-path "pkg-catalog" "meta")]
103103
directory of the full Racket distribution.
104104

105105
@; ----------------------------------------
106106

107-
@section{SQLite Indexes}
107+
@section{SQLite Catalogs}
108108

109-
A SQLite database @tech{index} is meant to be constructed and queries
110-
using the @racketmodname[pkg/pnr-db] library, but the database can be
109+
A SQLite database @tech{package catalog} is meant to be constructed and queries
110+
using the @racketmodname[pkg/db] library, but the database can be
111111
constructed in any way as long as it contains the following tables:
112112

113113
@itemlist[
114114

115-
@item{A @tt{pnr} table with the format
115+
@item{A @tt{catalog} table with the format
116116

117117
@verbatim[#:indent 2]{(id SMALLINT,
118118
url TEXT,
119119
pos SMALLINT)}.
120120

121121
Normally, the only row in this table is @tt{(0, "local", 0)},
122122
but a database that records the content of a set of other
123-
indexes can also be used as an index, in which case each row
124-
represents an index; the @tt{id} field is a unique identifier
125-
for each index, the @tt{url} field is the index's URL, and the
126-
@tt{pos} column orders the index relative to others (where a
123+
catalogs can also be used as an catalog, in which case each row
124+
represents an catalog; the @tt{id} field is a unique identifier
125+
for each catalog, the @tt{url} field is the catalog's URL, and the
126+
@tt{pos} column orders the catalog relative to others (where a
127127
lower @tt{pos} takes precedence).}
128128

129129
@item{A @tt{pkg} table with the format
130130

131131
@verbatim[#:indent 2]{(name TEXT,
132-
pnr SMALLINT,
132+
catalog SMALLINT,
133133
author TEXT,
134134
source TEXT,
135135
checksum TEXT,
136136
desc TEXT)}
137137

138-
The @tt{pnr} field is normally @tt{0}; in the case that the
139-
database reflects multiple other indexes, the @tt{pnr} field
140-
indicates the package entry's source index.
138+
The @tt{catalog} field is normally @tt{0}; in the case that the
139+
database reflects multiple other catalogs, the @tt{catalog} field
140+
indicates the package entry's source catalog.
141141

142-
The @tt{pkg} and @tt{pnr} fields together determine a unique
142+
The @tt{pkg} and @tt{catalog} fields together determine a unique
143143
row in the table.}
144144

145145
@item{A @tt{tags} table with the form
146146

147147
@verbatim[#:indent 2]{(pkg TEXT,
148-
pnr TEXT,
148+
catalog TEXT,
149149
tag TEXT)}
150150

151-
where the @tt{pkg} and @tt{pnr} combination identifies a unique
151+
where the @tt{pkg} and @tt{catalog} combination identifies a unique
152152
row in @tt{pkg}.}
153153

154154
@item{A @tt{modules} table with the form
155155

156156
@verbatim[#:indent 2]{(name TEXT,
157157
pkg TEXT,
158-
pnr SMALLINT,
158+
catalog SMALLINT,
159159
checksum TEXT)}
160160

161-
where the @tt{pkg} and @tt{pnr} combination identifies a unique
161+
where the @tt{pkg} and @tt{catalog} combination identifies a unique
162162
row in @tt{pkg}, and @racket[name] is a printed module path.
163163

164164
This table is not currently used by any @exec{raco pkg}

0 commit comments

Comments
 (0)