zsh-users
 help / color / mirror / code / Atom feed
* RPM completion in dev19 and a suggested change to make completion
@ 2000-04-07 11:19 Francis GALIEGUE
  2000-04-07 11:51 ` Andrej Borsenkow
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Francis GALIEGUE @ 2000-04-07 11:19 UTC (permalink / raw)
  To: zsh-users


Hi,

I'm not au fait enough to do it by myself, but a suggestion for rpm
would be that it does not look into the RPM database if the -p
<package> option is specified, as it only applies to files. Is this
done in -dev20? Haven't had a look at it yet.

The other suggestion I have is to allow make completion to take GNU
make in acknowledgement:

--------
#compdef make gmake pmake

local prev="$words[CURRENT-1]" file ret=1 expl

if [[ "$prev" = -[CI] ]]; then
  _files -/
elif [[ "$prev" = -[foW] ]]; then
  _files
else
  file="$words[(I)-f]"
  if (( file )); then
    file="$words[file+1]"
  elif [[ -e Makefile ]]; then
    file=Makefile
  elif [[ -e makefile ]]; then
    file=makefile
  else
    file=''
  fi

  [[ -n "$file" ]] && _wanted targets expl 'make target' &&
      compadd "$expl[@]" - \
		$(make -f $file -p aaaaa 2>&1 | awk -F: '/^[a-zA-Z0-9][^\/ \t]+:/ {print $1}' | grep -v aaaaa) && ret=0

# This is the old code
#          $(awk '/^[a-zA-Z0-9][^\/ \t]+:/ {print $1}
# 	      /^\.include  *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include  *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
# 	        print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \
# 	     FS=: $file) && ret=0
  (( ret )) && { compset -P 1 '*='; _files }
fi
--------

With this, for example, make <TAB> in the kernel sources "sees" target
bzImage while it doesn't see it in the original version. Comments?

-- 
fg

# rm *;o
o: command not found


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

* RE: RPM completion in dev19 and a suggested change to make completion
  2000-04-07 11:19 RPM completion in dev19 and a suggested change to make completion Francis GALIEGUE
@ 2000-04-07 11:51 ` Andrej Borsenkow
  2000-04-07 12:45   ` Francis GALIEGUE
  2000-04-07 16:55 ` Bart Schaefer
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Andrej Borsenkow @ 2000-04-07 11:51 UTC (permalink / raw)
  To: Francis GALIEGUE, zsh-users

>
>   [[ -n "$file" ]] && _wanted targets expl 'make target' &&
>       compadd "$expl[@]" - \
> 		$(make -f $file -p aaaaa 2>&1 | awk -F:
> '/^[a-zA-Z0-9][^\/ \t]+:/ {print $1}' | grep -v aaaaa) && ret=0
>
> # This is the old code
> #          $(awk '/^[a-zA-Z0-9][^\/ \t]+:/ {print $1}
> # 	      /^\.include  *<bsd\.port\.(subdir\.|pre\.)?mk>/
> || /^\.include  *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
> # 	        print "fetch fetch-list extract patch configure
> build install reinstall deinstall package describe checkpatch
> checksum makesum" }' \
> # 	     FS=: $file) && ret=0
>   (( ret )) && { compset -P 1 '*='; _files }
> fi
> --------
>
> With this, for example, make <TAB> in the kernel sources "sees" target
> bzImage while it doesn't see it in the original version. Comments?
>


At least, check if it is GNU make or not. In my case:

bor@itsrm2% make -p dkfksjkfl |& grep modules
uninstall.modules:
uninstall: uninstall.bin  uninstall.modules  uninstall.man
uninstall.fns
.SUFFIXES:install.modules:
install: install.bin  install.modules  install.man  install.fns
bor@itsrm2% gmake -p dkfksjkfl |& grep modules
uninstall.modules:
install.modules:
uninstall: uninstall.bin uninstall.modules uninstall.man uninstall.fns
install: install.bin install.modules install.man install.fns

As you see, GNU make lists install.modules as target but native make
does not.

And what happens, if it does have "aaaaa" target? :-)

-andrej


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

* Re: RPM completion in dev19 and a suggested change to make completion
  2000-04-07 11:51 ` Andrej Borsenkow
@ 2000-04-07 12:45   ` Francis GALIEGUE
  2000-04-07 12:50     ` Andrej Borsenkow
  0 siblings, 1 reply; 9+ messages in thread
From: Francis GALIEGUE @ 2000-04-07 12:45 UTC (permalink / raw)
  To: zsh-users

"Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> 
> 
> At least, check if it is GNU make or not.

How?

> In my case:
> 
> bor@itsrm2% make -p dkfksjkfl |& grep modules
> uninstall.modules:
> uninstall: uninstall.bin  uninstall.modules  uninstall.man
> uninstall.fns
> .SUFFIXES:install.modules:
> install: install.bin  install.modules  install.man  install.fns
> bor@itsrm2% gmake -p dkfksjkfl |& grep modules
> uninstall.modules:
> install.modules:
> uninstall: uninstall.bin uninstall.modules uninstall.man uninstall.fns
> install: install.bin install.modules install.man install.fns
> 
> As you see, GNU make lists install.modules as target but native make
> does not.
>

A little perl will take care of that :) I really resent not having
bzImage as a completion target, and after all, maybe there's a way
make can list all targets without this hack... But the current
limitations of the original script are a nono for me. I always use GNU
make.

 
> And what happens, if it does have "aaaaa" target? :-)
> 

Worst case scenario, but can it ever be ? :)

-- 
fg

# rm *;o
o: command not found


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

* RE: RPM completion in dev19 and a suggested change to make completion
  2000-04-07 12:45   ` Francis GALIEGUE
