[csw-maintainers] Strange behaviour when depend file gets created

Ben Walton bwalton at opencsw.org
Mon Mar 9 14:19:04 CET 2009


Excerpts from William Bonnet's message of Mon Mar 09 05:16:19 -0400 2009:
> I submitted a patch yesterday. I hope i did not broke it. I tested it 
> before and noticed the same behavior... anyways, you can try to revert 
> to revision 3289 of file csw/mgar/gar/v2/gar.pkg (
> http://gar.svn.sourceforge.net/viewvc/gar/csw/mgar/gar/v2/gar.pkg.mk?view=log 
> ) since it affect depend generation and try again please


The following test Makefile demonstrates the problem with the change:

--snip--
PKG ?= CSWcommon

showinf:
        echo "$(shell /usr/bin/pkginfo $(PKG) || echo "P $(PKG) - " | awk '{$$1 = "P"; print }')"
--snip--

Calling gmake with no args gives:
$ gmake
echo "system      CSWcommon common - common files and dirs for CSW packages"
system      CSWcommon common - common files and dirs for CSW packages

Calling gmake with PKG=CSWfoo gives:
$ gmake PKG=CSWfoo
ERROR: information for "CSWfoo" was not found
echo "P CSWfoo -"
P CSWfoo -

The following small change should do what is required:

        echo "$(shell (/usr/bin/pkginfo $(PKG) || echo "P $(PKG) - ") | awk '{$$1 = "P"; print }')"

Notice the bracketing around the pkginfo/echo pair.  You want the
output of whichever is sucessful to get piped to awk, not just the
output of the echo if pkginfo fails.

-Ben
-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.opencsw.org/pipermail/maintainers/attachments/20090309/65edb8e2/attachment-0001.asc>


More information about the maintainers mailing list