From owner-freebsd-ports@FreeBSD.ORG Thu Aug 10 14:05:35 2006 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1EAF016A509; Thu, 10 Aug 2006 14:05:35 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7455C43D70; Thu, 10 Aug 2006 14:05:34 +0000 (GMT) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net ([12.207.12.9]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20060810140533m910086hbte>; Thu, 10 Aug 2006 14:05:33 +0000 Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.13.6/8.13.6) with ESMTP id k7AE5UgF020838; Thu, 10 Aug 2006 09:05:31 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.13.6/8.13.6/Submit) id k7AE5UgP020837; Thu, 10 Aug 2006 09:05:30 -0500 (CDT) (envelope-from brooks) Date: Thu, 10 Aug 2006 09:05:29 -0500 From: Brooks Davis To: G?bor K?vesd?n Message-ID: <20060810140529.GB20275@lor.one-eyed-alien.net> References: <17626.25183.846983.515718@gromit.timing.com> <17626.25444.563099.956775@gromit.timing.com> <44DA6FC9.3040404@FreeBSD.org> <17626.29481.909830.326948@gromit.timing.com> <17626.30422.650339.960580@gromit.timing.com> <20060810132105.GA20275@lor.one-eyed-alien.net> <44DB33D2.4070308@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lEGEL1/lMxI0MVQ2" Content-Disposition: inline In-Reply-To: <44DB33D2.4070308@FreeBSD.org> User-Agent: Mutt/1.5.11 Cc: Brooks Davis , ports@FreeBSD.org, John E Hein Subject: Re: support for DESTDIR: security/openssh-portable 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: Thu, 10 Aug 2006 14:05:35 -0000 --lEGEL1/lMxI0MVQ2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 10, 2006 at 03:25:38PM +0200, G?bor K?vesd?n wrote: > Brooks Davis wrote: > >On Wed, Aug 09, 2006 at 05:59:18PM -0600, John E Hein wrote: > > =20 > >>John E Hein wrote at 17:43 -0600 on Aug 9, 2006: > >> > Well, the part that makes it annoying to duplicate in all ports is n= ot > >> > the two separate words (CHROOT DESTDIR), but that you have to test > >> > defined(DESTDIR) && !empty(DESTDIR) before you can figure out whether > >> > to use ${CHROOT} ${DESTDIR} or not. > >> >=20 > >> > So having that test to assign CHROOTDESTDIR or leave it empty in > >> > bsd.port.mk allows the port writer to just always invoke it without > >> > having to worry about testing for DESTDIR. > >> > >>You could pass this var to pkg-install scripts, too (put it in the > >>standard *SUB* lists). > >> > >>That way you don't have to do the dance that was added to > >>security/clamav/files/pkg-install.in: > >> > >>if [ -n "%%DESTDIR%%" ]; then > >> PW=3D"/usr/sbin/chroot %%DESTDIR%% pw" > >> CHOWN=3D"/usr/sbin/chroot %%DESTDIR%% chown" > >> MKDIR=3D"/usr/sbin/chroot %%DESTDIR%% mkdir -p" > >>else > >> PW=3D"pw" > >> CHOWN=3D"chown" > >> MKDIR=3D"mkdir -p" > >>fi > >> > >>but rather just: > >> > >>PW=3D"%%CHROOTDESTDIR%% pw" > >>CHOWN=3D"%%CHROOTDESTDIR%% chown" > >>MKDIR=3D"%%CHROOTDESTDIR%% mkdir -p" > >> =20 > > > >This seems bogus. I can't think of any good reason why packages should > >differ based on the valid of DESTDIR. Instead the pkg-install script > >should be run inside the chroot. > > > >-- Brooks > > =20 > We wanted to go that way with garga when working on security/clamav, but= =20 > we realized that we can't just do chroot /foo pkg-install, since the=20 > script is not located in the chroot itself. Do you have an another idea,= =20 > how to chroot those scripts? My inclination would be something like: PKG_INSTALL_TEMP=3D`mktemp ${DESTDIR}/tmp/pkg_install` && \ (${CAT} ${PKG_INSTALL} > ${PKG_INSTALL_TEMP}; \ ${SH} ${PKG_INSTALL_TEMP}; \ ${RM} ${PKG_INSTALL_TEMP}) I think we should ideally introduce a feature to allow ports to automatically run pkg-install and stuff the code in bsd.port.mk so ports don't have to know about DESTDIR in this case. Actually, ports where pkg-install and the pre/post-install targets duplicate code (often slightly differently) drive me nuts so I'd prefer a NO_AUTOPKGINSTALL, but that would take some real work so a positive flag is probably better initially. -- Brooks --lEGEL1/lMxI0MVQ2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFE2z0oXY6L6fI4GtQRAn+IAJ9Sq5TEKcEVxBJ4mjujSI9luWx+AgCePpnl op3oX2gv0z2Lgsk77wo9qAU= =6C7o -----END PGP SIGNATURE----- --lEGEL1/lMxI0MVQ2--