zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: bugfixes for _rpm
@ 2000-04-26 16:37 Adam Spiers
  2000-04-26 17:23 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Spiers @ 2000-04-26 16:37 UTC (permalink / raw)
  To: zsh workers mailing list

rpm --recompile takes a src.rpm as argument, and rpm --rmsource takes
a spec file as argument.

--rmsource completion still doesn't work exactly as I'd like it to
after the patch is applied - it completes all files, not just *.spec.
Have I done something wrong, or do I have to finally take the plunge
and try to understand the file-patterns style?

As a result of this doubt, I haven't committed it to CVS yet.


Index: Completion/Linux/_rpm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/_rpm,v
retrieving revision 1.6
diff -u -r1.6 _rpm
--- Completion/Linux/_rpm	2000/04/17 08:42:18	1.6
+++ Completion/Linux/_rpm	2000/04/26 16:33:22
@@ -70,8 +70,9 @@
   '--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' \
-  --{rmsource,recompile,resign,addsign}':*:RPM package:->package' \
-  '--rebuild:*:Src RPM files:->package_src' \
+  --{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' \
   '--rebuilddb:*:rebuild:->rebuild' && ret=0
@@ -198,13 +199,17 @@
     _wanted packages expl 'RPM package' \
         compadd -M 'r:|-=* r:|=*' - $(_call packages rpm -qa) && ret=0
     ;;
+  spec_file)
+    _wanted specfiles expl 'spec file' \
+        _files "$expl[@]" -g \*.spec && ret=0
+    ;;
   package_file)
     if compset -P ftp://; then
       _hosts -S/ && ret=0
     else
       _alternative \
           'files:RPM package file:_files -g \*.\(\#i\)rpm' \
-	  'prefixes:ftp URL prefix:compadd ftp://' && ret=0
+          'prefixes:ftp URL prefix:compadd ftp://' && ret=0
     fi
     ;;
   package_src)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: bugfixes for _rpm
  2000-04-26 16:37 PATCH: bugfixes for _rpm Adam Spiers
@ 2000-04-26 17:23 ` Bart Schaefer
  2000-04-26 17:35   ` Adam Spiers
  2000-04-29 15:46   ` PATCH: bugfixes for _rpm Adam Spiers
  0 siblings, 2 replies; 6+ messages in thread
From: Bart Schaefer @ 2000-04-26 17:23 UTC (permalink / raw)
  To: Adam Spiers, zsh workers mailing list

On Apr 26,  5:37pm, Adam Spiers wrote:
} Subject: PATCH: bugfixes for _rpm
}
} --rmsource completion still doesn't work exactly as I'd like it to
} after the patch is applied - it completes all files, not just *.spec.
} Have I done something wrong, or do I have to finally take the plunge
} and try to understand the file-patterns style?

You've done something wrong.

} +  spec_file)
} +    _wanted specfiles expl 'spec file' \
} +        _files "$expl[@]" -g \*.spec && ret=0
} +    ;;

Take that "$expl[@]" out of there, you don't need it and it's ultimately
causing an empty string as an argument to _files.  (Could that be a bug
elsewhere?  Shouldn't "$foo[@]" completely disappear, as does "$@"?)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: bugfixes for _rpm
  2000-04-26 17:23 ` Bart Schaefer
@ 2000-04-26 17:35   ` Adam Spiers
  2000-04-26 17:49     ` PATCH: bugfixes for _rpm and _hash Adam Spiers
  2000-04-29 15:46   ` PATCH: bugfixes for _rpm Adam Spiers
  1 sibling, 1 reply; 6+ messages in thread
From: Adam Spiers @ 2000-04-26 17:35 UTC (permalink / raw)
  To: zsh workers mailing list

Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> Take that "$expl[@]" out of there, you don't need it and it's ultimately
> causing an empty string as an argument to _files.

Ahah.  In that case is _hash wrong?  It has

  _wanted -C value values expl 'executable file' _files "$expl[@]" -g '*(-*)'

which seems to exhibit the same problem.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* PATCH: bugfixes for _rpm and _hash
  2000-04-26 17:35   ` Adam Spiers
