On Sun, 2007-03-04 at 12:46 +0100, Fabian Groffen wrote:
> On 04-03-2007 13:37:57 +0200, Philipp Riegger wrote:
> >
> > On 04.03.2007, at 11:17, Fabian Groffen wrote:
> >
> > >I just committed a new version of the bootstrap script that should fix
> > >1).
> >
> > Hi!
> >
> > I've been thinking about the bootstrap script. The scripts used for
> > "normal gentoo" work quite different. You call them and they do the
> > bootstraping for you.
> >
> > Maybe we could add this functionality to our script. You only call "./
> > bootstrap-prefix.sh $EPREFIX" and it just starts. Maybe we could add
> > a default path (like ~/Library/Gentoo on OS X, ~/gentoo on linux,...)
> > if $EPREFIX is not given to the script...
> >
> > What do you think?
>
> This is certainly an option, as more people have expressed (huge)
> interest in such script.
I'm currently using such a script. It requires the very first portage
already installed into some bootstrap path, just after "Gentoo Prefixed
Portage Bootstrap Process for Solaris"[1] Code Listing 1.3, but with
portage installed into ${EPREFIX}/tmp too and with applied
[15-new-eprefix.patch] (attached).
[1] http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-solaris.xml
I'm using this script with my toolsbox, which does this initial
bootstrap for me. Currently I'm waiting for authorization to make that
toolsbox public...
But now I've added some (untested) support to work without toolsbox, so
I can attach the script here [eprefix-bootstrap].
Just call it (repeatedly) this way:
/path/to/eprefix-bootstrap --eprefix=/my/gentoo
--bootstrap-path=/my/gentoo/usr/tmp/bin:/my/gentoo/tmp/bin
It prepends current PATH with value of '--bootstrap-path' where
appropriate.
/haubi/
--- prefix-portage/pym/emerge/__init__.py.orig 2007-03-05 15:52:16.000000000 +0100
+++ prefix-portage/pym/emerge/__init__.py 2007-03-05 15:53:38.000000000 +0100
@@ -2721,7 +2721,8 @@
if myversion != portage.VERSION and "--quiet" not in self.myopts:
if mylist_index < len(mylist) - 1 and \
- "livecvsportage" not in self.settings.features:
+ "livecvsportage" not in self.settings.features and \
+ portage.const.EPREFIX == portage.const.BUILD_EPREFIX:
p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,"))
p.append(colorize("WARN", " then resume the merge."))
print
@@ -3225,7 +3227,8 @@
if myver[-3:]=='-r0':
myver=myver[:-3]
if (myver != portage.VERSION) and \
- "livecvsportage" not in self.settings.features:
+ "livecvsportage" not in self.settings.features and \
+ portage.const.EPREFIX == portage.const.BUILD_EPREFIX:
if len(mymergelist) > mergecount:
emergelog(xterm_titles,
" ::: completed emerge ("+ \
--- prefix-portage-2.1.20.5839/pym/portage/const.py.orig 2007-03-02 09:47:00.941076000 +0100
+++ prefix-portage-2.1.20.5839/pym/portage/const.py 2007-03-02 09:48:59.611071000 +0100
@@ -2,13 +2,24 @@
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id: portage_const.py 3483 2006-06-10 21:40:40Z genone $
-import os
+import os,pwd,grp
# ===========================================================================
# autotool supplied constants.
# ===========================================================================
from portage.const_autotool import *
+BUILD_EPREFIX = EPREFIX
+
+if os.environ.has_key("EPREFIX"):
+ EPREFIX = os.path.normpath(os.environ["EPREFIX"])
+
+ prefixstat = os.stat(EPREFIX)
+ rootuid = prefixstat[4] # use owner of EPREFIX as root-gid and portage-user
+ portageuser = pwd.getpwuid(rootuid)[0]
+ rootuser = portageuser
+ wheelgid = prefixstat[5] # use group of EPREFIX as wheel-gid and portage-group
+ portagegroup = grp.getgrgid(wheelgid)[0]
# ===========================================================================
# START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF
--- prefix-portage/pym/portage/__init__.py.orig 2007-02-13 12:49:50.167784000 +0100
+++ prefix-portage/pym/portage/__init__.py 2007-02-13 12:49:52.867785000 +0100
@@ -1154,7 +1154,7 @@
del rawpuseforce
try:
- self.mygcfg = getconfig(os.path.join(config_root + EPREFIX, "etc", "make.globals"))
+ self.mygcfg = getconfig(os.path.join(config_root + const.BUILD_EPREFIX, "etc", "make.globals"))
if self.mygcfg is None:
self.mygcfg = {}
#! /usr/bin/env bash
set -e
startdir=`pwd`
onestage=
nextstage=
debug=
verbose=
while [ $# -gt 0 ]; do
arg=$1
shift
case "${arg}" in
"--eprefix="*) EPREFIX=${arg#--eprefix=} ;;
"--onestage") onestage=yes ;;
"--debug") debug=-x; set $debug ;;
"--debug") verbose=-v; set $verbose ;;
"--stage="*) nextstage=${arg#--stage=} ;;
"--bootstrap-path=*") bootstrap_path="${arg#--bootstrap-path=}" ;;
"--"*) echo "unknown option ${arg}" >&2 ;;
*) EPREFIX="${arg}" ;;
esac
done
if [ -z "${EPREFIX}" ]; then
echo "need to give EPREFIX argument" 2>&1
exit 1
fi
export EPREFIX
echo "using EPREFIX=${EPREFIX}"
my_bindir=`dirname $0`
cd ${my_bindir}
my_bindir=`pwd`
cd ${startdir}
if [ -n "${nextstage}" ]; then
:
elif [ -f ${EPREFIX}/bootstrap-stage ]; then
nextstage=$(cat ${EPREFIX}/bootstrap-stage)
else
nextstage=start
fi
trap 'echo "failed stage was: ${stage}"; echo ${stage} >
${EPREFIX}/bootstrap-stage; echo "next stage would be: ${nextstage}"' 0
need_bootstrap_env() {
if [ -r ${my_bindir}/eprefix-bootstrap-env.sh ]; then
# have toolsbox
for f in ${my_bindir}/*-env.sh; do . $f; done
else
export PATH="${bootstrap_path}:${PATH}"
fi
}
need_eprefix_env() {
PATH="${EPREFIX}/usr/bin:${EPREFIX}/bin:${PATH}"
LDFLAGS="-L${EPREFIX}/usr/lib -R${EPREFIX}/usr/lib -L${EPREFIX}/lib
-R${EPREFIX}/lib"
CPPFLAGS="-I${EPREFIX}/usr/include"
export PATH LDFLAGS CPPFLAGS
}
need_profile() {
. ${EPREFIX}/etc/profile
}
test -d "${EPREFIX}" && cd "${EPREFIX}"
while test -n "${nextstage}"
do
stage=${nextstage}
nextstage=
echo "*** doing stage: ${stage}"
case "${stage}" in
start) nextstage=tree
need_bootstrap_env
mkdir -p "${EPREFIX}"
cd "${EPREFIX}"
wget -O "./bootstrap-prefix.sh" \
'http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt'
patch -p0 << EOP
--- bootstrap-prefix.sh.orig 2007-03-05 16:44:58.000000000 +0100
+++ bootstrap-prefix.sh 2007-03-05 16:45:29.000000000 +0100
@@ -82,1 +82,1 @@
-setup_portage() {
+bootstrap_setup() {
@@ -137,4 +137,6 @@
einfo "Setting up sync uri"
echo
'SYNC="svn+http://overlays.gentoo.org/svn/proj/alt/trunk/prefix-overlay"' >>
\${ROOT}/etc/make.conf
+ einfo "Setting up portdir"
+ echo "PORTDIR=\\"\${ROOT}/usr/portage\\"" >> \${ROOT}/etc/make.conf
}
@@ -204,1 +204,1 @@
- setup_portage
+ bootstrap_setup
@@ -471,1 +471,1 @@
- CHOST="\`uname -p\`-ibm-aix\`oslevel | sed
's|([0-9]\\.[0-9]).*|\\1|'\`"
+ CHOST="\`/usr/bin/uname -p\`-ibm-aix\`oslevel |
sed 's|\\([0-9]\\.[0-9]\\).*|\\1|'\`"
EOP
;;
tree) nextstage=setup
(
need_bootstrap_env
$BASH $debug $verbose ${EPREFIX}/bootstrap-prefix.sh $EPREFIX
tree
) ;;
setup) nextstage=portage
(
need_bootstrap_env
$BASH $debug $verbose ${EPREFIX}/bootstrap-prefix.sh $EPREFIX
setup
) ;;
portage) nextstage=mirrorconfig
(
need_bootstrap_env
# portage.ebuild with patch:
# - --with-default-path="/usr/bin:/bin"
# + --with-default-path=$(use build && echo "${PATH}" || echo
"/usr/bin:/bin")
(
cd ${EPREFIX}/usr/portage/sys-apps/portage
for p in portage-*.ebuild; do
if patch --dry-run -p0 --no-backup-if-mismatch
-g0 -l -N >/dev/null 2>&1 <<EOF
--- ${p} 2007-02-15 17:43:57.164453000 +0100
+++ ${p} 2007-02-15 17:44:34.314453000 +0100
@@ -49,1 +49,1 @@
- --with-default-path="/usr/bin:/bin" \\
+ --with-default-path="\$(use build && echo \${PATH} || echo
/usr/bin:/bin)" \\
EOF
then
patch -p0 --no-backup-if-mismatch -g0
-l -N <<EOF
--- ${p} 2007-02-15 17:43:57.164453000 +0100
+++ ${p} 2007-02-15 17:44:34.314453000 +0100
@@ -49,1 +49,1 @@
- --with-default-path="/usr/bin:/bin" \\
+ --with-default-path="\$(use build && echo \${PATH} || echo
/usr/bin:/bin)" \\
EOF
fi
done
)
type emerge
PORTAGE_TMPDIR="${EPREFIX}/var/tmp" \
USE=build \
FEATURES="-strict digest ${FEATURES}" \
PORTAGE_INST_UID="$(id -u)" \
PORTAGE_INST_USER="$(id -un)" \
PORTAGE_INST_GID="$(id -g)" \
PORTAGE_USER="$(id -un)" \
PORTAGE_GROUP="$(id -gn)" \
emerge --oneshot --nodeps portage
) ;;
mirrorconfig) nextstage=basics
if grep '^GENTOO_MIRRORS=' ${EPREFIX}/etc/make.conf >/dev/null;
then :
else
echo "Now you really should add GENTOO_MIRRORS to
${EPREFIX}/etc/make.conf"
echo "Then continue with: $0 ${EPREFIX} ${nextstage}"
echo ${nextstage} > ${EPREFIX}/bootstrap-stage
nextstage=
fi
;;
basics) nextstage=system
(
need_bootstrap_env
need_eprefix_env
FEATURES="-strict digest"
export FEATURES
emerge --noreplace --oneshot "=sys-apps/sed-4.1.4*"
emerge --noreplace --oneshot bash
emerge --noreplace --oneshot --nodeps \
sys-devel/m4 \
sys-apps/baselayout-prefix \
sys-devel/binutils-config \
sys-devel/binutils \
sys-devel/gcc-config \
sys-devel/gcc \
texinfo \
"=autoconf-2.1*" "=autoconf-2.6*" "autoconf-wrapper" \
"=automake-1.4*" "=automake-1.5*" "=automake-1.6*"
"=automake-1.7*" "=automake-1.8*" "automake-wrapper" \
wget
emerge --noreplace --oneshot --nodeps \
"=automake-1.9*" "=automake-1.10*" \
libtool \
sys-apps/coreutils
emerge --noreplace --oneshot gawk patch
emerge --noreplace --oneshot --nodeps \
python \
findutils \
tar \
grep \
make \
bison
emerge system
emerge --oneshot portage
) ;;
system) nextstage=subversion
(
need_profile
emerge -e system
) ;;
subversion) nextstage=sync
(
need_profile
emerge subversion
) ;;
sync) nextstage=useconfig
(
need_profile
emerge --sync
) ;;
useconfig) nextstage=world
if grep '^USE=' ${EPREFIX}/etc/make.conf >/dev/null; then :
else
echo 'USE=""' >> ${EPREFIX}/etc/make.conf
echo "Now you can tweak USE flags in
${EPREFIX}/etc/make.conf"
echo "Then continue with: $0 ${EPREFIX} ${nextstage}"
echo ${nextstage} > ${EPREFIX}/bootstrap-stage
nextstage=
fi
;;
world) nextstage=
(
need_profile
FEATURES="-strict digest"
export FEATURES
emerge -e world
) ;;
resume-world) nextstage=
(
need_profile
FEATURES="-strict digest"
export FEATURES
emerge --resume
) ;;
esac
test -n "${onestage}" && break
done
echo "last stage was: ${stage}"
test -n "${nextstage}" && echo ${nextstage} > ${EPREFIX}/bootstrap-stage
echo "next stage would be: ${nextstage}"
trap '' 0