diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh index fa56a00138..bed87463d6 100755 --- a/sdk_lib/make_chroot.sh +++ b/sdk_lib/make_chroot.sh @@ -44,8 +44,6 @@ DEFINE_boolean fast "${DEFAULT_FAST}" \ "Use the parallel_emerge wrapper script." DEFINE_integer jobs "${NUM_JOBS}" \ "How many packages to build in parallel at maximum." -DEFINE_string stage3_date "20130130" \ - "Use the stage3 with the given date." DEFINE_string stage3_path "" \ "Use the stage3 located on this path." DEFINE_string cache_dir "" "Directory to store caches within." @@ -71,30 +69,9 @@ switch_to_strict_mode [[ -z "${FLAGS_cache_dir}" ]] && \ die "--cache_dir is required" -. "${SCRIPT_ROOT}"/sdk_lib/make_conf_util.sh - -USEPKG="" -if [[ $FLAGS_usepkg -eq $FLAGS_TRUE ]]; then - # Use binary packages. Include all build-time dependencies, - # so as to avoid unnecessary differences between source - # and binary builds. - USEPKG="--usepkg --with-bdeps y" - if [[ $FLAGS_getbinpkg -eq $FLAGS_TRUE ]]; then - USEPKG="$USEPKG --getbinpkg" - fi -fi - -# Support faster build if necessary. -EMERGE_CMD="emerge" -if [ "$FLAGS_fast" -eq "${FLAGS_TRUE}" ]; then - CHROOT_CHROMITE_DIR="${CHROOT_TRUNK_DIR}/chromite" - EMERGE_CMD="${CHROOT_CHROMITE_DIR}/bin/parallel_emerge" -fi - ENTER_CHROOT_ARGS=( CROS_WORKON_SRCROOT="$CHROOT_TRUNK" PORTAGE_USERNAME="${SUDO_USER}" - IGNORE_PREFLIGHT_BINHOST="$IGNORE_PREFLIGHT_BINHOST" ) # Invoke enter_chroot. This can only be used after sudo has been installed. @@ -373,22 +350,11 @@ for type in http ftp all; do fi done -# Create the base Gentoo stage3 based on last version put in chroot. -STAGE3="${OVERLAY}/coreos/stage3/stage3-amd64-${FLAGS_stage3_date}.tar.bz2" -if [ -f $CHROOT_STATE ] && \ - ! egrep -q "^STAGE3=$STAGE3" $CHROOT_STATE >/dev/null 2>&1 -then - info "STAGE3 version has changed." - delete_existing -fi - -if [ -n "${FLAGS_stage3_path}" ]; then - if [ ! -f "${FLAGS_stage3_path}" ]; then - error "Invalid stage3!" - exit 1; - fi - STAGE3="${FLAGS_stage3_path}" +if [ ! -f "${FLAGS_stage3_path}" ]; then + error "Invalid stage3!" + exit 1; fi +STAGE3="${FLAGS_stage3_path}" # Create the destination directory. mkdir -p "$FLAGS_chroot" @@ -407,39 +373,21 @@ else ${DECOMPRESS} -dc "${STAGE3}" | \ tar -xp -C "${FLAGS_chroot}" rm -f "$FLAGS_chroot/etc/"make.{globals,conf.user} -fi -# Set up users, if needed, before mkdir/mounts below. -[ -f $CHROOT_STATE ] || init_users + # Set up users, if needed, before mkdir/mounts below. + init_users -# Reset internal vars to force them to the 'inside the chroot' value; -# since user directories now exist, this can do the upgrade in place. -set_chroot_trunk_dir "${FLAGS_chroot}" poppycock + # Reset internal vars to force them to the 'inside the chroot' value; + # since user directories now exist, this can do the upgrade in place. + set_chroot_trunk_dir "${FLAGS_chroot}" poppycock + mkdir -p "${FLAGS_chroot}/${CHROOT_TRUNK_DIR}" \ + "${FLAGS_chroot}/${DEPOT_TOOLS_DIR}" "${FLAGS_chroot}/run" -echo -info "Setting up mounts..." -# Set up necessary mounts and make sure we clean them up on exit. -mkdir -p "${FLAGS_chroot}/${CHROOT_TRUNK_DIR}" \ - "${FLAGS_chroot}/${DEPOT_TOOLS_DIR}" "${FLAGS_chroot}/run" - -# Create a special /etc/make.conf.host_setup that we use to bootstrap -# the chroot. The regular content for the file will be generated the -# first time we invoke update_chroot (further down in this script). -create_bootstrap_host_setup "${FLAGS_chroot}" - -if ! [ -f "$CHROOT_STATE" ];then - INITIALIZE_CHROOT=1 -fi - -if [ -z "${INITIALIZE_CHROOT}" ];then - info "chroot already initialized. Skipping..." -else # Run all the init stuff to setup the env. init_setup fi # Add file to indicate that it is a chroot. -# Add version of $STAGE3 for update checks. echo STAGE3=$STAGE3 > $CHROOT_STATE # Update chroot. diff --git a/sdk_lib/make_conf_util.sh b/sdk_lib/make_conf_util.sh index 914b67eeb0..fe614b1c25 100644 --- a/sdk_lib/make_conf_util.sh +++ b/sdk_lib/make_conf_util.sh @@ -2,109 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# When bootstrapping the chroot, only wget is available, and we must -# disable certificate checking. Once the chroot is fully -# initialized, we can switch to curl, and re-enable the certificate -# checks. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=409938 -# -# Usage: -# $1 - 'wget' requests the bootstrap special content; otherwise -# uses 'curl'. -_make_conf_fetchcommand() { - local cmd options output_opt resume_opt - local fileref='\"\${DISTDIR}/\${FILE}\"' - local uri_ref='\"\${URI}\"' - - if [ "$1" = "wget" ] ; then - cmd=/usr/bin/wget - options="-t 5 -T 60 --no-check-certificate --passive-ftp" - resume_opt="-c" - output_opt="-O" - else - cmd=curl - options="-f -y 30 --retry 9 -L" - resume_opt="-C -" - output_opt="--output" - fi - - local args="$options $output_opt $fileref $uri_ref" - echo FETCHCOMMAND=\"$cmd $args\" - echo RESUMECOMMAND=\"$cmd $resume_opt $args\" - echo -} - -# The default PORTAGE_BINHOST setting selects the preflight -# binhosts. We override the setting if the build environment -# requests it. -_make_conf_prebuilt() { - if [[ -n "$IGNORE_PREFLIGHT_BINHOST" ]]; then - echo 'PORTAGE_BINHOST="$FULL_BINHOST"' - echo - fi -} - -# Include configuration settings for building private overlay -# packages, if the overlay is present. -# -# N.B. We explicitly disallow creating content for the private -# overlay during bootstrapping, as it's not currently required, -# and at least a minor nuisance to implement. Note also that the -# use of an inside-the-chroot path is based on the (currently true) -# assumption that bootstrapping use is outside the chroot, and -# non-bootstrapping use is inside the chroot. -_make_conf_private() { - if [ "$1" = "wget" ] ; then - return - fi - local chromeos_overlay="src/private-overlays/coreos-overlay" - chromeos_overlay="$CHROOT_TRUNK_DIR/$chromeos_overlay" - if [ -d "$chromeos_overlay" ]; then - local boto_config="$chromeos_overlay/googlestorage_account.boto" - local gsutil_cmd='gsutil cp \"${URI}\" \"${DISTDIR}/${FILE}\"' - cat <