summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Ludd <solar@gentoo.org>2004-07-17 07:52:42 +0000
committerNed Ludd <solar@gentoo.org>2004-07-17 07:52:42 +0000
commit62a944d8aab3bdbefa5b661af4635e4fca2422e9 (patch)
treef7e4ad9275c084b11988b0276cf16756b62d43d1 /scripts/bootstrap-cascade.sh
parentVersion bumped. (diff)
downloadhistorical-62a944d8aab3bdbefa5b661af4635e4fca2422e9.tar.gz
historical-62a944d8aab3bdbefa5b661af4635e4fca2422e9.tar.bz2
historical-62a944d8aab3bdbefa5b661af4635e4fca2422e9.zip
bootstrap cleanups for zhen
Diffstat (limited to 'scripts/bootstrap-cascade.sh')
-rw-r--r--scripts/bootstrap-cascade.sh263
1 files changed, 133 insertions, 130 deletions
diff --git a/scripts/bootstrap-cascade.sh b/scripts/bootstrap-cascade.sh
index f8d84a307abf..5ab3c196a5a7 100644
--- a/scripts/bootstrap-cascade.sh
+++ b/scripts/bootstrap-cascade.sh
@@ -1,51 +1,49 @@
#!/bin/bash
-# Copyright 1999-2004 Gentoo Technologies, Inc.
+# Copyright 1999-2004 Gento Foundation.
# Distributed under the terms of the GNU General Public License, v2
-# $Header: /var/cvsroot/gentoo-x86/scripts/bootstrap-cascade.sh,v 1.3 2004/06/15 22:08:57 solar Exp $
+# $Header: /var/cvsroot/gentoo-x86/scripts/bootstrap-cascade.sh,v 1.4 2004/07/17 07:52:42 solar Exp $
-# IMPORTANT NOTE:
-# This script no longer accepts an optional argument.
-# It was removed by the same person who added it -- me, drobbins -- when I optimized
-# bootstrap to complete 20 mins to 2 hours faster, depending on CPU. I did this by
-# merging both stages of bootstrap into a single stage. We no longer compile gcc and
-# binutils twice. Doing this is unnecessary and a holdover from very early versions
-# of Gentoo, where we were being ultra-paranoid.
+# drobbins optimized this script at some point which made a bootstrap
+# to complete 20 mins to 2 hours faster, depending on CPU. He did this
+# by merging both stages of bootstrap into a single stage. In doing so
+# we no longer compile gcc and binutils twice. Doing this is said to be
+# unnecessary and a holdover from very early versions of Gentoo.
# (drobbins, 06 Jun 2003)
+# (solar, Jul 2004)
unset STRAP_EMERGE_OPTS
STRAP_RUN=1
-if [ "$1" = "--fetchonly" -o "$1" = "-f" ]
-then
- echo "Running in fetch-only mode..."
- STRAP_EMERGE_OPTS="-f"
- unset STRAP_RUN
-elif [ "$1" = "-h" -o "$1" = "--help" ]
-then
- echo "bootstrap.sh: Please run with no arguments to start bootstrap, or specify"
- echo "--fetchonly or -f to download source archives only. -h/--help displays this"
- echo "help."
- exit 1
-fi
+
+for opt in $* ; do
+ case $opt in
+ --fetchonly|-f)
+ echo "Running in fetch-only mode..."
+ STRAP_EMERGE_OPTS="-f"
+ unset STRAP_RUN;;
+ -h|--help)
+ echo "bootstrap-cascade.sh: Please run with no arguments to start bootstrap, or specify"
+ echo "--fetchonly or -f to download source archives only. -h/--help displays this"
+ echo "help."
+ exit 1;;
+ --info) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} --info" ; unset STRAP_RUN ;;
+ --pretend|-p) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} -p" ; unset STRAP_RUN ;;
+ --verbose|-v) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} -v";;
+ --debug|-d) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} --debug"; DEBUG=1;;
+ *) ;;
+ esac
+done
MYPROFILEDIR="`readlink -f /etc/make.profile`"
-if [ ! -d ${MYPROFILEDIR} ]
-then
+if [ ! -d ${MYPROFILEDIR} ]; then
echo "!!! Error: ${MYPROFILEDIR} does not exist. Exiting."
exit 1
fi
-
-if [ -e /usr/bin/spython ]
-then
- # 1.0_rc6 and earlier
- PYTHON="/usr/bin/spython"
-else
- # 1.0 and later
- PYTHON="/usr/bin/python"
-fi
-if [ -e /etc/init.d/functions.sh ]
-then
+# spython is 1.0_rc6 and earlier and python is 1.0 and later
+[ -e /usr/bin/spython ] && PYTHON="/usr/bin/spython" || PYTHON="/usr/bin/python"
+
+if [ -e /etc/init.d/functions.sh ]; then
source /etc/init.d/functions.sh
# Use our own custom script, else logger cause things to
@@ -54,51 +52,47 @@ then
echo &> /dev/null
}
fi
-if [ -e /etc/profile ]
-then
- source /etc/profile
-fi
-echo
-echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; \e[34;01mhttp://www.gentoo.org/${NORMAL}"
-echo -e "Copyright 2001-2004 Gentoo Technologies, Inc.; Distributed under the GPL"
-if [ "${STRAP_EMERGE_OPTS}" = "-f" ]
-then
+[ -e /etc/profile ] && source /etc/profile
+
+echo -e "\n${GOOD}Gentoo Linux${GENTOO_VERS}; \e[34;01mhttp://www.gentoo.org/${NORMAL}"
+echo -e "Copyright 2001-2004 Gentoo Foundation.; Distributed under the GPL"
+if [ "${STRAP_EMERGE_OPTS:0:2}" = "-f" ]; then
echo "Fetching all bootstrap-related archives..."
else
echo "Starting Bootstrap of base system ..."
fi
-echo
+echo -------------------------------------------------------------------------------
# This should not be set to get glibc to build properly. See bug #7652.
-LD_LIBRARY_PATH=
+unset LD_LIBRARY_PATH
# We do not want stray $TMP, $TMPDIR or $TEMP settings
unset TMP TMPDIR TEMP
cleanup() {
- if [ -n "${STRAP_RUN}" ]
- then
- if [ -f /etc/make.conf.build ]
- then
+ if [ -n "${STRAP_RUN}" ]; then
+ if [ -f /etc/make.conf.build ]; then
mv -f /etc/make.conf.build /etc/make.conf
fi
fi
exit $1
}
+pycmd() {
+ [ "${DEBUG}" = 1 ] && echo ${PYTHON} -c "$*" > /dev/stderr
+ ${PYTHON} -c "$*"
+}
+
# Trap ctrl-c and stuff. This should fix the users make.conf
# not being restored.
-if [ -n "${STRAP_RUN}" ]
-then
- cp -f /etc/make.conf /etc/make.conf.build
-fi
+[ -n "${STRAP_RUN}" ] && cp -f /etc/make.conf /etc/make.conf.build
#TSTP messes ^Z of bootstrap up, so we don't trap it anymore.
trap "cleanup" TERM KILL INT QUIT ABRT
# USE may be set from the environment so we back it up for later.
-export ORIGUSE="`${PYTHON} -c 'import portage; print portage.settings["USE"];'`"
+export ORIGUSE="$(pycmd 'import portage; print portage.settings["USE"];')"
# Check for 'build' or 'bootstrap' in USE ...
INVALID_USE="`gawk -v ORIGUSE="${ORIGUSE}" '
@@ -108,8 +102,7 @@ INVALID_USE="`gawk -v ORIGUSE="${ORIGUSE}" '
}'`"
# Do not do the check for stage build scripts ...
-if [ "${INVALID_USE}" = "yes" ]
-then
+if [ "${INVALID_USE}" = "yes" ]; then
echo
eerror "You have 'build' or 'bootstrap' in your USE flags. Please"
eerror "remove it before trying to continue, since these USE flags"
@@ -119,94 +112,103 @@ then
cleanup 1
fi
-# With new cascading profiles, the packages profile at the leaf is not a
+# bug #50158 (don't use `which` in a bootstrap).
+if ! type -path portageq &>/dev/null; then
+ echo
+ eerror "Your portage version is too old. Please use a later stage1 image."
+ echo
+ cleanup 1
+fi
+
+# gettext should only be needed when used with nls
+for opt in ${ORIGUSE} ; do
+ case "${opt}" in
+ nls) myGETTEXT="gettext";;
+ nptl)
+ if [ -z "`portageq best_visible / '>=sys-kernel/linux26-headers-2.6.0'`" ]; then
+ eerror "You need to have >=sys-kernel/linux26-headers-2.6.0 unmasked!"
+ eerror "Please edit the latest >=sys-kernel/linux26-headers-2.6.0 package,"
+ eerror "and add your ARCH to KEYWORDS."
+ echo
+ cleanup 1
+ fi
+ USE_NPTL=1
+ ;;
+ esac
+done
+
+# With cascading profiles, the packages profile at the leaf is not a
# complete system, just the restrictions to it for the specific profile.
# The complete profile consists of an aggregate of the leaf and all its
# parents. So we now call portage to read the aggregate profile and store
# that into a variable.
-eval $(python -c 'import portage; print portage.settings.packages;' |
+eval $(pycmd 'import portage; print portage.settings.packages;' |
sed 's/[][,]//g; s/ /\n/g; s/\*//g' | while read p; do n=${p##*/}; n=${n%\'};
n=${n%%-[0-9]*}; echo "my$(tr a-z- A-Z_ <<<$n)=$p; "; done)
-# We really need to upgrade baselayout now that it's possible:
-#myBASELAYOUT=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-apps/baselayout | sed 's:^\*::'`
-#myBASELAYOUT=`echo ${myPROFPACKAGES} | grep -v
-#myPORTAGE=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-apps/portage | sed 's:^\*::'`
-#myGETTEXT=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/gettext | sed 's:^\*::'`
-# Not all profiles have gettext in the system profile anymore ...
-#[ -z "${myGETTEXT}" ] && myGETTEXT="sys-devel/gettext"
-#myBINUTILS=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/binutils | sed 's:^\*::'`
-#myGCC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/gcc | sed 's:^\*::'`
-#myGLIBC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-libs/glibc | sed 's:^\*::'`
-#myTEXINFO=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-apps/texinfo |sed 's:^\*::'`
-#myZLIB=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-libs/zlib |sed 's:^\*::'`
-#myNCURSES=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-libs/ncurses |sed 's:^\*::'`
-
-echo "Using ${myBASELAYOUT}"
-echo "Using ${myPORTAGE}"
-echo "Using ${myBINUTILS}"
-echo "Using ${myGCC}"
-echo "Using ${myGETTEXT}"
-echo "Using ${myGLIBC}"
-echo "Using ${myTEXINFO}"
-echo "Using ${myZLIB}"
-echo "Using ${myNCURSES}"
-echo
+# this stuff should never fail but will if not enough is installed.
+[ "${myBASELAYOUT}" = "" ] && myBASELAYOUT="$(portageq best_version / virtual/baselayout)"
+[ "${myPORTAGE}" = "" ] && myPORTAGE="portage"
+[ "${myBINUTILS}" = "" ] && myBINUTILS="binutils"
+[ "${myGCC}" = "" ] && myGCC="gcc"
+#[ "${myGETTEXT}" = "" ] && myGETTEXT="gettext" ; # We only gettext if nls is desired.
+[ "${myLIBC}" = "" ] && myLIBC="$(portageq best_version / virtual/libc)"
+# texinfo; category/PN combo due to app-xemacs/texinfo
+[ "${myTEXINFO}" = "" ] && myTEXINFO="sys-apps/texinfo"
+[ "${myZLIB}" = "" ] && myZLIB="zlib"
+[ "${myNCURSES}" = "" ] && myNCURSES="ncurses"
+
+# Do we really have no 2.4.x nptl kernels in portage?
+[ "${USE_NPTL}" = 1 ] && myOS_HEADERS="$(portageq best_visible / '>=sys-kernel/linux26-headers-2.6.0')" \
+[ "${myOS_HEADERS}" = "" ] && myOS_HEADERS="virtual/os-headers"
+
+einfo "Using baselayout : ${myBASELAYOUT}"
+einfo "Using portage : ${myPORTAGE}"
+einfo "Using os-headers : ${myOS_HEADERS}"
+einfo "Using binutils : ${myBINUTILS}"
+einfo "Using gcc : ${myGCC}"
+[ "${myGETTEXT}" != "" ] && echo "Using gettext : ${myGETTEXT}"
+einfo "Using libc : ${myLIBC}"
+einfo "Using texinfo : ${myTEXINFO}"
+einfo "Using zlib : ${myZLIB}"
+einfo "Using ncurses : ${myNCURSES}"
+echo -------------------------------------------------------------------------------
echo "Configuring environment..."
-export GENTOO_MIRRORS="`${PYTHON} -c 'import portage; print portage.settings["GENTOO_MIRRORS"];'`"
-
-export PORTDIR="`${PYTHON} -c 'import portage; print portage.settings["PORTDIR"];'`"
-export DISTDIR="`${PYTHON} -c 'import portage; print portage.settings["DISTDIR"];'`"
-export PKGDIR="`${PYTHON} -c 'import portage; print portage.settings["PKGDIR"];'`"
-export PORTAGE_TMPDIR="`${PYTHON} -c 'import portage; print portage.settings["PORTAGE_TMPDIR"];'`"
# Get correct CFLAGS, CHOST, CXXFLAGS, MAKEOPTS since make.conf will be
-# overwritten
-export CFLAGS="`${PYTHON} -c 'import portage; print portage.settings["CFLAGS"];'`"
-export CHOST="`${PYTHON} -c 'import portage; print portage.settings["CHOST"];'`"
-export CXXFLAGS="`${PYTHON} -c 'import portage; print portage.settings["CXXFLAGS"];'`"
-export MAKEOPTS="`${PYTHON} -c 'import portage; print portage.settings["MAKEOPTS"];'`"
-#to make it easier to get experimental bootstraps:
-export ACCEPT_KEYWORDS="`${PYTHON} -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];'`"
-
-PROXY="`${PYTHON} -c 'import portage; print portage.settings["PROXY"];'`"
-if [ -n "${PROXY}" ]
-then
- echo "exporting PROXY=${PROXY}"
- export PROXY
-fi
-HTTP_PROXY="`${PYTHON} -c 'import portage; print portage.settings["HTTP_PROXY"];'`"
-if [ -n "${HTTP_PROXY}" ]
-then
- echo "exporting HTTP_PROXY=${HTTP_PROXY}"
- export HTTP_PROXY
-fi
-FTP_PROXY="`${PYTHON} -c 'import portage; print portage.settings["FTP_PROXY"];'`"
-if [ -n "${FTP_PROXY}" ]
-then
- echo "exporting FTP_PROXY=${FTP_PROXY}"
- export FTP_PROXY
-fi
-if [ -x /usr/bin/gcc-config ]
-then
- GCC_CONFIG="/usr/bin/gcc-config"
+# overwritten.
-elif [ -x /usr/sbin/gcc-config ]
-then
- GCC_CONFIG="/usr/sbin/gcc-config"
-fi
+ENV_EXPORTS="GENTOO_MIRRORS PORTDIR DISTDIR PKGDIR PORTAGE_TMPDIR
+ CFLAGS CHOST CXXFLAGS MAKEOPTS ACCEPT_KEYWORDS PROXY HTTP_PROXY
+ FTP_PROXY FEATURES"
+
+for opt in ${ENV_EXPORTS}; do
+ val=$(pycmd 'import portage; print portage.settings["'${opt}'"];' )
+ if [ "${val}" != "" ]; then
+ einfo "${opt}='${val}'"
+ export ${opt}="${val}"
+ fi
+done
+echo -------------------------------------------------------------------------------
+
+[ -x /usr/sbin/gcc-config ] && GCC_CONFIG="/usr/sbin/gcc-config"
+[ -x /usr/bin/gcc-config ] && GCC_CONFIG="/usr/bin/gcc-config"
# Disable autoclean, or it b0rks
export AUTOCLEAN="no"
# Allow portage to overwrite stuff
export CONFIG_PROTECT="-*"
-
-USE="-* build bootstrap" emerge ${STRAP_EMERGE_OPTS} ${myPORTAGE} || cleanup 1
+# disable collision-protection
+export FEATURES="${FEATURES} -collision-protect"
+
+USE="-* build bootstrap" emerge ${STRAP_EMERGE_OPTS} ${myPORTAGE} || cleanup 1
+echo -------------------------------------------------------------------------------
export USE="${ORIGUSE} bootstrap"
-emerge ${STRAP_EMERGE_OPTS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1
+emerge ${STRAP_EMERGE_OPTS} ${myOS_HEADERS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1
+echo -------------------------------------------------------------------------------
# If say both gcc and binutils was build for i486, and we then merge
# binutils for i686 without removing the i486 version (Note that this is
@@ -233,16 +235,15 @@ emerge ${STRAP_EMERGE_OPTS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1
# (http://forums.gentoo.org/viewtopic.php?t=100263)
#
# <azarah@gentoo.org> (1 Nov 2003)
-if [ -n "${STRAP_RUN}" ]
-then
+if [ -n "${STRAP_RUN}" ]; then
emerge clean || cleanup 1
fi
emerge ${STRAP_EMERGE_OPTS} ${myGCC} || cleanup 1
+echo -------------------------------------------------------------------------------
# Basic support for gcc multi version/arch scheme ...
-if [ -n "${STRAP_RUN}" ]
-then
+if [ -n "${STRAP_RUN}" ]; then
if test -x ${GCC_CONFIG} &>/dev/null && \
${GCC_CONFIG} --get-current-profile &>/dev/null
then
@@ -253,11 +254,13 @@ then
fi
fi
-emerge ${STRAP_EMERGE_OPTS} ${myGLIBC} ${myBASELAYOUT} ${myZLIB} || cleanup 1
+emerge ${STRAP_EMERGE_OPTS} ${myLIBC} ${myBASELAYOUT} ${myZLIB} || cleanup 1
+echo -------------------------------------------------------------------------------
+
# ncurses-5.3 and up also build c++ bindings, so we need to rebuild it
export USE="${ORIGUSE}"
emerge ${STRAP_EMERGE_OPTS} ${myNCURSES} || cleanup 1
+echo -------------------------------------------------------------------------------
# Restore original make.conf
cleanup 0
-