From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 893 invoked from network); 30 May 2000 03:20:24 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 May 2000 03:20:24 -0000 Received: (qmail 12291 invoked by alias); 30 May 2000 03:20:07 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11643 Received: (qmail 12281 invoked from network); 30 May 2000 03:20:04 -0000 From: "Bart Schaefer" Message-Id: <1000530031957.ZM17947@candle.brasslantern.com> Date: Tue, 30 May 2000 03:19:57 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: PATCH: Updated _rpm, but a bug with _arguments MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 25, 4:02pm, Bart Schaefer wrote: } Subject: Re: PATCH: Re: _rpm odd behavior } } On May 24, 10:29am, Sven Wischnowsky wrote: } } Subject: PATCH: Re: _rpm odd behavior } } } } [The patch] also adds the `-c'. Any other missing options anywhere? } } I may take a look at _rpm later if no one else gets there first. But it } may be tomorrow, so if someone else has time, don't wait for me. As of the current CVS sources (_arguments revision 1.25) completion for rpm doesn't work any longer: zagzig[24] rpm --rc Completing no arguments (beep) zagzig[24] rpm --rc zagzig[24] rpm - Completing option --verify -- verify mode -F -- freshen mode -K -- signature check mode -U -- upgrade mode -V -- verify mode -b -- build mode (spec file) -e -- uninstall mode -i -- install mode -q -- query mode -t -- build mode (tar file) -v -- verbose mode -y -- verify mode --addsign --ftpport --pipe --rebuilddb --setperms --checksig --ftpproxy --querytags --recompile --setugids --erase --initdb --rcfile --resign --showrc --freshen --install --rebuild --rmsource --upgrade The difference from 3.1.7-pre-4 appears to be that `comparguments -O ...' at _arguments:187 fails in the latest version; trace output is identical up to that point. That means I'm not able to properly test the following patch for _rpm, but I *think* it's correct. Two things I didn't work out how to accomplish are noted in comments under the `query' state. Index: Completion/Linux/_rpm =================================================================== @@ -39,8 +39,6 @@ # relocate # complete a `old=new' pair of paths -local ret=1 tmp expl - # Used by `_arguments', made local here. local curcontext="$curcontext" state lstate line @@ -48,33 +46,57 @@ state='' +local ret=1 +local -a tmp expl commonopts packageopts +commonopts=( + '*-v[verbose mode]' + '--rcfile:resource file:_files' + '--ftpproxy:FTP proxy server:_hosts' + '--ftpport:FTP port number:' + '--httpproxy:HTTP proxy server:_hosts' + '--httpport:HTTP port number:' +) +packageopts=( + '-a[query all packages]' + '-p+[query uninstalled package file]:*:RPM package file:->package_file' + '-f[specify file to query owner of]:file:_files' + '--triggeredby:RPM package:->package' + '--whatprovides:RPM capability:->capability' + '--whatrequires:RPM capability:->capability' +) +pathopts=( + '--root:RPM root directory:_files -/' + '--dbpath:RPM database path:_files -/' +) + # Do simple completions or get the first state. _arguments -C -s \ - '--rcfile:resource file:_files' \ - '--ftpproxy:FTP proxy server:_hosts' \ - '--ftpport:FTP port number:' \ + '--help[print help message]' \ + '--version[print version number]' \ + "${commonopts[@]}" \ '-q+[query mode]:*:query:->query' \ - '*-v[verbose mode]' \ - --{setperms,setugids,querytags,initdb,showrc} \ + --{querytags,initdb,showrc} \ '--pipe:pipe command:_command_names -e' \ -{V,y}'[verify mode]:*:verify:->verify' \ '--verify[verify mode]:*:verify:->verify' \ - '-i+[install mode]:*:install:->install' \ - '--install:*:install:->install' \ - '-U+[upgrade mode]:*:upgrade:->upgrade' \ - '--upgrade:*:upgrade:->upgrade' \ - '-F+[freshen mode]:*:upgrade:->upgrade' \ - '--freshen:*:upgrade:->upgrade' \ - '-e+[uninstall mode]:*:uninstall:->uninstall' \ - '--erase:*:uninstall:->uninstall' \ - -'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' \ - -'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' \ + '--setperms[set file permissions]:*:package:->setattrs' \ + '--setugids[set file owner/group]:*:package:->setattrs' \ + '(--install)-i+[install mode]:*:install:->install' \ + '(-i)--install:*:install:->install' \ + '(--upgrade)-U+[upgrade mode]:*:upgrade:->upgrade' \ + '(-U)--upgrade:*:upgrade:->upgrade' \ + '(--freshen)-F+[freshen mode]:*:upgrade:->upgrade' \ + '(-F)--freshen:*:upgrade:->upgrade' \ + '(--erase)-e+[uninstall mode]:*:uninstall:->uninstall' \ + '(-e)--erase:*:uninstall:->uninstall' \ + '-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' \ --{resign,addsign}':*:RPM package:->package' \ '--rmsource:*:spec file:->spec_file' \ --{rebuild,recompile}':*:Src RPM files:->package_src' \ - '-K+[signature check mode]:*:sigcheck:->sigcheck' \ - '--checksig:*:sigcheck:->sigcheck' \ + '(--checksig)-K+[signature check mode]:*:sigcheck:->sigcheck' \ + '(-K)--checksig:*:sigcheck:->sigcheck' \ '--rebuilddb:*:rebuild:->rebuild' && ret=0 # As long as we have a state name... @@ -96,59 +118,52 @@ case "$lstate" in query) _arguments -s \ - '*-v[verbose mode]' -q -c \ - '--rcfile:resource file:_files' \ - '--ftpproxy:FTP proxy server:_hosts' \ - '--ftpport:FTP port number:' \ - '--root:RPM root directory:_files -/' \ - '--dbpath:RPM database path:_files -/' \ + -q "${commonopts[@]}" "${packageopts[@]}" "${pathopts[@]}" \ '--queryformat:RPM query format:->tags' \ - '-f[specify file to query owner of]:file:_files' \ - '-p+[specify uninstalled package file to query]:*:RPM package file:->package_file' \ - '--triggeredby:RPM package:->package' \ - '--whatprovides:RPM capability:->capability' \ - '--whatrequires:RPM capability:->capability' \ + '-i[display package information]' \ + '--changelog[display change log]' \ + '-l[display package file list]' \ + '-s[show file states]' \ + '-d[documentation files only]' \ + '-c[configuration files only]' \ + '--dump[show all information]' # Requires one of -{l,c,d} ... \ + --provides \ + -{R,-requires}'[list dependencies]' \ + '--scripts[show (un)install scripts]' \ + '--triggers[show trigger scripts]' # Requires --scripts ... \ '*:RPM package:->package_or_file' && ret=0 ;; + setattrs) + _arguments -s --set{perm,ugids} "${packageopts[@]}" && ret = 0 + ;; verify) _arguments -s \ - '*-v[verbose mode]' '(-y)-V' '(-V)-y' \ - '--rcfile:resource file:_files' \ - '--ftpproxy:FTP proxy server:_hosts' \ - '--ftpport:FTP port number:' \ + '(-y --verify)-V' '(-V --verify)-y' '(-y -V)--verify' \ + "${commonopts[@]}" "${pathopts[@]}" \ --no{deps,md5,files} \ - '--root:RPM root directory:_files -/' \ - '--dbpath:RPM database path:_files -/' \ '*:RPM package:->package' && ret=0 ;; upgrade) - tmp=( -U --oldpackage ) + tmp=( '(--upgrade)-U' '(-U)--upgrade' '(--force)--oldpackage' ) ;& install) - (( $#tmp )) || tmp=(-i) + (( $#tmp )) || tmp=( '(--install)-i' '(-i)--install' ) _arguments -s "$tmp[@]" \ - '*-v[verbose mode]' \ - '--rcfile:resource file:_files' \ - '--ftpproxy:FTP proxy server:_hosts' \ - '--ftpport:FTP port number:' \ - '(-h)--hash' '(--hash)-h' \ - '(--replacepkgs --replacefiles --oldpackage)--force' \ - --{badreloc,excludedocs,allfiles,ignorearch,ignoreos,includedocs,justdb,nodeps,noorder,noscripts,notriggers,percent,replacefiles,replacepkgs,test} \ + "${commonopts[@]}" "${pathopts[@]}" \ + '--excludepath:exclude files in following path:_files -/' \ '--relocate:relocate:->relocate' \ '--prefix:package prefix directory:_files -/' \ - '--root:RPM root directory:_files -/' \ - '--dbpath:RPM database path:_files -/' \ + '(-h)--hash' '(--hash)-h' \ + '(--replacepkgs --replacefiles --oldpackage)--force' \ + '(--force)--'{replacefiles,replacepkgs} \ + --{badreloc,excludedocs,allfiles,ignorearch,ignoreos,includedocs,justdb,nodeps,noorder,noscripts,notriggers,percent,test} \ '*:pkg file:->package_file' && ret=0 ;; uninstall) _arguments -s \ - '*-v[verbose mode]' -e \ - '--rcfile:resource file:_files' \ - '--ftpproxy:FTP proxy server:_hosts' \ - '--ftpport:FTP port number:' \ + '(-e)--erase' '(--erase)-e' \ + "${commonopts[@]}" "${pathopts[@]}" \ --{allmatches,justdb,nodeps,noorder,noscripts,notriggers} \ - '--root:RPM root directory:_files -/' \ - '--dbpath:RPM database path:_files -/' \ '*:RPM package:->package' && ret=0 ;; build_b) @@ -158,10 +173,7 @@ (( $#tmp )) || tmp=( '*:tar file:_files -g \*.\(\#i\)tar\(.\*\|\)' ) _arguments -s \ - '*-v[verbose mode]' \ - '--rcfile:resource file:_files' \ - '--ftpproxy:FTP proxy server:_hosts' \ - '--ftpport:FTP port number:' \ + "${commonopts[@]}" "${pathopts[@]}" \ --{short-circuit,clean,rmsource,sign,test} \ '--target:specify a build target:->target'\ '--buildroot:build root directory:_files -/' \ @@ -171,21 +183,14 @@ ;; sigcheck) _arguments -s \ - '*-v[verbose mode]' -K \ - '--rcfile:resource file:_files' \ - '--ftpproxy:FTP proxy server:_hosts' \ - '--ftpport:FTP port number:' \ + '(-K)--checksig' '(--checksig)-K' \ + "${commonopts[@]}" \ --no{pgp,md5} \ '*:RPM package file:->package_file' && ret=0 ;; rebuild) _arguments -s \ - '*-v[verbose mode]' \ - '--rcfile:resource file:_files' \ - '--ftpproxy:FTP proxy server:_hosts' \ - '--ftpport:FTP port number:' \ - '--root:RPM root directory:_files -/' \ - '--dbpath:RPM database path:_files -/' \ + "${commonopts[@]}" "${pathopts[@]}" \ '*:RPM source package file:->package_file' && ret=0 ;; target) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net