Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2007 17:17:29 +0100
From:      Fabian Keil <freebsd-listen@fabiankeil.de>
To:        Gabor Kovesdan <gabor@FreeBSD.org>
Cc:        ports@FreeBSD.org
Subject:   Re: Optionally depending on one of two ports (or none of them)
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>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig__=QPJrSqQu.i+3SsUrFRmac
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Gabor Kovesdan <gabor@FreeBSD.org> wrote:

> Fabian Keil schrieb:
> > Gabor Kovesdan <gabor@FreeBSD.org> 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 <bsd.port.pre.mk>

.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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070225171729.41a050d6>