Optionally depending on one of two ports (or none of them)

Fabian Keil freebsd-listen at fabiankeil.de
Mon Feb 26 11:10:31 UTC 2007


[CC'ing ports@ again]

Gabor Kovesdan <gabor at FreeBSD.org> wrote:

> Fabian Keil escribió:
> > Gabor Kovesdan <gabor at FreeBSD.org> wrote:

> >> Fabian Keil schrieb:
> >>     
> >>> Gabor Kovesdan <gabor at FreeBSD.org> wrote:

> >>> I added knobs and used pkg_info as suggested by Matthew
> >>> to make sure PKG_DBDIR is honoured:
[...]
> >>> #HAVE_TOR_DEVEL!= if ls /var/db/pkg | grep ^tor-devel-[[:digit:]] >/dev/null 2>&1 ; then echo YES; fi
> >>> HAVE_TOR_DEVEL!= if pkg_info -I tor-devel\* >/dev/null 2>&1 ; then ${ECHO} YES; fi
> >>> .if (${HAVE_TOR_DEVEL} == "YES")
> >>> OPTIONS=	TOR_DEVEL	"Depend on tor-devel (already installed)"	On
> >>> .else
> >>> #HAVE_TOR!= if ls /var/db/pkg | egrep ^tor-[[:digit:]] >/dev/null 2>&1 ; then echo YES; fi
> >>> HAVE_TOR_DEVEL!= if pkg_info -I tor-\* >/dev/null 2>&1 ; then ${ECHO} YES; fi
> >>> .endif
> >>> .if (defined(HAVE_TOR) && ${HAVE_TOR} == "YES")
> >>> OPTIONS=	TOR		"Depend on tor (already installed)"	On
> >>> .endif
> >>>
> >>> .include <bsd.port.pre.mk>
> >>>
> >>> .if defined(WITH_TOR_DEVEL)
[...]

> >>> It happens to work, but causes two new portlint warnings:
> >>>
> >>> fk at TP51 /usr/ports/security/dns-proxy-tor $portlint .
> >>> WARN: Makefile: [28]: possible direct use of command "pkg_info" found. use ${PKG_INFO} instead.
> >>> WARN: Makefile: [33]: possible direct use of command "pkg_info" found. use ${PKG_INFO} instead.
> >>> WARN: Makefile: using hyphen in PORTNAME. consider using PKGNAMEPREFIX and/or PKGNAMESUFFIX.
> >>> 0 fatal errors and 3 warnings found.
> >>>
> >>> Unfortunately the suggestion is bogus as ${PKG_INFO} isn't set that early.
> >>> Can I just ignore the warnings, or is there a way around this?

> >> What if you include bsd.port.pre.mk before this check? Will that 
> >> conflict with OPTIONS? I'm not sure about this.
> >>     
> >
> > I doesn't seem to conflict with OPTIONS, but it doesn't work either.
> >
> > .include <bsd.port.pre.mk>
> > HAVE_TOR_DEVEL!= if ${PKG_INFO} -I tor-devel\* >/dev/null 2>&1 ; then ${ECHO} YES; fi
> >
> > still leads to "-I: not found".
> >   
> It works then, but it seems you cannot use make vars in the if statement 
> of != expansions, I ran into the same. Does ECHO work? Please use 
> ECHO_CMD instead, it should be used for command pipelineing, stream 
> redirections, etc. while ECHO_MSG shoud be used to display informative 
> output for the user.

${ECHO} works without problems, and I just noticed that
${PKG_INFO} works for "=", but seems to fail for "!=" in general:

Using:

IGNORE= ${ECHO_CMD} ${PKG_INFO} ${ECHO_CMD}

leads to the expected:

===>  dns-proxy-tor-0.1.0 echo /usr/sbin/pkg_info echo.
*** Error code 1

Whereas:

IGNORE!= ${ECHO_CMD} ${PKG_INFO} ${ECHO_CMD}

leads to:

===>  dns-proxy-tor-0.1.0 echo.
*** Error code 1

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20070226/3efb81fc/signature.pgp


More information about the freebsd-ports mailing list