setup DEFAULT_BOARD by default

Rather than forcing all consumers of DEFAULT_BOARD to remember to call
get_default_board, just do it for them automatically.

BUG=None
TEST=`cbuildbot {arm,amd64,x86}-generic-full` works
TEST=`./build_packages --help` shows correct default

Change-Id: I8d6ccb83babb2764a50692318eb9193c45fb3b39
Reviewed-on: https://gerrit.chromium.org/gerrit/17868
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2012-03-12 17:07:40 -04:00 committed by Gerrit
parent 5f43eb08d4
commit c17a493bcc
20 changed files with 14 additions and 55 deletions

View File

@ -28,8 +28,6 @@ find_common_sh
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE --- # --- END COMMON.SH BOILERPLATE ---
get_default_board
DEFINE_string board "$DEFAULT_BOARD" \ DEFINE_string board "$DEFAULT_BOARD" \
"The name of the board to check for images." "The name of the board to check for images."
DEFINE_boolean incremental "$FLAGS_FALSE" "Download incremental build" DEFINE_boolean incremental "$FLAGS_FALSE" "Download incremental build"

View File

@ -30,8 +30,6 @@ find_common_sh
. "${SCRIPT_ROOT}/remote_access.sh" || exit 1 . "${SCRIPT_ROOT}/remote_access.sh" || exit 1
get_default_board
DEFINE_boolean verbose ${FLAGS_FALSE} \ DEFINE_boolean verbose ${FLAGS_FALSE} \
"Whether to output verbose information for debugging." "Whether to output verbose information for debugging."
DEFINE_boolean build ${FLAGS_FALSE} "Build package before installing" DEFINE_boolean build ${FLAGS_FALSE} "Build package before installing"

View File

@ -9,8 +9,6 @@
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
get_default_board
# Flags. # Flags.
DEFINE_string arch "x86" \ DEFINE_string arch "x86" \
"The boot architecture: arm, x86, or amd64. (Default: x86)" "The boot architecture: arm, x86, or amd64. (Default: x86)"

View File

@ -19,4 +19,3 @@ INSTALLER_ROOT=/usr/lib/installer
BUILD_LIBRARY_DIR=${SCRIPTS_DIR}/build_library BUILD_LIBRARY_DIR=${SCRIPTS_DIR}/build_library
locate_gpt locate_gpt
get_default_board

View File

@ -9,8 +9,6 @@
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" restart_in_chroot_if_needed "$@"
get_default_board
assert_not_root_user assert_not_root_user
# Developer-visible flags. # Developer-visible flags.

View File

@ -14,8 +14,6 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# Script must be run inside the chroot. # Script must be run inside the chroot.
assert_inside_chroot assert_inside_chroot
get_default_board
DEFINE_string output_root "$DEFAULT_BUILD_ROOT/images" \ DEFINE_string output_root "$DEFAULT_BUILD_ROOT/images" \
"Directory in which to place image result directories (named by version)" "Directory in which to place image result directories (named by version)"
DEFINE_string board "$DEFAULT_BOARD" \ DEFINE_string board "$DEFAULT_BOARD" \

View File

