Search:  
Gentoo Wiki

Portage-prefix

This article is still a Stub. You can help Gentoo-Wiki by expanding it.

The instructions on this page have not kept pace with development and are obsolete. If you are interested in testing the current prototype/work-in-progress, please see Gentoo Prefixed Portage, and Gentoo Prefixed Portage Techdocs in particular.


Contents

About

This is an effort to allow portage to function as a secondary package manager on Linux, OS X, BSD, and Solaris systems. The current additional features are non-root/non-priveleged portage instances, prefixed package installation, and a wider array of non-Gentoo host system support.

DISCLAIMER: This is a prototype/work-in-progress! Its merely a proof of concept and should not be considered stable or an indication of things to come ;)

Requirements

At a bare minimum you will need at least:

OS X Systems require >=10.4.5 and Xcode >=2.1

Installation

Grab the latest portage-prefix snapshot and unpack it to the directory of your choice.

$ mkdir -p ~/portage-prefix/tmp ;cd ~/portage-prefix/tmp
$ curl -O http://gentoo.osuosl.org/experimental/snapshots/portage-alt-prefix-latest.tar.bz2
$ tar xvfj portage-alt-prefix-* && cd portage-alt-prefix-*

The important options to be passed to configure are:

--with-user="username" - This is the user that portage itself will run as. It will default to 'portage'
--with-group="group" - This is the group that portage will belong to. It will default to 'portage'
--with-rootuser="username" - This is the user that will own the files portage installs. It will default to 'root'
--with-wheelgid=0 - This is the group id that installed files will belong to. It will default to '0'
--with-offset-prefix=/ - Specifies the installation prefix for all packages. Defaults to "/"
--prefix=/usr - Specifies the installation prefix for portage itself. Defaults to "/usr"
--sysconfdir=/etc - Where portage will look for configuration files(make.conf and so on). Defaults to "/etc"

So to configure portage to use the current user & group, with a final destination dir of /home/kito/gentoo, we would do:

$ ./configure --with-user=`whoami` --with-group=`id -gn` \
--with-rootuser=`whoami` --with-wheelgid=`id -g` \
--with-offset-prefix=/home/kito/gentoo \
--prefix=/home/kito/gentoo/usr --sysconfdir=/home/kito/gentoo/etc

NOTE: On some solaris systems you will need to tell configure the path to an XCU compatible id(1). On solaris10/opensolaris this in /usr/sfw/bin so add this to the configure args:

XCU_ID=/usr/sfw/bin/id

Then to build and install:

$ make && make install

TODO

make.conf editing, DEFAULT_PATH explanation

Tech Notes

Here are some tips for 'porting' ebuilds to be prefix compliant.

The experimental prefix ebuild repository uses the 'prefix' eapi(ebuild API) to mask ebuilds that are not prefix aware. So, the first thing you'll need to do is tell portage the EAPI near the top of the ebuild after the cvs header, but before any eclass inherits.

# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/tar-1.15.1.ebuild,v 1.17 2005/08/12 08:39:38 flameeyes Exp $

EAPI="prefix"

Most ebuilds that use econf, and the do* utilities will 'just work', but if you do need to manually pass locations to configure, use the ${EPREFIX} variable.

--enable-etcdir=${EPREFIX}/etc/zsh \
--enable-zshenv=${EPREFIX}/etc/zsh/zshenv \
--enable-zlogin=${EPREFIX}/etc/zsh/zlogin \
--enable-zlogout=${EPREFIX}/etc/zsh/zlogout \
--enable-zprofile=${EPREFIX}/etc/zsh/zprofile

The ${ROOT} and ${D} variables in ebuilds will handle ${EPREFIX} transparently. The most frequent change you will need to make is ebuilds that use the DESTDIR=${D} make install target. As ${D} has ${EPREFIX} already appended, this will result in it being appended twice in the final install image. So instead we use the ${EDEST} variable for most make install targets.

Change:

make DESTDIR=${D} install

To:

make DESTDIR=${EDEST} install

TODO

 * bootstrapping uses minimal tools, not built as portage would do
 * bootstrap's stuff causes collision protect errors when updating them
 * portage doesn't know about stuf compiled during bootstrap
 * see section on Bootstrap Ideas

Bootstrap Ideas

Bootstrapping is done using a bootstrap script in ${PORTDIR}/scripts/bootstrap-prefix.sh. This script currently (tries to) build the necessary components to get started with a prefixed portage install. A few problems that become apparent after running the script:

It looks like it is a Good Idea(tm) to let the bootstrap script install its stuff in a temporary directory, then add that directory and those of the host OS's toolchain to the --with-default-path configure of the temporary portage install. After that let portage build its whole system in its prefix.

Going this route, a few questions remain:


Links

Current Prefix Ebuild Tree (Snapshots created daily)
Ebuild Documentation

Related Links

MacPorts
The Fink Project
The Written Word
Netbsd's pkgsrc
CSW (Community Software for Solaris)

Similar works:
Alba Experiment: is an experimental implementation of portage on Solaris as primary package management system

Seems to be broken:
Portaris(portage on solaris)

Retrieved from "http://www.gentoo-wiki.info/Portage-prefix"

Last modified: Mon, 29 Sep 2008 04:59:00 +0000 Hits: 16,852