HOWTO Use prefixed portage (in development)
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
This page is serving as a scratch pad to document the work that Michael Haubenwallner has done on this effort.
The main idea is that one could use portage as a secondary package manager (similar to openpkg or fink on OSX) on any POSIX system. It's also been referred to as prefixed installs since the user will be able to install their system under a directory (or prefix) and thus sandbox it.
Using toolsbox (Michael's own portage-workalike, based on GNU-make and bourne-shell) one can bootstrap portage. After an initial portage is bootstrapped, this instance may bootstrap another.
Contents |
[edit] Bootstrapping portage through toolsbox
[edit] Requirements
- /bin/sh (some bourne shell)
- GNU make >= 3.79
- C compiler
- toolsbox tarball
- portage snapshot (referred to as secondary-portage-snapshot below, which is a small snapshot with 50 packages that will emerge in this environment)
- currently there's no need to run this as root
[edit] Commands to run
create bootstrapped portage-head on recent gentoo-box (this commands are tested on a gentoo linux box as non-root):
$ tar xjf portage-head-20050927.tar.bz2 $ cd portage-head-20050927 $ ./autogen.sh $ ./configure $ make dist-gzip $ make dist $ cd ..
now you have portage-2.1_pre.tar.{gz,bz2}
use toolsbox to create a stage-0 workalike:
$ tar xfj toolsbox-4-20050927.tar.bz2 $ cd toolsbox-4-20050927 $ gmake config PREFIX=/tmp DISTURL=http://www.ibiblio.org/pub/Linux/distributions/gentoo/distfiles portage_BUILDFROM=FETCH $ mkdir -p buildroot/distfiles $ cp ../portage-head-20050927/portage-2.1_pre.tar.gz buildroot/distfiles/ $ touch buildroot/portage/portage.fetched.done $ gmake portage
As portage is installed now, it needs an ebuild-tree and some portage-settings:
$ cbuild=`tmpl/config.guess`
$ cd /tmp/toolsbox-4-patchespre.`date "+%Y%m%d"`/${cbuild}
$ tar xfj secondary-portage-snapshot-20050927.tar.bz2
$ mv secondary-portage-snapshot-20050927 portage
$ cd etc
$ ln -s ../portage/profiles/default-secondary/linux/x86 make.profile
$ cp make.conf.example make.conf
edit make.conf for your needs, escpecially ACCEPT_KEYWORDS="~x86" and GENTOO_MIRRORS
$ cd .. $ for f in ./bin/toolsbox-*-env.sh;do . $f;done
Now some "stage-0" like system is "armed and ready".
[edit] Creating a secondary instance of Portage
$ type emerge $ emerge -av system
As the system is installed now, we don't need toolsbox-env any more:
$ sh toolsbox-clearenv.sh
And we can jump into the secondary portage instance:
$ ./bin/bash (bash)$ source ./etc/profile
Make the secondary portage instance useable for more packages:
(bash)$ binutils-config 1 (bash)$ gcc-config 1 (bash)$ env-update (bash)$ eenv-clear (bash)$ source ./etc/profile
now there's the first secondary-portage instance working, but there are many files left from toolsbox-install, which does not track installed files.
[edit] Creating a "Clean" secondary instance of Portage
[edit] Compile the packages
The packages are compiled by the first instance:
(bash)$ mkdir -p /opt/secondary-portage (bash)$ PREFIX=/opt/secondary-portage emerge -av system
Again set up an ebuild tree and tweak portage settings:
(bash)$ cd /opt/secondary-portage (bash)$ tar xfj secondary-portage-snapshot-20050927.tar.bz2 (bash)$ mv secondary-portage-snapshot-20050927 portage (bash)$ cd etc (bash)$ ln -s ../portage/profiles/default-secondary/linux/x86 make.profile (bash)$ cp make.conf.example make.conf
edit make.conf for your needs, escpecially ACCEPT_KEYWORDS="~x86" and GENTOO_MIRRORS (as above)
(bash)$ exit
Now we can jump into the next portage instance and make it useable:
$ /opt/secondary-portage/bin/bash (bash)$ source /opt/secondary-portage/etc/profile (bash)$ binutils-config 1 (bash)$ gcc-config 1 (bash)$ env-update (bash)$ eenv-clear (bash)$ source /opt/secondary-portage/etc/profile
Now you have a prefix where all files are managed by portage.
But there's one problem:
Some packages might refer to the originally bootstrapped toolsbox (/tmp/toolsbox-4-patches...), because the ebuilds are not full ready for so-callable "cross-compiling to another prefix".
An example is portage itself: Look at etc/make.conf.example, where FETCHCOMMAND uses wget from previous prefix.
To detach /opt/secondary-portage from /tmp/toolsbox-4-..., the /opt/secondary-portage has to be fully recompiled.
[edit] Detaching from the bootstrap-instance
To make a real standalone secondary portage instance, it has to be recompiled from scratch:
(bash)$ emerge -e system (bash)$ binutils-config 1 (bash)$ gcc-config 1 (bash)$ env-update (bash)$ eenv-clear (bash)$ source /opt/secondary-portage/etc/profile
Now you have a real standalone secondary portage instance.
