]> pd.if.org Git - zpackage/blob - Commands
integrate previous work
[zpackage] / Commands
1 zpm: always a shell script, that way it can source config files and export environment
2 variables for sub-programs
3
4 Good to have a program to check if a package exists.  That is, would
5 zpm install do anything, at least notionally.
6
7 Three basic modes
8
9 1: working on the local database and manipulating packages
10 This is where 'install' 'update' 'remove' etc are done.
11 Additionally, this is where notes, bug reports, repo
12 control, and so forth are done.  Since this is the most
13 common mode, these commands shouldn't need a prefix or
14 something saying we're dealing with the local package DB.
15
16 2: working on a package file.
17 This is where building a new package, adding files, and otherwise
18 dealing with package metadata happens
19
20 3: working on a repository of package files
21
22 Since 2 and 3 are the less common operations, they can have
23 more verbose syntax, also, 2 "expects" a package file, so
24 require an option to force using the local DB, and 3 expects
25 needs repos, perhaps force not using local DB
26 Difference between working on a repository, and manipulating
27 repository info for the local or other DB
28 And 1 expects the local db, so option to specify package file.
29
30 -f for package file?  or -p? and for cat 2, take as argument if
31 not specified?  perhaps an option to construct?  probably
32 not, have a program to construct if needed.
33
34 Need a way to specify a non-default local database location,
35 /var/lib/zpm/local.zpm by default
36
37 For 2: zpm pkg
38 For 3: zpm repo
39
40 Conceivably for 2: 'zpm -f <pkgfile>', since if it's not the
41 local package database, you'll have to specify the package file
42
43 install: will search the repos for the most recent package.
44 of install a from a package file given with -f.
45
46 so zpm install -f 'pkgfile' will install all packages in that file
47 zpm install -f pkgfile package will install just the named package
48 zpm install -f pkfile package package2 will installed both packages
49 zpm install -f pkgfile -V 1.2 will install version 1.2 of all packages
50 that have a version 1.2
51 zpm install -f pkgfile foo-1.2 will install version 1.2 of package foo
52
53 zpm install foo will install the most up to date foo from the
54 repos
55
56 zpm install foo-1.2 install version 1.2.  how to distinguish
57 between versions and package names with hyphens?  Use @?
58
59 Package filters: Version, release, name, min/max version, min/max release
60 Package tags?
61
62 File filters: Get everything, except exclude by tag, which will
63 exclude every file with the tag.  Can reverse sense, and get
64 nothing, except what's in tag. +tag will add a tag to the set,
65 -tag will remove it.  'tag' sets the tag list
66
67
68 Environment Variables
69 ---------------------
70
71 Always set by the zpm wrapper.
72
73 ZPMDB: path to local database
74 ZPMPACKAGE: package name
75 ZPMPKGVER: package version
76 ZPMPKGREL: package release
77 ZPMPKGFILE: package file
78
79 Command Line Options
80 --------------------
81
82 Used by all programs, so can be passed to zpm
83
84 -f package file
85
86 Package Selector
87 ----------------
88
89 -p <package name> -V <package version> -R <package release>
90
91 version and release are always the latest available if not specified for new
92 packages, version defaults to 1.0, release to 1, but may also be taken from the
93 environment
94
95 If there is more than one package name in a database the shortest name is the
96 default, and the earliest alphabetically after that.  This makes it so that if
97 you have 'db' and 'db-dev' in the same package, db will be the default.  Though
98 that's not the way to do it, instead you should tag files within a package, and
99 then filter the install.
100
101 command line over-rides environment, which over-rides defaults
102
103 ZPM Wrapper Script
104 ------------------
105
106 The primary executable is zpm, which is a shell script.  This script
107 sources (if they exist) in order, /etc/zpm.conf ~/.zpmrc
108
109 The script then parses its command line options up until the first non-option,
110 export environment variables, and looks for a command of the form zpm-$1 which
111 it then executes.  If the ZPMPATH is not set, it looks in PATH and if that is
112 not set, in /sbin:/usr/libexec/zpm
113
114         -d <database file>
115         -f <database file> -- they're the same option, just different way of thinking about it
116
117 Low Level Commands
118 ------------------
119
120 Very low level commands to manipulate a database.  These can be used directly,
121 but are primarily intended to be wrapped up in shell scripts.  Each of these
122 should also have an equivalent in the C library API.  The zpm- prefix is omitted below.
123
124 newpackage: add package metadata to a zpm database, creating the target file if
125 needed.
126
127         -N require the target file to not exist (new)
128         -A require the target file to exist (add)
129         -P packager string, should be an email, use ZPMPACKAGER environment
130
131 addtopackage: add a file to a package
132         
133         -C <n> number of leading components to strip
134         -P <path prefix> prefix to strip
135         -H hard coded path, regardless of the source 
136         -T track only, don't import the contents
137         -c flag as configuration file
138         -t <tag list> comma or space separated tags on file
139
140         zpm -f foobar-1.0-1.zpm addtopackage /usr/bin/foo /usr/bin/bar
141         zpm addtopackage foobar-1.1-3.zpm /usr/bin/foo /usr/bin/bar
142         zpm add -f foobar-1.1-3.zpm -p bar /usr/bin/bar
143
144         need to think about the syntax here, but best to just write something,
145         then change it later
146         
147 extract: pull file content to disk
148         $1 is hash or hash prefix if unique, $2 is target path
149
150         As per install(8)
151         -m mode
152         -o owner
153         -g group
154
155         -D don't create leading directories
156
157 list: list package contents
158
159         -F <format> %p path %m mode %o owner %g group %h hash
160         -N don't append a newline to format
161         -0 append a null byte to the format
162
163         default format is '%h %m %o %g %p'
164
165 show: list packages
166         maybe reverse list and show
167
168 drop: delete a package
169
170 delete: remove a file from a package
171
172 adjust: adjust file metadata
173         
174 Higher Level Commands
175 ---------------------
176
177 install: install a package to the local system
178         search repositories known in the local db for a matching package
179 remove: remove a package
180 update: update a package
181
182         -D dry-run, just show what might be done
183
184 export: create a standalone package file from a repo/localdb
185
186 json: dump the metadata of a repo as json
187
188 Repositories
189 ------------
190
191 A repository is just a collection of packages.  All in one DB, or perhaps
192 mark an external file location for package contents.
193
194 Repository Definition is just a url.
195 Has a priority.  Can require trusted signer.  Can require confirmation.
196 Install/Search will ask on tied priorities.  Warn on lower priorities.
197
198 Fetch a repo by getting the json file, or by getting a stripped down DB file.
199
200 repo import: adds repository information from the json file
201 repo drop <url or name>
202 repo add <url> [name]
203 repo refresh: update repository info
204
205 repo command needs to know how to get metadata from local files
206 for http[s] urls, path given should return either json or sqlite db, responsibility
207 of repo to make this work
208
209 Building Packages
210 -----------------
211
212 build: builds a package file
213         -S read paths from stdin
214
215         Reads PKGBUILD in the current directory
216         -b build script path instead of PKGBUILD
217
218 Other Commands
219 --------------
220
221 absorb: pull in the content of a file.  note the mtime if it's a config file, possibly
222 keeping multiple versions
223
224 truncate: drop the content of a file
225
226 status:
227         investigate the status of a repo, reporting things like failed installs or removes,
228         file conflicts, anything else
229
230 integritycheck: compare the stored hashes with the hashes on disk
231
232 note:
233         add a note file, - from stdin, list if none
234
235 edit:
236         edit a note file
237
238 ack:
239         acknowledge a note file
240
241 diff:
242         compare two versions of a package, show what would be done
243         or different
244
245 info:
246         get information on a package
247
248 track:
249         add a package to config tracked packages
250
251 add: add to a repository/database
252
253 clean: clean a repository/database
254