From owner-freebsd-ports@FreeBSD.ORG Mon Oct 7 09:29:51 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0E66EF22 for ; Mon, 7 Oct 2013 09:29:51 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: from mail-qe0-x236.google.com (mail-qe0-x236.google.com [IPv6:2607:f8b0:400d:c02::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C6A94216A for ; Mon, 7 Oct 2013 09:29:50 +0000 (UTC) Received: by mail-qe0-f54.google.com with SMTP id 1so1218896qec.27 for ; Mon, 07 Oct 2013 02:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xw5DbgTHodxhpDIxsaau3qBwC4rWkuXGzMtEMPZU11M=; b=SZIzw0C0bwm21VOIsx+MnUCjZ0QFZT+/M8rMoC8c30q+dm8nh87G/JVV34yn1tub+x 8LSKa5a8eaUOaiZ5hazeHXrzijp3/9X1gXA1m4lhTdH+T4/3/T9RWsFzc6Fs9NWDR199 Nl0YrFh1iw/xRKW1S22hfqAM1IZBAoDQGyE/Tx8mZ7RQu4rvDScqgUGLE9n5eC89D0pv IMGRocU9kKhGPLM81MZZEzTMowu+C4WtEhsJmwnVOSGLBxMheCqzzVbdpaUUcm0wpiFz SnAFA4bYXBu6rUfi5TsJdjiQxoDn41lH9/7uY6oFhjZfVH4tU0JqMr2dcuKXDG2FyI3d Rmpw== MIME-Version: 1.0 X-Received: by 10.49.35.179 with SMTP id i19mr32036374qej.5.1381138189907; Mon, 07 Oct 2013 02:29:49 -0700 (PDT) Received: by 10.224.204.74 with HTTP; Mon, 7 Oct 2013 02:29:49 -0700 (PDT) In-Reply-To: <201310070923.r979Nra2043025@mech-cluster241.men.bris.ac.uk> References: <524DD8C6.8060602@infracaninophile.co.uk> <201310070923.r979Nra2043025@mech-cluster241.men.bris.ac.uk> Date: Mon, 7 Oct 2013 12:29:49 +0300 Message-ID: Subject: Re: Explain staging From: Kimmo Paasiala To: mexas@bris.ac.uk Content-Type: text/plain; charset=UTF-8 Cc: freebsd-ports X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list 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:29:51 -0000 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