From owner-freebsd-ports@FreeBSD.ORG Mon Oct 7 09:37:53 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6CB38364 for ; Mon, 7 Oct 2013 09:37:53 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from eu1sys200aog102.obsmtp.com (eu1sys200aog102.obsmtp.com [207.126.144.113]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0099B2207 for ; Mon, 7 Oct 2013 09:37:50 +0000 (UTC) Received: from mail-we0-f169.google.com ([74.125.82.169]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKUlKA58j9U/8U7NBvmbHVQKsj/ezi1BBO@postini.com; Mon, 07 Oct 2013 09:37:51 UTC Received: by mail-we0-f169.google.com with SMTP id q58so1550096wes.0 for ; Mon, 07 Oct 2013 02:37:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:message-id:to:subject:cc :reply-to:in-reply-to; bh=6EkrZAxPu88JkvUDfcCrfppfJaR2Oo98AoBeLUPA+8s=; b=a2vayDwxWiHj0q0YKX532NXXEu2RbeJz4MaUyMPPGNxBPRp2toLEAumNmeByz1H1Gn F8lK3Ksp6CojU3+Z2R6v7CCWgAsCcJzRdyiJN/pe6oilropni936qIVHTySNmuliFSHN w8LQFOpRSaS8kjC/p5sJXzEb4pBJH/ojOPWuFP/8n6ajtbExesbuS9SbT5dA7TMxcbZD ShZNgouvBai0SMDMU+6P7DlvtHVVlQGgpcxrGSKDQFR5JDMwaLarcJeqdFfqzlXzEg3v 0gJDzkW0934bNXXvBUMpjjNaQbfhM428Yu6MEa6sgCzJgckw2xXjUoVi6BXSMZQW8Urw 3PEA== X-Gm-Message-State: ALoCoQkPAYePLlj3THoJ/lb+RJPB9XJzK82FbCn0ltVDG9XNASGSTkT6rr3IPfmz4bD/yCvjQNF3zAzXKsrFAj0i0Gd+zGypSU4ws4MVaSCL2Dbw6/zU2kC06B3ZOGaXQvBvVOVHTz+aMjYRxTC/gIHsOOtCXxKJmLmpWOD6jZO8Z85EgEk9Hu4= X-Received: by 10.181.12.75 with SMTP id eo11mr17904549wid.24.1381138657943; Mon, 07 Oct 2013 02:37:37 -0700 (PDT) X-Received: by 10.181.12.75 with SMTP id eo11mr17904542wid.24.1381138657857; Mon, 07 Oct 2013 02:37:37 -0700 (PDT) Received: from mech-cluster241.men.bris.ac.uk (mech-cluster241.men.bris.ac.uk. [137.222.187.241]) by mx.google.com with ESMTPSA id ev4sm19528288wib.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2013 02:37:36 -0700 (PDT) Sender: Anton Shterenlikht Received: from mech-cluster241.men.bris.ac.uk (localhost [127.0.0.1]) by mech-cluster241.men.bris.ac.uk (8.14.7/8.14.6) with ESMTP id r979bY37043287 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 7 Oct 2013 10:37:34 +0100 (BST) (envelope-from mexas@mech-cluster241.men.bris.ac.uk) Received: (from mexas@localhost) by mech-cluster241.men.bris.ac.uk (8.14.7/8.14.6/Submit) id r979bY2e043286; Mon, 7 Oct 2013 10:37:34 +0100 (BST) (envelope-from mexas) Date: Mon, 7 Oct 2013 10:37:34 +0100 (BST) From: Anton Shterenlikht Message-Id: <201310070937.r979bY2e043286@mech-cluster241.men.bris.ac.uk> To: kpaasial@gmail.com, mexas@bris.ac.uk Subject: Re: Explain staging In-Reply-To: Cc: freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: mexas@bris.ac.uk List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2013 09:37:53 -0000 >From kpaasial@gmail.com Mon Oct 7 10:32:26 2013 > >On Mon, Oct 7, 2013 at 12:23 PM, Anton Shterenlikht wrote: >>>From: Matthew Seaman >>>To: freebsd-ports@freebsd.org >>>Subject: Re: Explain staging >>> >>>On 03/10/2013 08:56, Anton Shterenlikht wrote: >>>> sorry, I still don't get it. >>>> What is achived by staging? >>> >>>There are 4 main advantages: >>> >>> 1) You can build a port and then create a package from the stage >>> directory without having to install it on your build system. You >>> usually don't need root privileges to do this. >> >> What about "make fetch"? It puts files by default under >> ports/distfiles, which, by default, is 755: >> >> $ make fetch >> ===> xearth-1.2 depends on file: /usr/local/sbin/pkg - found >> => xearth-1.2.tar.xz doesn't seem to exist in /usr/ports/distfiles/. >> => /usr/ports/distfiles is not writable by you; cannot fetch. >> *** Error code 1 >> >> Stop. >> make: stopped in /usr/ports/astro/xearth >> $ >> >> What about "make extract"? Same problem: >> >> $ make extract >> ===> xearth-1.2 depends on file: /usr/local/sbin/pkg - found >> ===> Fetching all distfiles required by xearth-1.2 for building >> ===> Extracting for xearth-1.2 >> => SHA256 Checksum OK for xearth-1.2.tar.xz. >> mkdir: /usr/ports/astro/xearth/work: Permission denied >> *** Error code 1 >> >> Stop. >> make: stopped in /usr/ports/astro/xearth >> $ >> >> "make checksum" works, of course, because no files are >> created: >> >> $ make checksum >> ===> xearth-1.2 depends on file: /usr/local/sbin/pkg - found >> ===> Fetching all distfiles required by xearth-1.2 for building >> => SHA256 Checksum OK for xearth-1.2.tar.xz. >> $ >> >> Then "make stage" fails again: >> >> $ make stage >> ===> Patching for xearth-1.2 >> touch: /usr/ports/astro/xearth/work/.patch_done.xearth._usr_local: Permission denied >> *** Error code 1 >> >> Stop. >> make: stopped in /usr/ports/astro/xearth >> $ >> >> So I make it under root. >> Then "make check-orphans" fail: >> >> $ make check-orphans >> cannot create /usr/ports/astro/xearth/work/.expanded-plist: Permission denied >> *** Error code 2 >> >> Stop. >> make: stopped in /usr/ports/astro/xearth >> $ >> >> Finally, "make package" fails: >> >> $ make package >> ===> Building package for xearth-1.2 >> mkdir: /usr/ports/astro/xearth/work/.metadir: Permission denied >> *** Error code 1 >> >> Stop. >> make: stopped in /usr/ports/astro/xearth >> $ >> >> I'm probably missing something important here. >> The wiki page only says: "Make sure you tested >> make package as a normal user (not root). >> If that fails, add NEED_ROOT in the port. " >> Why would it not fail? >> >> Do I need to set up separate distfiles directory, >> or something like this? >> >>> 2) Instead of (typically) just running the install target of the >>> piece of software, and then trusting that the pkg-plist contains >>> an accurate list of what gets installed, now we take the pkg-plist >>> and extract the matching items from the stage directory to make a >>> package. Only things on the plist get installed, and things on >>> the plist but not present in the staging dir will flag up as an >>> error in the port. >> >> This is not clear either. >> I my port I have: >> >> PLIST_FILES= bin/xearth \ >> lib/X11/xearth/freebsd.committers.markers \ >> lib/X11/xearth/freebsd.ftp.markers >> PLIST_DIRS= lib/X11/xearth >> >> I don't have pkg-plist at all. >> What do I need to change? >> >>>If you have an instruction in you port to install a file from the build >>>area into the filesystem under ${PREFIX} =3D /usr/local then you need to >>>change it to install to ${STAGEDIR}${PREFIX}/whatever. Note: this only >>>applies to the *install* parts: when building the package, you should >>>configure it for the eventual final install location under /usr/local. >> >> Does this look right: >> >> do-install: >> @${INSTALL_PROGRAM} ${WRKSRC}/xearth ${STAGEDIR}${PREFIX}/bin >> @${INSTALL_MAN} ${WRKSRC}/xearth.man ${MANPREFIX}/man/man1/xearth.1 >> @${MKDIR} ${STAGEDIR}${PREFIX}/lib/X11/xearth >> # Copy the list of FreeBSD sites & committers locations >> .for marker in freebsd.committers.markers freebsd.ftp.markers >> @${INSTALL_DATA} ${FILESDIR}/${marker} ${STAGEDIR}${PREFIX}/lib/X11/xearth >> .endfor >> >> Many thanks >> >> Anton >> > >Set DISTDIR in make.conf to for example /home/memyself/distfiles and >move the existing distfiles there. There's no reasonable default for >DISTDIR I think if it's assumed that fetch operates as non-root. > >-Kimmo sure, I can do /tmp/distfiles too. But that doesn't help with all the other failing targets. Then I might as well "chown -R user:group /usr/ports" and update the ports tree as an unprivileged user too. HOwever, security would suffer, I think. And, anyway, this would be a major change. If this were the case, it should be much better documented, I think. Thanks Anton