Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: update rpm completion
- X-seq: zsh-workers 44788
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: update rpm completion
- Date: Sat, 28 Sep 2019 01:11:37 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1569625902; bh=NhW0vUPrkLCCblhlSGRvl9mXxWuPTA+tJHx8J6yz+SQ=; h=From:To:Subject:Date:From:Subject; b=FEF5qUZBCoWFkWctcE2twMnTon0ilzWJp6ItfwAwe+kXbAOyBhUD748EamuAbHNlVo5fLLGLAL1KTZneJ4eU8ZaEnV4e/jIa4nm0pDb++RVUV54RcuCK7/1WcxJgDmn8jVcIPNfpOKVwOn8wOCH14nviVZlQsNvx8oqzhqkrebd5kuxCsUbdc9dhYpFWbVqLo5FzFJuEsfT32mmtu3P9XlZZtLL9kGbzG6T538NnGq3CJH24erLic28FjPwbBISePPAmHV+REEzFU5yQNSWrCH47OUBv9wyNWDCbmNm8jL5xTqgGAgbzN1DKF9hybzPWLjaT3/sdPPx8j7+cuCBE6A==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This brings the rpm completion up to 4.15.0-rc1. It also now handles the
newer variant commands like rpmkeys, rpmsign, rpmbuild etc. rpm used to
include the functionality of all of them and to a limited extent still
does so it makes sense to keep everything in one function to avoid
duplication. We had a separate _rpmbuild which this patch removes.
Oliver
diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm
index a9306aa6c..e3469245f 100644
--- a/Completion/Redhat/Command/_rpm
+++ b/Completion/Redhat/Command/_rpm
@@ -1,4 +1,4 @@
-#compdef rpm
+#compdef rpm rpmbuild rpmkeys rpmsign rpmspec rpmquery rpmverify
# This uses `_arguments' in a state-machine kind of way. These states
# have names and before executing the default action for such a state
@@ -8,6 +8,8 @@
# these functions.
# The states (and possible values for the `<state>' above) are:
#
+# common
+# complete for basic options like --querytags and --showrc
# query
# complete for `rpm -q' query
# verify
@@ -19,19 +21,17 @@
# uninstall
# complete for `rpm -e' or `rpm --erase'
# build_b
-# complete for `rpm -bx' (the stage `x' is already completed)
+# complete for `rpmbuild -bx' (the stage `x' is already completed)
+# build_r
+# complete for `rpmbuild -rx' (the stage `x' is already completed)
# build_t
-# complete for `rpm -tx' (the stage `x' is already completed)
-# sigcheck
-# complete for `rpm --sigcheck'
-# rebuild
-# complete for `rpm --rebuild'
+# complete for `rpmbuild -tx' (the stage `x' is already completed)
+# checksig
+# complete for `rpm --checksig'
# package
# complete a RPM package name
# package_file
# complete a RPM package file name
-# package_or_file
-# the previous two together
# file_or_package
# an absolute path to any file (not a package file) or a package
# tags
@@ -40,24 +40,34 @@
# complete a capability
# relocate
# complete a `old=new' pair of paths
+# setattrs
+# complete for --setperms, --setugids, --setcaps and --restore
+# public_keys
+# complete for `rpmkeys --import'
+# query_specs
+# complete for `rpmspec --query'
_rpm () {
local curcontext="$curcontext" state lstate line nm="$compstate[nmatches]"
typeset -A opt_args
- local ret=1
- local -a tmp expl commonopts selectopts pathopts
+ local ret
+ local -a tmp expl opts commonopts selectopts fileopts pathopts buildopts queryopts
commonopts=(
'(-v --verbose)--quiet[print as little as possible]'
'(--quiet)*'{-v,--verbose}'[verbose output]'
- '--rcfile:resource file:_files'
- '--ftpproxy:ftp proxy server:_hosts'
- '--ftpport:ftp port number'
- '--httpproxy:http proxy server:_hosts'
- '--httpport:http port number'
- {-\?,--help}'[print help information]'
- '--version[print version number]'
- '--pipe:pipe command:->command'
+ '--rcfile=:configuration file:_sequence -s \: _files'
+ '--httpproxy=:http proxy server:_hosts'
+ '--httpport=:http port number'
+ '--pipe=[pipes the output of rpm to the specified command]:pipe command:_cmdstring'
+ \*{-D,--define=}'[define a macro]:macro value'
+ '*--undefine=[undefine a macro]:macro:->macros'
+ '--target=[specify target platform]:arch-vendor-os'
+ '--macros=[read macros from specified files instead of the defaults]:file:_sequence -s \: _files'
+ '--load=[load a single macro file]:file:_files'
+ "--noplugins[don't enable any plugins]"
+ "--nodigest[don't verify package digest(s)]"
+ "--nosignature[don't verify package signature(s)]"
)
# package selection options of which only one can be used
@@ -66,10 +76,17 @@ _rpm () {
{-f,--file}'[query packages that own specified files]'
{-p,--package}'[query uninstalled packages]'
{-g,--group}'[query packages in one of specified groups]'
- --fileid --hdrid --pkgid --tid --querybynumber
+ --pkgid --hdrid --tid --querybynumber
'--triggeredby'
- '--whatprovides:*:provided file:->file_or_package'
+ '--whatconflicts'
'--whatrequires'
+ '--whatobsoletes'
+ '--whatprovides'
+ '--whatrecommends'
+ '--whatsuggests'
+ '--whatsupplements'
+ '--whatenhances'
+ '--nomanifest'
)
sopts=${selectopts%\[*}\ --specfile
selectopts=(
@@ -78,31 +95,106 @@ _rpm () {
'(-a --all)*: :->package-select'
)
- pathopts=(
- '--root:rpm root directory:_files -/'
- '--dbpath:rpm database path:_files -/'
+ fileopts=(
+ '(-c --configfiles)'{-c,--configfiles}'[configuration files only]'
+ '(-d --docfiles)'{-d,--docfiles}'[documentation files only]'
+ '(-L --licensefiles)'{-L,--licensefiles}'[license files only]'
+ '(-A --artifactfiles)'{-A,--artifactfiles}'[artifact files only]'
+ '--noghost[exclude ghost files]'
+ '--noconfig[exclude config files]'
+ '--noartifact[exclude artifact files]'
)
- _arguments -C -s \
- "${commonopts[@]}" \
- {-q+,--query}'[query mode]:*:query:->query' \
- '(-V -y --verify)'{-V+,-y+,--verify}'[verify mode]:*:verify:->verify' \
- '--import:*:public key' \
- '(-K --checksig)'{-K,--checksig}'[signature check mode]:*:sigcheck:->sigcheck' \
- '(-i --install)'{-i+,--install}'[install mode]:*:install:->install' \
- '(-U --upgrade)'{-U+,--upgrade}'[upgrade mode]:*:upgrade:->upgrade' \
- '(-F --freshen)'{-F+,--freshen}'[freshen mode]:*:upgrade:->upgrade' \
- '(-e --erase)'{-e+,--erase}'[uninstall mode]:*:uninstall:->uninstall' \
- --{initdb,querytags,showrc} \
- '--rebuilddb:*:rebuild:->rebuild' \
- --{resign,addsign}':*:package:->package_file' \
- '--setperms[set file permissions]:*:package:->setattrs' \
- '--setugids[set file owner/group]:*:package:->setattrs' \
- '-b+[build mode (spec file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages)):*:build:->build_b' \
- '(-b)-t+[build mode (tar file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages)):*:build:->build_t' \
- '--rmsource:*:spec file:->spec_files' \
- --{rebuild,recompile}':*:source rpm file:->package_src' \
- '--eval:macro:->macros' && ret=0
+ pathopts=(
+ {-r,--root=}'[specify rpm root directory]:directory:_directories'
+ '--dbpath=[specify rpm database path]:path:_directories'
+ )
+
+ buildopts=(
+ '--rpmfcdebug[debug dependencies generation]'
+ '--buildroot=[override the build root]:build root directory:_directories'
+ '--build-in-place[run build in current directory]'
+ '--clean[remove the build tree after the packages are made]'
+ "--nobuild[don't execute any stages of the build]"
+ '--nodeps[do not verify build dependencies]'
+ '--nodirtokens[generate package header(s) compatible with (legacy) rpm v3 packaging]'
+ "--noclean[don't execute %clean stage of the build]"
+ "--noprep[don't execute %prep stage of the build]"
+ "--nocheck[don't execute %check stage of the build]"
+ '--rmsource[remove sources when done]'
+ '--rmspec[remove the spec file when done]'
+ '--short-circuit[skip straight to specified stage (only for c,i)]'
+ '*--with=[enable configure option for build]:option'
+ '*--without=[disable configure option for build]:option'
+ '--scm=[select the SCM to use with %autosetup]:scm [patch]:(patch gendiff git quilt)'
+ '*--buildpolicy=[set buildroot policy]:policy:->brp_policies'
+ '!--sign'
+ "--nodebuginfo[don't generate debuginfo for this package]"
+ )
+
+ queryopts=(
+ '--conflicts'
+ '--obsoletes[list packages obsoleted by package]'
+ '--provides[list capabilities provided by package]'
+ '(-R)--requires[list capabilities on which packages depend]'
+ )
+
+ case $service in
+ rpm|rpmkeys)
+ opts+=(
+ '--import[import an armored public key]:*: :->public_keys'
+ {-K,--checksig}'[signature check mode]:*:sigcheck:->checksig'
+ )
+ ;|
+ rpm|rpmdb)
+ opts+=( --{init,rebuild}'db:*: :->common' )
+ ;|
+ rpm|rpmsign)
+ opts+=(
+ --{add,re}sign'[sign package(s)]:*: :->sign'
+ '--delsign[delete package signatures]:*: :->sign'
+ )
+ ;|
+ rpm)
+ opts+=(
+ {-q+,--query}'[query mode]:*:query:->query'
+ {-V+,-y+,--verify}'[verify mode]:*:verify:->verify'
+ {-i+,--install}'[install mode]:*:install:->install'
+ {-U+,--upgrade}'[upgrade mode]:*:upgrade:->upgrade'
+ {-F+,--freshen}'[freshen mode]:*:upgrade:->upgrade'
+ {-e+,--erase}'[uninstall mode]:*:uninstall:->uninstall'
+ '--reinstall[reinstall mode]:*:install:->install'
+ '--setperms[set file permissions]:*:package:->setattrs'
+ '--setugids[set file owner/group]:*:package:->setattrs'
+ '--setcaps[set capabilities of files in the given package]:*:package:->setattrs'
+ '--restore[restore owner, group, permissions and capabilities of files in the given package]:*:package:->setattrs'
+ )
+ ;;
+ rpmbuild)
+ [[ -prefix -r ]] && pathopts[1]=
+ opts+=( $buildopts
+ '(-r -t)-b+[build mode (spec file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_b'
+ '(-b -t)-r+[build mode (source package)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_b'
+ '(-b -r)-t+[build mode (tar file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_t'
+ --{rebuild,recompile}':*:source rpm file:->build_r'
+ )
+ ;;
+ rpmspec)
+ opts+=(
+ {-P,--parse}'[parse spec files]:*: :->spec_files'
+ {-q,--query}'[query spec files]:*: :->query_specs'
+ )
+ ;;
+ rpmquery) state=query ;;
+ rpmverify) state=verify ;;
+ esac
+
+ [[ -z $state ]] && _arguments -C -s $pathopts $opts $commonopts \
+ '(-)'{-\?,--help}'[print help information]' \
+ '(-)--usage[print brief usage message]' \
+ '(-)--version[print version number]' \
+ \*{-E,--eval=}'[print macro expansion of given expression]:expression:->tags' \
+ --{querytags,showrc}':*: :->common'
# As long as we have a state name...
@@ -121,84 +213,92 @@ _rpm () {
# Dispatch...
case "$lstate" in
+ common)
+ _arguments -s -C $commonopts
+ ;;
query)
# --dump requires one of -{l,c,d}
# --triggers requires --script
_arguments -s -C \
- \!{-q,--query} "${commonopts[@]}" "${selectopts[@]}" "${pathopts[@]}" \
- "($sopts)--specfile[query specified spec file as if it were a package]" \
- '(-i --info)'{-i,--info}'[display package information]' \
- '--changelog[display change log]' \
- '(-s --state -l --list --filesbypkg)'{-l,--list}'[display package file list]' \
- '(-s --state -l --list --filesbypkg)'{-s,--state}'[show file states]' \
- '(-s --state -l --list)--filesbypkg[list files with package names]' \
- {-d,--docfiles}'[documentation files only]' \
- {-c,--configfiles}'[configuration files only]' \
- '--dump[show all information]' \
- '--provides[show capabilities provided]' \
- \*--{qf,queryformat}'[specify format for package information]:rpm query format:->tags' \
- -{R,-requires}'[list dependencies]' \
- '--scripts[show (un)install scripts]' \
- {--triggers,--triggerscripts}'[show trigger scripts]' && ret=0
+ \!{-q,--query} $commonopts $selectopts $fileopts $pathopts $queryopts \
+ '--dump[dump basic file information]' \
+ \*--{qf,queryformat}'[specify format for package information]:rpm query format:->tags' \
+ "($sopts)--specfile[query specified spec file as if it were a package]" \
+ '(-i --info)'{-i,--info}'[display package information]' \
+ '--changelog' '--changes' '--dupes' \
+ '--last[order packages by install time]' \
+ '--xml' \
+ '--recommends[list capabilities recommended by packages]' \
+ '(--requires)-R[list capabilities on which packages depend]' \
+ '--suggests[list capabilities suggested by packages]' \
+ '--supplements[list capabilities supplemented by packages]' \
+ '(-s --state -l --list --filesbypkg)'{-l,--list}'[list files in package]' \
+ '(-s --state -l --list)'{-s,--state}'[show file states]' \
+ '--fileclass' '--filecolor' '--fileprovide' '--filerequire' \
+ '--filecaps' '--filesbypkg[list files with package names]' \
+ '--filetriggers[list filetrigger scriptlets]' \
+ '--scripts[show (un)install scripts]' \
+ {--triggers,--triggerscripts}'[show trigger scripts]'
;;
+ query_specs)
+ _arguments -s -C \
+ \!{-q,--query} $commonopts $pathopts $queryopts \
+ --buildconflicts --buildrequires --trace \
+ '*:spec file:->spec_files'
+ ;;
setattrs)
- _arguments -s -C --set{perm,ugids} "${selectopts[@]}" && ret=0
+ _arguments -s -C '!--set{perm,ugids,caps}' '!--restore' $selectopts
;;
verify)
- _arguments -s -C \!-{y,V} \
- "${commonopts[@]}" "${selectopts[@]}" "${pathopts[@]}" \
- --no{deps,files,scripts,digest,signature,linkto,md5,size,user,group,mtime,mode,rdev} && ret=0
+ _arguments -s -C \
+ \!{-V,--verify} $commonopts $selectopts $fileopts $pathopts \
+ --no{deps,digest,files,scripts,signature,linkto,filedigest,size,user,group,mtime,mode,rdev,caps}
;;
upgrade)
tmp=( '(--force)--oldpackage' )
;&
install)
- _arguments -s -C \!-{i,U} "$tmp[@]" \
- "${commonopts[@]}" "${pathopts[@]}" \
- '--excludepath:file to exclude:_files -/' \
+ _arguments -s -C \!{-i,--install,-U,--upgrade,-F,--freshen} $tmp \
+ $commonopts $pathopts \
+ '--excludepath=:file to exclude:_files -/' \
'--relocate:relocate:->relocate' \
- '--prefix:package prefix directory:_files -/' \
- '(-h --hash)'{-h,--hash} \
+ '--prefix=[relocate the package]:package prefix directory:_files -/' \
+ '(-h --hash)'{-h,--hash}'[print hash marks as package installs]' \
'(--replacepkgs --replacefiles --oldpackage)--force' \
'(--force)--'{replacefiles,replacepkgs} \
- --{aid,allfiles,badreloc,excludedocs,ignorearch,ignoreos,ignoresize,includedocs,justdb,percent,repackage,test} \
- --no{digest,signature,deps,suggest,order,pre,post,preun,postun,trigger{s,in,un,postun}} \
+ --{aid,allfiles,badreloc,excludedocs,ignorearch,ignoreos,ignoresize,includedocs,justdb,percent,test} \
+ --no{deps,filedigest,contexts,caps,order,suggest,pre,post,preun,postun,trigger{s,in,un,postun}} \
'(--nopre --nopost --nopreun --nopostun)--noscripts' \
- '*:pkg file:->package_file' && ret=0
+ '*:pkg file:->package_file'
;;
uninstall)
- _arguments -s -C \!-e \
+ _arguments -s -C \!{-e,--erase} \
"${commonopts[@]}" "${pathopts[@]}" \
--{allmatches,justdb,repackage,test} \
--no{deps,scripts,preun,postun,trigger{s,un,postun}} \
- '*:package:->package' && ret=0
+ '*:package:->package'
;;
- build_b)
- tmp=( '*:spec file:_files -g "*.spec(-.)"' )
- ;&
- build_t)
- (( $#tmp )) || tmp=( '*:tar file:_files -g "*.(#i)tar(.*|)(-.)"' )
-
- _arguments -s -C \
- "${commonopts[@]}" "${pathopts[@]}" \
- --{short-circuit,clean,nobuild,rmsource,sign,test} \
- '--target:specify a build target:->target'\
- '--buildroot:build root directory:_files -/' \
- '--buildarch:architecture for which to build:->target' \
- '--buildos:operating system for which to build:' \
- '--timecheck:time check (seconds):' "$tmp[1]" && ret=0
+ build_b) tmp=( '*:spec file:_files -g "*.spec(-.)"' ) ;|
+ build_r) tmp=( '*:source package:_files -g "*.(#i)src.rpm(-.)"' ) ;|
+ build_t) tmp=( '*:tar file:_files -g "*.(#i)tar(.*|)(-.)"' ) ;|
+ build_?)
+ _arguments -s -C $buildopts $commonopts $pathopts \
;;
- sigcheck)
+ checksig)
_arguments -s -C \!-K \
"${commonopts[@]}" \
- --no{gpg,pgp,md5,signature,digest} \
- '*:package file:->package_file' && ret=0
- ;;
- rebuild)
- _arguments -s -C \
- "${commonopts[@]}" "${pathopts[@]}" \
- '*:source package file:->package_file' && ret=0
+ --no{gpg,pgp,md5,digest} \
+ '*:package file:->package_file'
;;
+ sign)
+ _arguments -s -C $commonopts $pathopts \
+ '--signfiles[sign package(s) files]' \
+ '--fskpath=[use file signing key]:key:_files' \
+ '--fskpass[prompt for file signing key password]' \
+ '--key-id=[specify key id/name to sign with]:key id' \
+ '--digest-algo=[override default digest algorithm]:algorithm:(sha1 sha256 sha384 sha512)' \
+ '*:package file:_files -g "*.(#i)rpm(-.)"'
+ ;;
package-select)
case "${opt_args[(i)${sopts// /|}]}" in
-f|--file) _files ;;
@@ -207,6 +307,7 @@ _rpm () {
--fileid|--pkgid) _message -e md5 md5 ;;
--hdrid) _message -e sha1 sha1 ;;
--querybynumber) _message -e value number ;;
+ --tid) _message -e ids 'transaction id' ;;
--what*) state=capabilities ;;
--specfile) state=spec_files ;;
*) state=package ;;
@@ -214,24 +315,18 @@ _rpm () {
;;
macros)
local -a macros
- local mfile
- for mfile in {/usr/lib/rpm/{,redhat/}macros,/etc/rpm/macros,~/.rpmmacros}(N); do
- macros+=( ${${(M)${(f)"$(<$mfile)"}:#%[^\{]*}%%[[:blank:]]*} )
- done
+ macros=( ${${${(M)${(f)"$(_call_program macros rpm --showrc)"}:#(-|)[0-9]##[:=] ##*}#* }%%[[:blank:](]*} )
+ _description macros expl macro
if zstyle -t ":completion:${curcontext}:macros" prefix-hidden; then
- macros=( ${macros#%} )
- _wanted macros expl macro compadd -p '%' -a - macros
+ compadd "$expl[@]" -p '%' -a - macros
else
- _wanted macros expl macro compadd -a - macros
+ macros=( %${^macros} )
+ compadd "$expl[@]" -a - macros
fi
- ;;
- command)
- compset -q
- _normal
- ;;
+ ;;
target)
_wanted targets expl 'target platform' compadd \
- ${${(M)${(f)"$(_call_programs targets rpm --showrc)"}:#compatible archs*}##*: } && ret=0
+ ${${(M)${(f)"$(_call_programs targets rpm --showrc)"}:#compatible archs*}##*: }
;;
groups)
if ( (( ! $+_rpm_groups )) || _cache_invalid rpm-groups ) &&
@@ -243,11 +338,8 @@ _rpm () {
)
_store_cache RPM-groups _rpm_groups
fi
- _wanted groups expl 'group' _multi_parts / _rpm_groups && ret=0
+ _wanted groups expl 'group' _multi_parts / _rpm_groups
;;
- package_or_file)
- state=package_file
- ;;
file_or_package)
if [[ $PREFIX = /* ]]; then
_wanted files expl 'file' _files
@@ -259,43 +351,57 @@ _rpm () {
if ( [[ ${+_rpms} -eq 0 ]] || _cache_invalid RPMs ) &&
! _retrieve_cache RPMs;
then
- _rpms=( $(_call_program packages rpm -qa 2>/dev/null) )
+ _rpms=( $(_call_program packages rpm -qa) )
_store_cache RPMs _rpms
fi
_wanted packages expl 'package' \
- compadd -M 'r:|-=* r:|=*' - "$_rpms[@]" && ret=0
+ compadd -M 'r:|-=* r:|=*' - "$_rpms[@]"
;;
spec_files)
_wanted specfiles expl 'spec file' \
- _files -g '*.spec(-.)' && ret=0
+ _files -g '*.spec(-.)'
;;
package_file)
_wanted files expl 'package file' \
- _files -g '*.(#i)rpm(-.)' && ret=0
+ _files -g '*.(#i)rpm(-.)'
if [[ -prefix 1 (f|ht)tp:// ]]; then
_wanted urls expl 'URL of rpm package file' \
- _urls -f -g '*.(#i)rpm(-.)' "${expl[@]}" && ret=0
+ _urls -f -g '*.(#i)rpm(-.)' "${expl[@]}"
else
_wanted urls expl 'URL of rpm package file' \
- compadd -S '' "${expl[@]}" ftp:// http:// && ret=0
+ compadd -S '' "${expl[@]}" ftp:// http://
fi
;;
package_src)
- _files -g '(#i)*.src.rpm(-.)' && ret=0
+ _wanted files expl 'source package' _files -g '(#i)*.src.rpm(-.)'
;;
tags)
local -a suf
if compset -P "*%*${${QIPREFIX:+{}:-\{}"; then
- compset -S '(|\\)}*' || suf=( -qS ${${QIPREFIX:+\}}:-\\\}} )
- _wanted tags expl 'rpm tag' compadd -M 'm:{a-z}={A-Z}' "$suf[@]" - \
- "${(L@)${(@f)$(_call_program tags rpm --querytags 2>/dev/null)}#RPMTAG_}" && ret=0
+ compset -S '(|\\)}*' || suf=( -S ${${QIPREFIX:+\}}:-\\\}} -r ": \}\t\n\-" )
+ if compset -P '*:'; then
+ _wanted formats expl format compadd $suf - \
+ armor arraysize base64 date day depflags deptype expand \
+ fflags fstate fstatus hex octal humaniec humansi perms \
+ pgpsig shescape triggertype vflags xml
+ else
+ _wanted tags expl 'rpm tag' compadd -M 'm:{a-z}={A-Z}' "$suf[@]" - \
+ "${(L@)${(@f)$(_call_program tags rpm --querytags)}#RPMTAG_}"
+ fi
else
- _message -e formats 'rpm query format'
+ _message -e formats 'rpm query format'
fi
;;
capabilities)
- _wanted capabilities expl capability compadd \
- ${(f)"$(_call_program capabilities rpm -qa --queryformat '%\{requirename}\\n' 2>/dev/null)"} && ret=0
+ local match mbegin mend
+ if [[ "${opt_args[(i)${sopts// /|}]}" = --what(#b)(*) ]]; then
+ if [[ $match[1] = provides && -prefix / ]]; then
+ _wanted files expl file _files
+ else
+ _description capabilities expl capability
+ compadd ${${(f)"$(_call_program capabilities rpm -qa --queryformat '%\{$match[1]}\\n')"}:#\(none\)}
+ fi
+ fi
;;
relocate)
if compset -P 1 '*='; then
@@ -304,11 +410,19 @@ _rpm () {
_description directories expl 'old path'
fi
- _files "$expl[@]" -/ && ret=0
+ _files "$expl[@]" -/
;;
+ public_keys)
+ _arguments -s -C \!--import $commonopts \
+ '*:public key:_files'
+ ;;
+ brp_policies)
+ local rpmconfigdir=$(_call_program policies rpm -E '%\{_rpmconfigdir\}')
+ _wanted policies expl policy compadd $rpmconfigdir/brp-*(N:t:s/brp-//)
+ ;;
esac
- [[ ret -eq 0 || $nm -ne $compstate[nmatches] ]] && return 0
+ [[ $nm -ne $compstate[nmatches] ]] && return 0
done
return ret
diff --git a/Completion/Linux/Command/_rpmbuild b/Completion/Linux/Command/_rpmbuild
deleted file mode 100644
index 74d4464d8..000000000
--- a/Completion/Linux/Command/_rpmbuild
+++ /dev/null
@@ -1,53 +0,0 @@
-#compdef rpmbuild
-
-local -a cmds b_cmds t_cmds options b_options
-
-cmds=(--rebuild --recompile)
-b_cmds=(-ba -bb -bp -bc -bi -bl -bs)
-t_cmds=(-ta -tb -tp -tc -ti -tl -ts)
-options=(--quiet -v -vv --verbose --rcfile --pipe --dbpath -r --root --buildroot --clean --nobuild --nodeps --nodigest --nosignature --macros
- --rmsource --rmspec --short-circuit --sign --target -D --define -E --eval --with --without --debug --bcond --install-build-tree)
-b_options=(--clean --nobuild --nodeps --nodigest --nosignature --rmsource --rmspec --short-circuit --sign --target --debug --with --without)
-
-_arguments \
- "($cmds $b_cmds $t_cmds)"{-ba,-ta}'[build binary and source packages]' \
- "($cmds $b_cmds $t_cmds)"{-bb,-tb}'[build a binary package]' \
- "($cmds $b_cmds $t_cmds)"{-bp,-tp}'[execute the "%prep" stage]' \
- "($cmds $b_cmds $t_cmds)"{-bc,-tc}'[do the "%build" stage]' \
- "($cmds $b_cmds $t_cmds)"{-bi,-ti}'[do the "%install" stage]' \
- "($cmds $b_cmds $t_cmds)"{-bl,-tl}'[do a "list check"]' \
- "($cmds $b_cmds $t_cmds)"{-bs,-ts}'[build just the source package]' \
- "($cmds $b_cmds $t_cmds * $b_options $options)"{-\?,--help}'[show help message]' \
- "($cmds $b_cmds $t_cmds * $b_options $options)"--querytags'[display known query tags]' \
- "($cmds $b_cmds $t_cmds * $b_options)"--showrc'[display final rpmrc and macro configuration]' \
- "($cmds $b_cmds $t_cmds * $b_options $options)"--usage'[display brief usage message]' \
- "($cmds $b_cmds $t_cmds * $b_options $options)"--version'[print the version of rpm being used]' \
- "(-v --verbose -vv)"--quiet'[print as little as possible]' \
- "(-v --verbose --quiet)"{-v,--verbose}'[print verbose information]' \
- "(-v --verbose --quiet)"-vv'[print lots of ugly debugging information]' \
- --rcfile'[RC files]:RC files:_files -S\:' \
- --macros'[macros files]:macros files:_files -S\:' \
- --pipe'[command to pipe the output of rpm to]:command' \
- --dbpath'[set database directory]:database directory:_files -/' \
- "(-r --root)"{-r,--root}'[root file system tree]:chroot directory:_files -/' \
- --buildroot'[override the BuildRoot]:BuildRoot directory:_files -/' \
- --clean'[remove the build tree after the packages are made]' \
- --nobuild'[do not execute any build stages (for spec testing purposes]' \
- --nodeps'[do not verify build dependencies]' \
- --nodigest"[don't verify package digest(s)]" \
- --nosignature"[don't verify package signature(s)]" \
- --rmsource'[remove the sources after the build]' \
- --rmspec'[remove the spec file after the build]' \
- --short-circuit'[skip straight to specified stage (-bc, -bi or -bb in PLD Linux]' \
- --sign'[embed a GPG signature]' \
- --target='[set target platform]:arch-vendor-os:' \
- {'*-D','*--define='}'[define MACRO with value EXPR]:MACRO EXPR' \
- {'*-E','*--eval='}'[print macro expansion of EXPR]:EXPR' \
- '*--with[enable configure option for build]:option' \
- '*--without[disable configure option for build]:option' \
- "($cmds $b_cmds $t_cmds * $b_options)"--bcond'[find all --with/--without values]' \
- --debug'[build packages with debug information]' \
- "($cmds $b_cmds $t_cmds * $b_options)"--install-build-tree'[make all needed dirs for building binary rpms]' \
- "(--clean $b_cmds $t_cmds --rebuild)"--recompile'[recompile source package]' \
- "(--clean $b_cmds $t_cmds --recompile)"--rebuild'[rebuild source package]' \
- "*:file:_files -g '(#i)*.(spec|srpm|tgz|tar|tar.gz|tar.bz2)(-.)'" && ret=0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author