blob: 23d6b536b3291dd2ef634d36a6a173796e3e548b [file] [log] [blame]
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Performs an update of the chroot.
# Load common CrOS utilities. Inside the chroot this file is installed in
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location.
. "$(dirname $0)/" || { echo "Unable to load"; exit 1; }
# Script must run inside the chroot
assert_inside_chroot "$@"
# Do not run as root
# Flags
DEFINE_boolean usepkg $FLAGS_TRUE \
"Use binary packages to bootstrap."
DEFINE_boolean fast ${DEFAULT_FAST} "Call many emerges in parallel"
DEFINE_integer retries -1 \
"On build failure, the number of times to retry."
# Parse command line flags
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
# Only now can we die on error. shflags functions leak non-zero error codes,
# so will die prematurely if 'set -e' is specified before now.
set -e
# Run version hooks as pre-update
info "Updating chroot"
EMERGE_FLAGS="-uDNv --with-bdeps=y"
if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
# Only update toolchain when binpkgs are available. Toolchain rollout
# process only takes place when the chromiumos sdk builder finishes
# a successful build.
EMERGE_FLAGS+=" --useoldpkg-atoms=sys-devel/binutils"
EMERGE_FLAGS+=" --useoldpkg-atoms=sys-devel/gcc"
EMERGE_FLAGS+=" --useoldpkg-atoms=sys-libs/glibc"
# Perform an update of hard-host-depends and world in the chroot.
if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
eretry sudo -E ${EMERGE_CMD} ${EMERGE_FLAGS} \
chromeos-base/hard-host-depends world