From b885b80a336314e0bb61b27689319b25bc79f9f4 Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Wed, 16 Feb 2011 15:33:11 -0800 Subject: [PATCH] Remove old logic ... and don't needlessly modifiy dev image. Change-Id: I9b4047f2f124875553542df73e16cba6be41c561 BUG=chromium-os:chromium-os:8364 TEST=Ran it with pfq options. Review URL: http://codereview.chromium.org/6527001 --- archive_build.sh | 29 +++++++---------------------- common.sh | 2 +- mod_image_for_test.sh | 10 +++++++--- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/archive_build.sh b/archive_build.sh index 94630059fd..833c6cb332 100755 --- a/archive_build.sh +++ b/archive_build.sh @@ -66,6 +66,7 @@ DEFINE_boolean official_build $FLAGS_FALSE \ DEFINE_string test_tarball "" "Optional path to test tarball to archive" DEFINE_boolean test_mod $FLAGS_TRUE "Modify image for testing purposes" DEFINE_boolean prebuilt_upload $FLAGS_FALSE "Upload prebuilt binary packages." +DEFINE_boolean remove_dev $FLAGS_TRUE "Remove the de image during archive." DEFINE_string to "$DEFAULT_TO" "Directory of build archive" DEFINE_string zipname "image.zip" "Name of zip file to create." @@ -138,27 +139,11 @@ echo "archive to file: $ZIPFILE" rm -rf "$OUTDIR" mkdir -p "$OUTDIR" - -SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin" -BACKUP_IMAGE="${FLAGS_from}/chromiumos_image_bkup.bin" - -# Apply mod_image_for_test to the developer image, and store the -# result in a new location. Usage: -# do_chroot_mod "$OUTPUT_IMAGE" "--flags_to_mod_image_for_test" -function do_chroot_mod() { - MOD_ARGS=$2 - OUTPUT_IMAGE=$1 - cp -f "${SRC_IMAGE}" "${BACKUP_IMAGE}" - ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \ - --yes ${MOD_ARGS} - mv "${SRC_IMAGE}" "${OUTPUT_IMAGE}" - mv "${BACKUP_IMAGE}" "${SRC_IMAGE}" -} - # Modify image for test if flag set. if [ $FLAGS_test_mod -eq $FLAGS_TRUE ]; then echo "Modifying image for test" - do_chroot_mod "${FLAGS_from}/chromiumos_test_image.bin" "" + ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \ + --noinplace --yes pushd "${FLAGS_chroot}/build/${FLAGS_board}/usr/local" echo "Archiving autotest build artifacts" @@ -168,8 +153,8 @@ fi if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ]; then echo "Modifying image for factory test" - do_chroot_mod "${FLAGS_from}/chromiumos_factory_image.bin" \ - "--factory" + ./enter_chroot.sh -- ./mod_image_for_test.sh --board $FLAGS_board \ + --yes --noinplace --factory fi # Modify for recovery @@ -181,8 +166,8 @@ if [ $FLAGS_official_build -eq $FLAGS_TRUE ]; then fi # Remove the developer build if test image is also built. -if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] ; then - rm -f ${SRC_IMAGE} +if [ $FLAGS_remove_dev -eq $FLAGS_TRUE ]; then + rm -f "${FLAGS_from}/${CHROMEOS_IMAGE_NAME}" fi # Build differently sized shims. Currently only factory install shim is diff --git a/common.sh b/common.sh index 41fce62595..1d25074316 100644 --- a/common.sh +++ b/common.sh @@ -157,7 +157,7 @@ DEFAULT_FAST=${FLAGS_TRUE} # Standard filenames CHROMEOS_IMAGE_NAME="chromiumos_image.bin" CHROMEOS_TEST_IMAGE_NAME="chromiumos_test_image.bin" - +CHROMEOS_FACTORY_TEST_IMAGE_NAME="chromiumos_factory_image.bin" # Directory locations inside the dev chroot CHROOT_TRUNK_DIR="/home/$USER/trunk" diff --git a/mod_image_for_test.sh b/mod_image_for_test.sh index 96009799ce..b9f123fb0a 100755 --- a/mod_image_for_test.sh +++ b/mod_image_for_test.sh @@ -54,11 +54,11 @@ DEFINE_boolean fast ${DEFAULT_FAST} "Call many emerges in parallel" DEFINE_boolean inplace $FLAGS_TRUE \ "Modify/overwrite the image ${CHROMEOS_IMAGE_NAME} in place. \ Otherwise the image will be copied to ${CHROMEOS_TEST_IMAGE_NAME} \ -if needed, and modified there" +(or ${CHROMEOS_FACTORY_TEST_IMAGE_NAME} for --factory) if needed, and \ +modified there" DEFINE_boolean force_copy ${FLAGS_FALSE} \ "Always rebuild test image if --noinplace" - # Parse command line FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" @@ -182,7 +182,11 @@ IMAGE_DIR="$(dirname "${FLAGS_image}")" # Copy the image to a test location if required if [ ${FLAGS_inplace} -eq ${FLAGS_FALSE} ]; then - TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_TEST_IMAGE_NAME}" + if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then + TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}" + else + TEST_PATHNAME="${IMAGE_DIR}/${CHROMEOS_TEST_IMAGE_NAME}" + fi if [ ! -f "${TEST_PATHNAME}" ] || \ [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then echo "Creating test image from original..."