@ 2000-04-07 12:50     ` Andrej Borsenkow
  2000-04-07 13:26       ` Francis GALIEGUE
  0 siblings, 1 reply; 9+ messages in thread
From: Andrej Borsenkow @ 2000-04-07 12:50 UTC (permalink / raw)
  To: Francis GALIEGUE, zsh-users

>> At least, check if it is GNU make or not.
>
> How?

Well, make --version happily tries to do "make all" ... dunno :-( The
worst case is to use styles.

>
> A little perl will take care of that :)

I said "native make". That also implies, that Perl may be unavailable. I
really hate completion functions that depend on tons of other software.

I really resent not having
> bzImage as a completion target, and after all, maybe there's a way
> make can list all targets without this hack... But the current
> limitations of the original script are a nono for me. I always use GNU
> make.
>

Me not. And I'd like Zsh to be used (and useful) not only on Linux. We
already have enough completion functions that are limited to GNU stuff.

-andrej


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

* Re: RPM completion in dev19 and a suggested change to make completion
  2000-04-07 12:50     ` Andrej Borsenkow
@ 2000-04-07 13:26       ` Francis GALIEGUE
  0 siblings, 0 replies; 9+ messages in thread
From: Francis GALIEGUE @ 2000-04-07 13:26 UTC (permalink / raw)
  To: zsh-users

"Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> 
> Well, make --version happily tries to do "make all" ... dunno :-( The
> worst case is to use styles.
> 

make -v, then?

Oh, and make -p happily prints the same result, though, so not even
the need for aaaaa hack - just discovered that. That's GNU make only
AFAIK, but heck. At least, now a conditional can be made on whether
make is GNU or not: GNU make -p returns 0, other return non 0. 

> >
> > A little perl will take care of that :)
> 
> I said "native make". That also implies, that Perl may be unavailable. I
> really hate completion functions that depend on tons of other software.
> 

Yup, agreed. Unfortunately, awk scripts very quickly become yet more
unreadable than perl ones... BTW perl even comes standard with AIX 
now :)

> I really resent not having
> > bzImage as a completion target, and after all, maybe there's a way
> > make can list all targets without this hack... But the current
> > limitations of the original script are a nono for me. I always use GNU
> > make.
> >
> 
> Me not. And I'd like Zsh to be used (and useful) not only on Linux. We
> already have enough completion functions that are limited to GNU stuff.
> 

Not my fault if GNU tools are better than their counterparts :)

-- 
fg

# rm *;o
o: command not found


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