@ -278,9 +278,20 @@ if [ -d "$SRC_ROOT/overlays" ]; then
fi fi
# Strip CR # Strip CR
ALL_BOARDS=$(echo $ALL_BOARDS) ALL_BOARDS=$(echo $ALL_BOARDS)
# Set a default BOARD
#DEFAULT_BOARD=x86-generic # or... # Sets the default board variable for calling script.
DEFAULT_BOARD=$(echo $ALL_BOARDS | awk '{print $NF}') if [ -f "$GCLIENT_ROOT/src/scripts/.default_board" ] ; then
DEFAULT_BOARD=$(cat "$GCLIENT_ROOT/src/scripts/.default_board")
# Check for user typos like whitespace.
if [[ -n ${DEFAULT_BOARD//[a-zA-Z0-9-_]} ]] ; then
die ".default_board: invalid name detected; please fix:" \
"'${DEFAULT_BOARD}'"
fi
fi
# Stub to get people to upgrade.
get_default_board() {
warn "please upgrade your script, and make sure to run build_packages"
}
# Enable --fast by default. # Enable --fast by default.
DEFAULT_FAST=${FLAGS_TRUE} DEFAULT_FAST=${FLAGS_TRUE}
@ -394,22 +405,6 @@ setup_board_warning() {
echo echo
} }
# Sets the default board variable for calling script
get_default_board() {
DEFAULT_BOARD=
if [ -f "$GCLIENT_ROOT/src/scripts/.default_board" ] ; then
DEFAULT_BOARD=$(cat "$GCLIENT_ROOT/src/scripts/.default_board")
# Check for user typos like whitespace.
if [[ -n ${DEFAULT_BOARD//[a-zA-Z0-9-_]} ]] ; then
die ".default_board: invalid name detected; please fix:" \
"'${DEFAULT_BOARD}'"
fi
fi
}
# Enter a chroot and restart the current script if needed # Enter a chroot and restart the current script if needed
restart_in_chroot_if_needed() { restart_in_chroot_if_needed() {
# NB: Pass in ARGV: restart_in_chroot_if_needed "$@" # NB: Pass in ARGV: restart_in_chroot_if_needed "$@"

View File

@ -15,8 +15,6 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# Script must be run inside the chroot # Script must be run inside the chroot
restart_in_chroot_if_needed "$@" restart_in_chroot_if_needed "$@"
get_default_board
# Flags # Flags
DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for." DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for."
DEFINE_string minidump_symbol_root "" \ DEFINE_string minidump_symbol_root "" \

View File

@ -17,8 +17,6 @@ MINIDUMP_DUMP=/usr/bin/minidump_dump
MINIDUMP_STACKWALK=/usr/bin/minidump_stackwalk MINIDUMP_STACKWALK=/usr/bin/minidump_stackwalk
USING_REMOTE=0 USING_REMOTE=0
get_default_board
DEFINE_string board "${DEFAULT_BOARD}" \ DEFINE_string board "${DEFAULT_BOARD}" \
"The board for which you are building autotest" "The board for which you are building autotest"
DEFINE_string breakpad_root "" \ DEFINE_string breakpad_root "" \

View File

@ -15,7 +15,6 @@
assert_not_root_user assert_not_root_user
# Script must be run inside the chroot # Script must be run inside the chroot
get_default_board
DEFINE_string board "${DEFAULT_BOARD}" \ DEFINE_string board "${DEFAULT_BOARD}" \
"The board to set package keywords for." "The board to set package keywords for."

View File

@ -9,8 +9,6 @@
SCRIPT_ROOT=$(dirname $(readlink -f "$0")) SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
get_default_board
DEFINE_string board "$DEFAULT_BOARD" \ DEFINE_string board "$DEFAULT_BOARD" \
"The name of the board to check for images." "The name of the board to check for images."

View File

@ -13,8 +13,6 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# Script must be run inside the chroot. # Script must be run inside the chroot.
assert_inside_chroot assert_inside_chroot
get_default_board
# Flags. # Flags.
DEFINE_string board "$DEFAULT_BOARD" \ DEFINE_string board "$DEFAULT_BOARD" \
"The board for which the image was built." b "The board for which the image was built." b

View File

@ -19,8 +19,6 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# In case chromeos-common.sh doesn't support MMC yet # In case chromeos-common.sh doesn't support MMC yet
declare -F list_mmc_disks >/dev/null || list_mmc_disks() { true; } declare -F list_mmc_disks >/dev/null || list_mmc_disks() { true; }
get_default_board
# Flags # Flags
DEFINE_string board "${DEFAULT_BOARD}" \ DEFINE_string board "${DEFAULT_BOARD}" \
"board for which the image was built" "board for which the image was built"

View File

@ -18,8 +18,6 @@ assert_inside_chroot
. /usr/lib/installer/chromeos-common.sh || exit 1 . /usr/lib/installer/chromeos-common.sh || exit 1
. "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || exit 1 . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || exit 1
get_default_board
# Flags # Flags
DEFINE_string board "${DEFAULT_BOARD}" \ DEFINE_string board "${DEFAULT_BOARD}" \
"Board for which the image was built" "Board for which the image was built"

View File

@ -18,8 +18,6 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# Script must be run inside the chroot. # Script must be run inside the chroot.
restart_in_chroot_if_needed "$@" restart_in_chroot_if_needed "$@"
get_default_board
DEFINE_string board "${DEFAULT_BOARD}" \ DEFINE_string board "${DEFAULT_BOARD}" \
"The board to build an image for." "The board to build an image for."
DEFINE_string image "" "Path to the image to use" DEFINE_string image "" "Path to the image to use"

View File

@ -17,8 +17,6 @@ cleanup() {
# Need to be inside the chroot to load chromeos-common.sh # Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot assert_inside_chroot
get_default_board
DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" b DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" b
DEFINE_string image "$FLAGS_image" "Location of the test image file" i DEFINE_string image "$FLAGS_image" "Location of the test image file" i
DEFINE_boolean scrub "$FLAGS_FALSE" "Don't include pyauto tests and data" s DEFINE_boolean scrub "$FLAGS_FALSE" "Don't include pyauto tests and data" s

View File

@ -21,8 +21,6 @@ fi
locate_gpt locate_gpt
get_default_board
# Flags. # Flags.
DEFINE_string board "$DEFAULT_BOARD" \ DEFINE_string board "$DEFAULT_BOARD" \
"The board for which the image was built." b "The board for which the image was built." b

View File

@ -10,8 +10,6 @@
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" restart_in_chroot_if_needed "$@"
get_default_board
assert_not_root_user assert_not_root_user
# Developer-visible flags. # Developer-visible flags.

View File

@ -16,8 +16,6 @@ assert_inside_chroot
# Load functions and constants for chromeos-install # Load functions and constants for chromeos-install
. /usr/lib/installer/chromeos-common.sh || exit 1 . /usr/lib/installer/chromeos-common.sh || exit 1
get_default_board
# Flags. # Flags.
DEFINE_string arch "x86" \ DEFINE_string arch "x86" \
"The boot architecture: arm or x86. (Default: x86)" "The boot architecture: arm or x86. (Default: x86)"

View File

@ -16,8 +16,6 @@ if [[ "$1" != "--testing" ]]; then
restart_in_chroot_if_needed "$@" restart_in_chroot_if_needed "$@"
fi fi
get_default_board
# Flags # Flags
DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for." DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for."
DEFINE_string breakpad_root "" "Root directory for breakpad symbols." DEFINE_string breakpad_root "" "Root directory for breakpad symbols."