From owner-freebsd-ports@FreeBSD.ORG Sun Feb 25 16:17:42 2007 Return-Path: X-Original-To: ports@FreeBSD.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D85716A402 for ; Sun, 25 Feb 2007 16:17:42 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [80.67.18.14]) by mx1.freebsd.org (Postfix) with ESMTP id 5F25613C4AC for ; Sun, 25 Feb 2007 16:17:41 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: (qmail 1643 invoked from network); 25 Feb 2007 16:17:39 -0000 Received: from unknown (HELO localhost) (775067@[217.50.146.89]) (envelope-sender ) by smtprelay02.ispgateway.de (qmail-ldap-1.03) with SMTP for ; 25 Feb 2007 16:17:39 -0000 Date: Sun, 25 Feb 2007 17:17:29 +0100 From: Fabian Keil To: Gabor Kovesdan Message-ID: <20070225171729.41a050d6@localhost> In-Reply-To: <45E06810.1070704@FreeBSD.org> References: <20070222141301.007fee4f@localhost> <45DDA117.3050508@FreeBSD.org> <20070224163229.062bd234@localhost> <45E06810.1070704@FreeBSD.org> X-Mailer: Claws Mail 2.6.1 (GTK+ 2.10.9; i386-portbld-freebsd6.2) X-PGP-KEY-URL: http://www.fabiankeil.de/gpg-keys/freebsd-listen-2008-08-18.asc Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig__=QPJrSqQu.i+3SsUrFRmac"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Cc: ports@FreeBSD.org Subject: Re: Optionally depending on one of two ports (or none of them) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Feb 2007 16:17:42 -0000 --Sig__=QPJrSqQu.i+3SsUrFRmac Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Gabor Kovesdan wrote: > Fabian Keil schrieb: > > Gabor Kovesdan wrote: > > =20 > > > >> What about grepping in the output of pkg_info? Or even better just=20 > >> grepping in ls ${PKG_DBDIR} to determine which one is installed and=20 > >> adding the appropriate dependency. =20 > > Are you aware of ports that already do that? > > > > I grepped around a bit but didn't find any, > > and as my make knowledge is rather limited > > it sounds like too much work to be worth it. > No, but I made an example for you, you can use this: >=20 > HAVE_TOR_DEVEL!=3D if ls /var/db/pkg | grep tor-devel-\* >/dev/nul= l=20 > 2>&1 ; then echo YES; fi; Thanks a lot. > Or you can make it better by giving a knob for selecting the default. I added knobs and used pkg_info as suggested by Matthew to make sure PKG_DBDIR is honoured: OPTIONS=3D TOR_DEVEL "Depend on tor-devel" On \ TOR "Depend on tor" Off [...] #HAVE_TOR_DEVEL!=3D if ls /var/db/pkg | grep ^tor-devel-[[:digit:]] >/dev/n= ull 2>&1 ; then echo YES; fi HAVE_TOR_DEVEL!=3D if pkg_info -I tor-devel\* >/dev/null 2>&1 ; then ${ECHO= } YES; fi .if (${HAVE_TOR_DEVEL} =3D=3D "YES") OPTIONS=3D TOR_DEVEL "Depend on tor-devel (already installed)" On .else #HAVE_TOR!=3D if ls /var/db/pkg | egrep ^tor-[[:digit:]] >/dev/null 2>&1 ; = then echo YES; fi HAVE_TOR_DEVEL!=3D if pkg_info -I tor-\* >/dev/null 2>&1 ; then ${ECHO} YES= ; fi .endif .if (defined(HAVE_TOR) && ${HAVE_TOR} =3D=3D "YES") OPTIONS=3D TOR "Depend on tor (already installed)" On .endif .include .if defined(WITH_TOR_DEVEL) .if defined(WITH_TOR) IGNORE=3D cannot depend on tor and tor-devel at the same time .endif RUN_DEPENDS+=3D ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor-devel .elif defined(WITH_TOR) RUN_DEPENDS+=3D ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor .endif It happens to work, but causes two new portlint warnings: fk@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? Fabian --Sig__=QPJrSqQu.i+3SsUrFRmac Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFF4bagBYqIVf93VJ0RAppjAKCaPbQm00s1Z6n2p/z5/7bS2xAoUACgsTe/ /ZOmjGgi/aZE9PKAiKYljDY= =8TM6 -----END PGP SIGNATURE----- --Sig__=QPJrSqQu.i+3SsUrFRmac--