* Re: RPM completion in dev19 and a suggested change to make completion
  2000-04-07 11:19 RPM completion in dev19 and a suggested change to make completion Francis GALIEGUE
  2000-04-07 11:51 ` Andrej Borsenkow
@ 2000-04-07 16:55 ` Bart Schaefer
  2000-04-10 15:02   ` Bart Schaefer
  2000-04-07 16:55 ` RPM completion in dev19 and a " Bart Schaefer
  2000-04-07 19:10 ` Chmouel Boudjnah
  3 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2000-04-07 16:55 UTC (permalink / raw)
  To: Francis GALIEGUE, zsh-users

On Apr 7,  1:19pm, Francis GALIEGUE wrote:
} Subject: RPM completion in dev19 and a suggested change to make completion
}
} The other suggestion I have is to allow make completion to take GNU
} make in acknowledgement:
[...]
} With this, for example, make <TAB> in the kernel sources "sees" target
} bzImage while it doesn't see it in the original version. Comments?

Random pot-shot:  I think if the linux kernel build process is going to
rely on GNU make features, the Makefile ought to be named GNUmakefile
so that (a) other makes won't try to read it and (b) we could tell from
the file name whether to attempt "make -p" or the like.

However, given how unlikely it is that this will happen any time soon,
how about the following (not committed to SourceForge due to controversy).
Even if we don't use the "make -nsp ..." part, we should add "=" to the
characters that aren't allowed to appear before the ":" -- I found it
was completing assignments of the form

	WWW_HOME = http

(because "WWW_HOME = http://blahblahblah" matched the pattern).

Index: Completion/User/_make
===================================================================
@@ -14,17 +14,23 @@
     file=Makefile
   elif [[ -e makefile ]]; then
     file=makefile
+  elif [[ -e GNUmakefile ]]; then
+    file=GNUmakefile
   else
     file=''
   fi
 
   if [[ -n "$file" ]] && _wanted targets; then
-    tmp=(
-          $(awk '/^[a-zA-Z0-9][^\/\t]+:/ {print $1}
+    if [[ "$words[CURRENT]" = *gmake ]] || grep '^include ' "$file" >&/dev/null; then
+      tmp=( $(make -nsp --no-print-directory -f "$file" | awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}' FS=:) )
+    else
+      tmp=(
+            $(awk '/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}
  	      /^\.include  *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include  *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ {
  	        print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \
  	     FS=: $file)
-         )
+           )
+    fi
     _all_labels targets expl 'make target' compadd "$tmp[@]" && return 0
   fi
   compset -P 1 '*='

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


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

* Re: RPM completion in dev19 and a suggested change to make completion
  2000-04-07 11:19 RPM completion in dev19 and a suggested change to make completion Francis GALIEGUE
  2000-04-07 11:51 ` Andrej Borsenkow
  2000-04-07 16:55 ` Bart Schaefer
@ 2000-04-07 16:55 ` Bart Schaefer
  2000-04-07 19:10 ` Chmouel Boudjnah
  3 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2000-04-07 16:55 UTC (permalink / raw)
  To: Francis GALIEGUE, zsh-users

On Apr 7,  1:19pm, Francis GALIEGUE wrote:
} Subject: RPM completion in dev19 and a suggested change to make completion
}
} I'm not au fait enough to do it by myself, but a suggestion for rpm
} would be that it does not look into the RPM database if the -p
} <package> option is specified, as it only applies to files. Is this
} done in -dev20? Haven't had a look at it yet.

It's done in -dev-21.  It tries to complete .rpm files or ftp URLs.

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


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

* Re: RPM completion in dev19 and a suggested change to make completion
  2000-04-07 11:19 RPM completion in dev19 and a suggested change to make completion Francis GALIEGUE
                   ` (2 preceding siblings ...)
  2000-04-07 16:55 ` RPM completion in dev19 and a " Bart Schaefer
@ 2000-04-07 19:10 ` Chmouel Boudjnah
  3 siblings, 0 replies; 9+ messages in thread
From: Chmouel Boudjnah @ 2000-04-07 19:10 UTC (permalink / raw)
  To: Francis GALIEGUE; +Cc: zsh-users

Francis GALIEGUE <francis@mandrakesoft.com> writes:

> I'm not au fait enough to do it by myself, but a suggestion for rpm
> would be that it does not look into the RPM database if the -p
> <package> option is specified, as it only applies to files. Is this

Humm :

--=-=-=
From: Chmouel Boudjnah <chmouel@mandrakesoft.com>
Subject: PATCH: _rpm and locale file
To: zsh-workers@sunsite.auc.dk
Date: 31 Mar 2000 12:40:10 -0800

rpm -qp* is always locale files :

--- zsh-3.1.6-dev-20/Completion/Linux/_rpm.chmou        Wed Mar 22 15:07:53 2000
+++ zsh-3.1.6-dev-20/Completion/Linux/_rpm      Fri Mar 31 13:37:09 2000
@@ -102,7 +102,7 @@
       '--dbpath:RPM database path:_files -/' \
       '--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' \
+      '-p+[specify uninstalled package file to query]:*:RPM package file:->package_file' \
       '--triggeredby:RPM package:->package' \
       '--whatprovides:RPM capability:->capability' \

--=-=-=

-- 
MandrakeSoft Inc                http://www.mandrakesoft.com
Pasadena, CA USA                                  --Chmouel


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

* Re: suggested change to make completion
  2000-04-07 16:55 ` Bart Schaefer
@ 2000-04-10 15:02   ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2000-04-10 15:02 UTC (permalink / raw)
  To: zsh-users; +Cc: Francis GALIEGUE

On Fri, 7 Apr 2000, Bart Schaefer wrote:

> On Apr 7,  1:19pm, Francis GALIEGUE wrote:
> } Subject: RPM completion in dev19 and a suggested change to make completion
> }
> } The other suggestion I have is to allow make completion to take GNU
> } make in acknowledgement:
> [...]
> } With this, for example, make <TAB> in the kernel sources "sees" target
> } bzImage while it doesn't see it in the original version. Comments?
> 
> how about the following (not committed to SourceForge due to controversy).
> 
> [Patch using "make -pns" was here.]

Don't use my patch as it was.  I forgot that "make -n" may still invoke
recursive makes.  There needs to be a nonexistent target as an argument to
keep e.g. the zsh "make" from running for several minutes.


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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-07 11:19 RPM completion in dev19 and a suggested change to make completion Francis GALIEGUE
2000-04-07 11:51 ` Andrej Borsenkow
2000-04-07 12:45   ` Francis GALIEGUE
2000-04-07 12:50     ` Andrej Borsenkow
2000-04-07 13:26       ` Francis GALIEGUE
2000-04-07 16:55 ` Bart Schaefer
2000-04-10 15:02   ` Bart Schaefer
2000-04-07 16:55 ` RPM completion in dev19 and a " Bart Schaefer
2000-04-07 19:10 ` Chmouel Boudjnah

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).