Why do we declare this static here? Other systems set plist entries relative to @LOCALBASE@ or $PREFIX or something relative. We have -L, but it won't actually permit for changes to binary packages at install time.

I've got a system similar to:

/sandbox
$USR_ROOT = /sandbox/usr_root
$RD_ROOT = /sandbox/rd_root

These file systems must be parallel in a build environment heirachy. They cannot be a heirachy of each other (temp MFS mounts, chroot, disk space estimation code, etc.).

So essentially:

case $platform in
        openbsd*|freebsd*)
         PKG_DIRNAME=local
         ;;
        netbsd*)
         PKG_DIRNAME=pkg
         ;;
esac

Then:
        PKG_LIST="bash-3.2 libiconv-1.9.2p3 expat-2.0.0\
        gettext-0.14.6"

        export PKG_PATH=/usr/ports/packages/i386/all
        export PKG_DBDIR=${RD_ROOT}/var/db/pkg/
        export PKG_DESTDIR=${USR_ROOT}/${PKG_DIRNAME}
        export LOCALBASE=${USR_ROOT}/${PKG_DIRNAME}

        pkg_add -L / -f libdepends $PKG_LIST

This approach (different pkg_add(8) flags works fine in NetBSD/FreeBSD, but that's because they rely on $PREFIX being inherited from the environment.

But:

obsd# pkg_add -L / -v -f libdepend bash-3.2 libiconv-1.9.2p3 expat-2.0.0

Localbase mismatch: package has: /usr/local , user wants: /
/usr/sbin/pkg_add: bash-3.2:Fatal error

However, I *can* do:

# pkg_add -{B,Q} $PKG_DESTDIR -v -f libdepend [packages]

But I'll end up with:

/sandbox/usr_root/usr/local/_/usr/local/{bin,lib,etc.}_

In theory, following the OpenBSD ports approach, I would set $PKG_DESTDIR to /sandbox; and symlink usr_root/ to usr/, but that's dangerous because /sandbox/usr_root is an entirely arbitrary path that the user can set (and it may be a symlink itself)

I'll work-around this limitation for now by telling pax(1) to use:

cd ${USR_ROOT}/${PKG_DIRNAME}/usr/local/ && pax [flags] when $platform = openbsd.

But that's cheap and dirty....there areally are some nasty assumptions flying around in the current approach that are not conducive to building embedded systems where you're assembling your desination file system on a build host.

Another nasty one is checking for libc dependency (and presumably by implication a specific minimum OpenBSD version) in packages. Of course, I can work around that with -f libdepends ... but this is a whole new issue.

One approach I may try to take to solve this problem is to forgoe "make package" and use pkg_create(1) with a varety of flags, but that doesn't look very promising right now.


l8*
        -lava (Brian A. Seklecki - Pittsburgh, PA, USA)
               http://www.spiritual-machines.org/

Reply via email to