Subject: Re: pkg/29216
To: Alistair Crooks <agc@pkgsrc.org>
From: HIRAMATSU Yoshifumi <hiramatu@boreas.dti.ne.jp>
List: pkgsrc-bugs
Date: 02/16/2005 02:26:14
At Fri, 11 Feb 2005 17:35:23 +0000,
Alistair Crooks <agc@pkgsrc.org> wrote:
> > From: HIRAMATSU Yoshifumi <hiramatu@boreas.dti.ne.jp>
> > To: gnats-bugs@NetBSD.org
> > Cc: 
> > Subject: Re: pkg/29216
> > Date: Fri, 11 Feb 2005 14:15:58 +0900
> > 
> >  This patch replaces hard coded "grep" to ${GREP}. Does this fix this problem?
> >  
> >  --- bsd.pkg.mk.orig     Fri Feb 11 14:05:44 2005
> >  +++ bsd.pkg.mk  Fri Feb 11 14:08:31 2005
> >  @@ -1163,7 +1163,7 @@
> >   .  for def in ${EVAL_PREFIX}
> >   .    if !defined(${def:C/=.*$//})
> >   ${def:C/=.*$//}_DEFAULT?=${LOCALBASE}
> >  -_${def:C/=.*$//}_CMD=  ${PKG_INFO} -qp ${def:C/^.*=//} 2>/dev/null | ${AWK} '{ print $$2; exit }' | grep '' || ${ECHO} ${${def:C/=.*$//}_DEFAULT}
> >  +_${def:C/=.*$//}_CMD=  ${PKG_INFO} -qp ${def:C/^.*=//} 2>/dev/null | ${AWK} '{ print $$2; exit }' | ${GREP} '' || ${ECHO} ${${def:C/=.*$//}_DEFAULT}
> >   ${def:C/=.*$//}=       ${_${def:C/=.*$//}_CMD:sh}
> >   MAKEFLAGS+=            ${def:C/=.*//}=${_${def:C/=.*$//}_CMD:sh}
> >   .    endif
> >  
> 
> Just a quick question - why use grep at all here - surely we can
> do the test just as easily in the AWK stage just prior to that?

It seems that the behaviour of "grep ''" is the same as "cat"; copy all input
to stdout. Can we simply remove the grep part?

-_${def:C/=.*$//}_CMD=  ${PKG_INFO} -qp ${def:C/^.*=//} 2>/dev/null | ${AWK} '{ print $$2; exit }' | grep '' || ${ECHO} ${${def:C/=.*$//}_DEFAULT}
+_${def:C/=.*$//}_CMD=  ${PKG_INFO} -qp ${def:C/^.*=//} 2>/dev/null | ${AWK} '{ print $$2; exit }' || ${ECHO} ${${def:C/=.*$//}_DEFAULT}

After I applied above change, I tried "make package" in databases/php-mysql,
which defines EVAL_PREFIX in its Makefile, and successfully finished.

-- 
// HIRAMATSU Yoshifumi
// hiramatu@boreas.dti.ne.jp