Subject: Re: How to properly use shell commands that are defined in make(1)
To: None <tech-pkg@netbsd.org, rillig@NetBSD.org>
From: Gilles Dauphin <Gilles.Dauphin@enst.fr>
List: tech-pkg
Date: 11/25/2005 10:53:29
> From: Roland Illig <rillig@NetBSD.org>
>
> 
> Roland Illig wrote:
> > Quite a few shell programs in pkgsrc use commands similar to how they 
> > are used in the pkgsrc Makefiles. As it were much better if the tools 
> > were used not only similar but _equal_ to inside Makefiles, I've written 
> > a quiet little, but useful make(1) target:
> > 
> > sh-define-cmds:
> > .for _c_ in ${CMDS}
> >         @${ECHO} ${_c_:Q}"() { "${${_c_}:Q}" \"\$$@\"; }"
> > .endfor
> 
> Well, this was the naive variant without error checking and the like. 
> The Real One is appended.
> 
> > It looks cryptic, and indeed it is. But its usage is very simple:
> > 
> > $ make sh-define-cmds CMDS=MAKE
> > MAKE() { /usr/bin/make "$@"; }
> > 
> > This output can then be evaluated by a shell script using the "." command.
> 
> Well, it actually can, but the more usual form is via the "eval" utility.
> 
> $ eval "`make sh-define-cmds CMDS=\"MAKE PKG_DELETE PKG_INFO\"`"
> 
> $ type MAKE                      MAKE is a function
> MAKE ()
> {
>      /usr/bin/make "$@"
> }
> 
> $ type PKG_DELETE
> PKG_DELETE is a function
> PKG_DELETE ()
> {
>      /home/roland/pkg/sbin/pkg_delete -K /home/roland/pkg/var/db/pkg "$@"
> }
> 
> Roland

May be, my problem is here:
when i make a bulk build from a clean distrib. i have the following error
in the bulk build log file for gzip-base:

---------------------------------------------------------------------
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> x - extracting 
gzip-1.2.4a/algorith
m.doc (text)
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> x - extracting 
gzip-1.2.4a/gzip.tex
i (text)
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> /bin/ksh[15274]: 
syntax error at li
ne 15275 : `(' unexpected
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> *** Error code 2
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> 
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> Stop.
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> bmake: stopped in 
/usr/pkgsrc/archi
vers/gzip-base
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> *** Error code 1
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> 
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> Stop.
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> bmake: stopped in 
/usr/pkgsrc/archi
vers/gzip-base
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> BULK> 
gzip-base-1.2.4bnb1 was marke
d as broken:
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> -rw-r--r--   1 
root     root       
 3141 Nov 24 14:23 /usr/pkgsrc/archivers/gzip-base/.broken.html
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> 
/usr/pkg/bin/bmake deinstall
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> ===> Deinstalling 
for gzip-base
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> BULK> Marking all 
packages which de
pend upon gzip-base-1.2.4bnb1 as broken:
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> BULK> marking 
package that requires
 gzip-base-1.2.4bnb1 as broken: gzip-1.2.4b (archivers/gzip)
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> grep: can't open 
"/usr/pkgsrc/.broken.html"
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> ===> Cleaning for 
gzip-base-1.2.4bn
b1
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> BULK> Build for 
gzip-base-1.2.4bnb1
 was not successful, aborting.
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> *** Error code 
255
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> 
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> Stop.
2005/11/24 14:23:30  15/5718= 0.3% archivers/gzip-base @ i386> bmake: stopped in 
/usr/pkgsrc/archi
vers/gzip-base
BULK> Package gzip-info-1.2.4a not built yet, packaging...

-----------------------------------------------------------------
Notice the @grep: can't open "/usr/pkgsrc/.broken.html"@
But when i make it by hand with 
cd archivers/gzip-base
bmake package

it works !!!

I have a similar problem making bulk build with audio/nas
------------------------------------------------------------
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> Patching for 
nas-1.7bnb1
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> Applying pkgsrc 
patches for nas-1.7bnb1
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> Overriding tools for 
nas-1.7bnb1
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> Creating toolchain 
wrappers for nas-1.7
bnb1
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> Configuring for 
nas-1.7bnb1
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> /usr/bin/env: No such file 
or directory
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> *** Error code 127
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> 
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> Stop.
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> bmake: stopped in 
/usr/pkgsrc/audio/nas
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> 
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> There was an error 
during the ``configu
re'' phase.
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> Please investigate 
the following for mo
re information:
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===>      * log of the 
build
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===>      * 
/usr/pkgsrc/audio/nas/work/.work
.log
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> 
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> *** Error code 1
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> 
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> Stop.
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> bmake: stopped in 
/usr/pkgsrc/audio/nas
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> BULK> nas-1.7bnb1 was 
marked as broken:
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> -rw-r--r--   1 root     
root        3184 Nov
 24 16:31 /usr/pkgsrc/audio/nas/.broken.html
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> /usr/pkg/bin/bmake 
deinstall
2005/11/24 16:30:46  207/5718= 3.6% audio/nas @ i386> ===> Deinstalling for nas
-----------------------------------------------------------
I think it is a 'white character' problem with the shell in the do-configure
part in bsd.pkg.mk
But when i make audio/nas by hand it works!!!

same problem with 
audio/wmmixer
audio/xcdplayer
audio/xmcd
audio/xmix
audio/xmmix
audio/xwave
biology/rasmol
x11/Xaw3d
x11/xforms
comms/xtel
etc...

Have an idea?

Gilles




------------------------------------------------------------