@ 2000-04-26 17:49     ` Adam Spiers
  0 siblings, 0 replies; 6+ messages in thread
From: Adam Spiers @ 2000-04-26 17:49 UTC (permalink / raw)
  To: zsh workers mailing list

Adam Spiers (adam@spiers.net) wrote:
> Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> > Take that "$expl[@]" out of there, you don't need it and it's ultimately
> > causing an empty string as an argument to _files.
> 
> Ahah.  In that case is _hash wrong?  It has
> 
>   _wanted -C value values expl 'executable file' _files "$expl[@]" -g '*(-*)'
> 
> which seems to exhibit the same problem.

As soon as someone confirms this, I'll apply this patch, which makes
things work as expected.

Index: Completion/Builtins/_hash
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_hash,v
retrieving revision 1.2
diff -u -r1.2 _hash
--- Completion/Builtins/_hash	2000/04/11 07:57:56	1.2
+++ Completion/Builtins/_hash	2000/04/26 17:38:04
@@ -10,7 +10,7 @@
         compadd -q -S '=' - "${(@k)nameddirs}"
   fi
 elif compset -P 1 '*='; then
-  _wanted -C value values expl 'executable file' _files "$expl[@]" -g '*(-*)'
+  _wanted -C value values expl 'executable file' _files -g '*(-*)'
 else
   _wanted -C name commands expl command compadd -q -S '=' - "${(@k)commands}"
 fi
Index: Completion/Linux/_rpm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/_rpm,v
retrieving revision 1.6
diff -u -r1.6 _rpm
--- Completion/Linux/_rpm	2000/04/17 08:42:18	1.6
+++ Completion/Linux/_rpm	2000/04/26 17:38:04
@@ -70,8 +70,9 @@
   '--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' \
-  --{rmsource,recompile,resign,addsign}':*:RPM package:->package' \
-  '--rebuild:*:Src RPM files:->package_src' \
+  --{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' \
   '--rebuilddb:*:rebuild:->rebuild' && ret=0
@@ -198,13 +199,17 @@
     _wanted packages expl 'RPM package' \
         compadd -M 'r:|-=* r:|=*' - $(_call packages rpm -qa) && ret=0
     ;;
+  spec_file)
+    _wanted specfiles expl 'spec file' \
+        _files -g \*.spec && ret=0
+    ;;
   package_file)
     if compset -P ftp://; then
       _hosts -S/ && ret=0
     else
       _alternative \
           'files:RPM package file:_files -g \*.\(\#i\)rpm' \
-	  'prefixes:ftp URL prefix:compadd ftp://' && ret=0
+          'prefixes:ftp URL prefix:compadd ftp://' && ret=0
     fi
     ;;
   package_src)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: bugfixes for _rpm
  2000-04-26 17:23 ` Bart Schaefer
  2000-04-26 17:35   ` Adam Spiers
@ 2000-04-29 15:46   ` Adam Spiers
  1 sibling, 0 replies; 6+ messages in thread
From: Adam Spiers @ 2000-04-29 15:46 UTC (permalink / raw)
  To: zsh workers mailing list

Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> On Apr 26,  5:37pm, Adam Spiers wrote:
> } Subject: PATCH: bugfixes for _rpm
> }
> } --rmsource completion still doesn't work exactly as I'd like it to
> } after the patch is applied - it completes all files, not just *.spec.
> } Have I done something wrong, or do I have to finally take the plunge
> } and try to understand the file-patterns style?
> 
> You've done something wrong.
> 
> } +  spec_file)
> } +    _wanted specfiles expl 'spec file' \
> } +        _files "$expl[@]" -g \*.spec && ret=0
> } +    ;;

This does it right.  It also fixes 10772, which broke _rpm in other
ways by putting the target) case in the middle of two continuation
cases.

I haven't fixed _hash yet.

Index: Completion/Linux/_rpm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/_rpm,v
retrieving revision 1.6
diff -u -r1.6 _rpm
--- Completion/Linux/_rpm	2000/04/17 08:42:18	1.6
+++ Completion/Linux/_rpm	2000/04/29 15:37:12
@@ -70,8 +70,9 @@
   '--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' \
-  --{rmsource,recompile,resign,addsign}':*:RPM package:->package' \
-  '--rebuild:*:Src RPM files:->package_src' \
+  --{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' \
   '--rebuilddb:*:rebuild:->rebuild' && ret=0
@@ -187,24 +188,28 @@
       '--dbpath:RPM database path:_files -/' \
       '*:RPM source package file:->package_file' && ret=0
     ;;
-  package_or_file)
-    state=package_file
-    ;&
   target)
     _wanted target expl 'Target platforms' \
         compadd $(_call target rpm --showrc |grep 'compatible archs'|sed 's/.*: //') && ret=0
     ;;
+  package_or_file)
+    state=package_file
+    ;&
   package)
     _wanted packages expl 'RPM package' \
         compadd -M 'r:|-=* r:|=*' - $(_call packages rpm -qa) && ret=0
     ;;
+  spec_file)
+    _wanted specfiles expl 'spec file' \
+        _files -g \*.spec && ret=0
+    ;;
   package_file)
     if compset -P ftp://; then
       _hosts -S/ && ret=0
     else
       _alternative \
           'files:RPM package file:_files -g \*.\(\#i\)rpm' \
-	  'prefixes:ftp URL prefix:compadd ftp://' && ret=0
+          'prefixes:ftp URL prefix:compadd ftp://' && ret=0
     fi
     ;;
   package_src)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: bugfixes for _rpm
@ 2000-04-27  7:10 Sven Wischnowsky
  0 siblings, 0 replies; 6+ messages in thread
From: Sven Wischnowsky @ 2000-04-27  7:10 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
> 
> (Could that be a bug
> elsewhere?  Shouldn't "$foo[@]" completely disappear, as does "$@"?)

Only if it is already an array. But normally we just doe `local expl'
which initialises it to a scale with an empty-string value.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-04-29 15:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-26 16:37 PATCH: bugfixes for _rpm Adam Spiers
2000-04-26 17:23 ` Bart Schaefer
2000-04-26 17:35   ` Adam Spiers
2000-04-26 17:49     ` PATCH: bugfixes for _rpm and _hash Adam Spiers
2000-04-29 15:46   ` PATCH: bugfixes for _rpm Adam Spiers
2000-04-27  7:10 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).