Explain staging

Kimmo Paasiala kpaasial at gmail.com
Mon Oct 7 09:29:51 UTC 2013


On Mon, Oct 7, 2013 at 12:23 PM, Anton Shterenlikht <mexas at bris.ac.uk> wrote:
>>From: Matthew Seaman <m.seaman at infracaninophile.co.uk>
>>To: freebsd-ports at 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


More information about the freebsd-ports mailing list