forked from void-linux/xbps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_xbps
More file actions
321 lines (299 loc) · 12.7 KB
/
_xbps
File metadata and controls
321 lines (299 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#compdef xbps-alternatives xbps-checkvers xbps-create xbps-dgraph xbps-install xbps-pkgdb xbps-query xbps-reconfigure xbps-remove xbps-rindex xbps-uchroot xbps-uunshare xbps-uhelper
_xbps_common=(
{-C,--config=-}'[Full path to configuration file]:config file:_files'
{-d,--debug}'[Debug mode shown to stderr]'
{-h,--help}'[Print help usage]'
{-r,--rootdir=-}'[Full path to rootdir]:root dir:_files -/'
{-v,--verbose}'[Verbose messages]'
{-V,--version}'[Show XBPS version]'
)
_xbps_properties=(
'alternatives[group and file alternatives provided by the package]'
'architecture[target architecture the package was built for]'
'automatic-install[package was installed automatically]'
'build-options[enabled options the package was built with]'
'changelog[changelog URL for the package]'
'conf_files[configuration file(s) installed by the package]'
'conflicts[other packages this package conflicts with]'
'filename-sha256[hash of the package file]'
'filename-size[size of the package file]'
'hold[package is held and will not be updated]'
'homepage[home URL of the package project]'
'install-date[date when the package was installed]'
'install-msg[post-install message provided by the package]'
'install-script[script run when installing the package]'
'installed_size[total size of files installed by the package]'
'license[license(s) for distributing the package]'
'maintainer[contact information of the maintainer of the package]'
'metafile-sha256[hash of the plist package files metadata]'
'pkgname[name of the package]'
'pkgver[version of the package]'
'preserve[package files will not be removed automatically on update]'
'provides[virtual packages provided by the package]'
'remove-msg[post-remove message provided by the package]'
'remove-script[script run when removing the package]'
'replaces[other packages that the package replaces]'
'repolock[package only accepts updates from its original repository]'
'repository[repository where the package was installed from]'
'reverts[previous provided version this package replaces]'
'run_depends[runtime dependency packages for the package]'
'shlib-provides[shared libraries provided by the package]'
'shlib-requires[shared libraries required by the package]'
'short_desc[short description of the package]'
'source-revisions[source package and commit hash of package last change from the void-packages repository]'
'state[installation state of the package]'
'tags[list of categories the package is associated with]'
)
_xbps_all_packages() {
compadd "$@" -- ${${${(f)"$(xbps-query -Rs '')"}#??? }%%-[^- ]# *}
}
_xbps_installed_packages() {
compadd "$@" -- ${${${(f)"$(xbps-query -l)"}#?? }%%-[^- ]# *}
}
_xbps_alternatives_groups() {
compadd "$@" -- ${${${(f)"$(xbps-alternatives -l)"}##? }%%-# *}
}
_xbps_alternatives() {
_arguments -s : \
$_xbps_common \
-R'[Enable repository mode]' \
'*'--repository=-'[Add repository to the top of the list]:repository url:_files -/' \
{-i,--ignore-conf-repos}'[Ignore repositories defined in xbps.d]' \
{-g,--group}'[Group of alternatives to match]:group:_xbps_alternatives_groups' \
- '(mode)' \
{-l,--list}'[List all alternatives]' \
{-s,--set}'[Set alternatives]' \
- '(default)' \
'*:installed packages:_xbps_installed_packages'
}
_xbps_checkvers() {
_arguments -s : \
$_xbps_common \
{-D,--distdir}'[Set the path to void-packages]:path:_files -/' \
{-i,--installed}'[Check for outdated packages in rootdir]' \
{-m,--manual}'[Only process listed files]' \
'*'{-R,--repository=-}'[Add repository to the top of the list]:repository url:_files -/' \
{-i,--ignore-conf-repos}'[Ignore repositories defined in xbps.d]' \
{-s,--show-all}'[List any binary packages which are not built]' \
--staging'[Enable use of staged packages]' \
'*:extra packages:_files'
}
_xbps_create() {
_arguments -s : \
{-A,--architecture}'[Package architecture]:architecture:(i686 i686-musl x86_64 x86_64-musl armv7l armv7l-musl armv6l armv6l-musl aarch64 aarch64-musl ppc64le ppc64le-musl ppc64 ppc64-musl ppc ppc-musl noarch)' \
{-B,--built-with}'[Package builder string]:package builder: ' \
{-C,--conflicts}'[Conflicts]:conflicts: ' \
{-D,--dependencies}'[Dependencies]:dependencies: ' \
{-F,--config-files}'[Configuration files]:configuration files: ' \
{-H,--homepage}'[Homepage]:homepage: ' \
{-h,--help}'[Show help]' \
{-l,--license}'[License]:license: ' \
{-M,--mutable-files}'[Mutable files list]:mutable files: ' \
{-m,--maintainer}'[Maintainer]:maintainer: ' \
{-n,--pkgver}'[Package name/version tuple]:package name/version: ' \
{-P,--provides}'[Provides]:provides: ' \
{-p,--preserve}'[Enable package preserve boolean]' \
{-q,--quiet}'[Work silently]' \
{-R,--replaces}'[Replaces]:replaces: ' \
{-r,--reverts}'[Reverts]:reverts: ' \
{-S,--long-desc}'[Long description]:long description: ' \
{-s,--desc}'[Short description]:short description: ' \
{-t,--tags}'[A list of tags/categories]:tags: ' \
{-V,--version}'[Prints XBPS release version]' \
--build-options'[A string with the used build options]:used build options: ' \
--compression'[Compression format]:compression format:(gzip bzip2 xz)' \
--shlib-provides'[List of provided shared libraries]:provided shared libraries: ' \
--shlib-requires'[List of required shared libraries]:required shared libraries: '
}
_xbps_dgraph() {
_arguments : \
{-C,--config=-}'[Full path to configuration file]:config file:_files' \
{-c,--graph-config}'[Path to configuration file]:config file:_files' \
{-d,--debug}'[Debug mode shown to stderr]' \
{-h,--help}'[Print help usage]' \
{-M,--memory-sync}'[Keep remote repository data in memory only]' \
{-r,--rootdir}'[Full path to rootdir]:root dir:_files -/' \
{-R,--repository}'[Enable repository mode]' \
- '(mode)' \
{-g,--gen-config}'[Generate a default config file]' \
{-f,--fulldeptree}'[Generate a dependency graph]' \
{-m,--metadata}'[Generate a metadata graph]' \
':package:_xbps_all_packages'
}
_xbps_install() {
_arguments -s : \
$_xbps_common \
{-A,--automatic}'[Set automatic installation mode]' \
{-c,--cachedir=-}'[Full path to cachedir]:cache dir:_files -/' \
{-D,--download-only}'[Download packages and check integrity, nothing else]' \
{-f,--force}'[Force package re-installation]' \
{-i,--ignore-conf-repos}'[Ignore repositories defined in xbps.d]' \
{-I,--ignore-file-conflicts}'[Ignore detected file conflicts]' \
{-U,--unpack-only}'[Unpack packages without configuring]' \
{-M,--memory-sync}'[Keep remote repository data in memory only]' \
{-n,--dry-run}'[Dry-run mode]' \
'*'{-R,--repository=-}'[Add repository to the top of the list]:repository url:_files -/' \
{-S,--sync}'[Sync remote repository index]' \
--reproducible'[Enable reproducible mode in pkgdb]' \
--staging'[Enable use of staged packages]' \
{-u,--update}'[Update target packages]' \
{-y,--yes}'[Assume yes to all questions]' \
'*:available packages:_xbps_all_packages'
}
_xbps_pkgdb() {
local ret=1
local -a checks=(files dependencies alternatives pkgdb)
_arguments -C -s : \
$_xbps_common \
{-a,--all}'[Process all packages]' \
--checks='[Choose checks to run]:check:->checks' \
{-m,--mode}'[Change to this mode]:mode:(auto manual hold unhold repolock repounlock)' \
{-u,--update}'[Update pkgdb to the latest format]' \
'*:installed packages:_xbps_installed_packages' && ret=0
case $state in
checks)
_values -s , "check" "${checks[@]}" && ret=0
;;
esac
return $ret
}
_xbps_query() {
local ret=1
_arguments -s : \
$_xbps_common \
{-c,--cachedir=-}'[Full path to cachedir]:cache dir:_files -/' \
{-i,--ignore-conf-repos}'[Ignore repositories defined in xbps.d]' \
{-M,--memory-sync}'[Keep remote repository data in memory only]' \
{-p,--property=-}'[Show properties]:property:->properties' \
--regex'[Use Extended Regular Expressions to match]' \
--fulldeptree'[Full dependency tree for -x/--deps]' \
-R'[Enable repository mode]' \
--staging'[Enable use of staged packages]' \
'*'--repository=-'[Add repository to the top of the list]:repository url:_files -/' \
- '(mode)' \
{-l,--list-pkgs}'[List installed packages]' \
{-L,--list-repos}'[List registered repositories]' \
{-H,--list-hold-pkgs}'[List packages on hold state]' \
{-m,--list-manual-pkgs}'[List packages installed explicitly]' \
{-O,--list-orphans}'[List package orphans]' \
--list-repolock-pkgs'[List packages in repolock mode]' \
{-o,--ownedby}'[Search for package files]:package file:_files' \
{-S,--show}'[Show information]:package:_xbps_all_packages' \
{-s,--search}'[Search for packages]:search string: ' \
--cat=-'[Print file from binpkg to stdout]:file name:_files:package:_xbps_all_packages' \
{-f,--files}'[Show package files]:package:_xbps_all_packages' \
{-x,--deps}'[Show dependencies]:package:_xbps_all_packages' \
{-X,--revdeps}'[Show reverse dependencies]:package:_xbps_all_packages' \
- '(default)' \
':package:_xbps_all_packages' && ret=0
case $state in
properties)
_values -s , "property" "${_xbps_properties[@]}" && ret=0
;;
esac
return $ret
}
_xbps_reconfigure() {
_arguments -s : \
$_xbps_common \
{-a,--all}'[Process all packages]' \
{-f,--force}'[Force reconfiguration]' \
{-x,--deps}'[Also process dependencies for each package]' \
--fulldeptree'[Full dependency tree for -x/--deps]' \
'*'{-i,--ignore}'[Ignore package for reconfigure]:installed packages:_xbps_installed_packages' \
'*:installed packages:_xbps_installed_packages'
}
_xbps_remove() {
_arguments -s : \
$_xbps_common \
{-c,--cachedir=-}'[Full path to cachedir]:cache dir:_files -/' \
{-F,--force-revdeps}'[Force package removal even with revdeps/unresolved shared libraries]' \
{-f,--force}'[Force package files removal]' \
{-O,--clean-cache}'[Remove obsolete packages in cachedir]' \
-OO'[Remove obsolete and uninstalled packages in cachedir]' \
{-o,--remove-orphans}'[Remove package orphans]' \
{-n,--dry-run}'[Dry-run mode]' \
{-R,--recursive}'[Recursively remove dependencies]' \
{-y,--yes}'[Assume yes to all questions]' \
'*:installed packages:_xbps_installed_packages'
}
_xbps_rindex() {
_arguments -s : \
{-d,--debug}'[Debug mode shown to stderr]' \
{-f,--force}'[Force mode to overwrite entry in add mode]' \
{-h,--help}'[Print help usage]' \
{-v,--verbose}'[Verbose messages]' \
{-V,--version}'[Show XBPS version]' \
'--privkey[Path to the private key for signing]:private key path:_files' \
'--signedby[Signature details]:signature details: ' \
- '(mode)' \
{-a,--add}'[Add package to repository index]' \
{-c,--clean}'[Clean repository index]' \
{-r,--remove-obsoletes}'[Removes obsolete packages from repository]' \
{-s,--sign}'[Sign repository index]' \
{-S,--sign-pkg}'[Sign binary package archive]' \
':repository dir:_files -/' \
'*:packages:_files'
}
_xbps_uchroot() {
_arguments \
'-D[distdir]:distdir:_files -/' \
'-H[hostdir]:hostdir:_files -/' \
'-S[shmdir]:shmdir:_files -/' \
':chroot dir:_files -/' \
':command: _command_names -e' \
'*::arguments: _normal'
}
_xbps_uhelper() {
local ret=1
_arguments \
$_xbps_common \
'1:action:->actions' \
'*:: :->args' && ret=0
case $state in
actions)
_values "actions" binpkgarch binpkgver cmpver digest fetch getpkgdepname \
getpkgname getpkgrevision getpkgversion \
pkgmatch version real-version arch getsystemdir getname getversion
ret=0;;
args)
case $words[1] in
binpkgarch) _arguments ':binpkg:' && ret=0;;
binpkgver) _arguments ':binpkg:' && ret=0;;
cmpver) _arguments ':installed version: ' ':required version: ' && ret=0;;
digest) _arguments '*:files:_files' && ret=0;;
fetch) _arguments '*:urls: ' && ret=0;;
getpkgdepname) _arguments '*:string: ' && ret=0;;
getpkgname) _arguments '*:string: ' && ret=0;;
getpkgrevision) _arguments '*:string: ' && ret=0;;
getpkgversion) _arguments '*:string: ' && ret=0;;
getname) _arguments '*:string: ' && ret=0;;
getversion) _arguments '*:string: ' && ret=0;;
pkgmatch) _arguments ':version: ' ':pattern: ' && ret=0;;
real-version) _arguments ':package:_xbps_installed_packages' && ret=0;;
version) _arguments ':package:_xbps_installed_packages' && ret=0;;
arch) ret=0;;
getsystemdir) ret=0;;
esac
;;
esac
return $ret
}
_xbps() {
case "$service" in
xbps-alternatives) _xbps_alternatives "$@";;
xbps-checkvers) _xbps_checkvers "$@";;
xbps-create) _xbps_create "$@";;
xbps-dgraph) _xbps_dgraph "$@";;
xbps-install) _xbps_install "$@";;
xbps-pkgdb) _xbps_pkgdb "$@";;
xbps-query) _xbps_query "$@";;
xbps-reconfigure) _xbps_reconfigure "$@";;
xbps-remove) _xbps_remove "$@";;
xbps-rindex) _xbps_rindex "$@";;
xbps-uchroot) _xbps_uchroot "$@";;
xbps-uunshare) _xbps_uchroot "$@";;
xbps-uhelper) _xbps_uhelper "$@";;
esac
}
_xbps "$@"