Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2184)

Unified Diff: archive_build.sh

Issue 3978005: Workaround chrome-bot's special case wackiness. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: fix typos Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: archive_build.sh
diff --git a/archive_build.sh b/archive_build.sh
index 7f7e53a3d48d8d942b4c5a0332a144ca47736e57..64a4ee4093a0f6c65b13f91726784e036a5f87e3 100755
--- a/archive_build.sh
+++ b/archive_build.sh
@@ -58,20 +58,26 @@ DEFAULT_USED=
# Reset "default" FLAGS_from based on passed-in board if not set on cmd-line
if [ "$FLAGS_from" = "$DEFAULT_FROM" ]
then
- FLAGS_from="${IMAGES_DIR}/$FLAGS_board/$(ls -t1 \
- $IMAGES_DIR/$FLAGS_board 2>&-| head -1)"
+ # Keep the directory name of the current image set (*.bin).
+ IMG_DIR="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)"
+ FLAGS_from="${IMAGES_DIR}/${FLAGS_board}/${IMG_DIR}"
DEFAULT_USED=1
fi
# Die on any errors.
set -e
-if [ -z $DEFAULT_USED ] && [ $FLAGS_test_mod -eq $FLAGS_TRUE ]
+if [ -z $DEFAULT_USED ]
then
- echo "test_mod requires that the default from path be used."
- echo "If non default behavior is desired, run mod_image_for_test manually"
- echo "re-run archive build without test_mod"
- exit 1
+ if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] || \
+ [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ] || \
+ [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ]
+ then
+ echo "test_mod requires that the default from path be used."
+ echo "If non default behavior is desired, run mod_image_for_test manually"
+ echo "re-run archive build without test_mod"
+ exit 1
+ fi
fi
if [ ! -d "$FLAGS_from" ]
@@ -152,19 +158,12 @@ then
"--factory"
fi
-if [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]
-then
- echo "Modifying image for factory install"
- do_chroot_mod "${FLAGS_from}/chromiumos_factory_install_image.bin" \
- "--factory_install"
-fi
-
# Modify for recovery
if [ $FLAGS_official_build -eq $FLAGS_TRUE ]
then
- BUILDVER=$(ls -t1 $IMAGES_DIR/$FLAGS_board 2>&-| head -1)
- CHROOT_IMAGE_DIR=/home/$USER/trunk/src/build/images/$FLAGS_board/$BUILDVER
- ./enter_chroot.sh -- ./mod_image_for_recovery.sh --board $FLAGS_board \
+ BUILDVER="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)"
+ CHROOT_IMAGE_DIR=/home/$USER/trunk/src/build/images/$FLAGS_board/$BUILDVER
+ ./enter_chroot.sh -- ./mod_image_for_recovery.sh --board $FLAGS_board \
--image $CHROOT_IMAGE_DIR/chromiumos_base_image.bin
fi
@@ -173,6 +172,31 @@ if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] ; then
rm -f ${SRC_IMAGE}
fi
+# Build differently sized shims. Currently only factory install shim is
+# supported, TODO(tgao): Add developer shim.
+if [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]
+then
+ echo "Building factory install shim."
+ # HACK: The build system can't currently handle more than one image size
+ # at a time. Therefor eit's necessary to do another round of build after
+ # archiving the original build. This should be fixed in Chromite.
+
+ # HACK: cbuild has a special case when running on chrome-bot that
+ # zeroes out the current revision, which makes calling build_image directly
+ # fail. You must explictly call replace and specify a unique name numerically
+ # using build_attempt.
+ ./enter_chroot.sh -- ./build_image --board $FLAGS_board --factory_install \
+ --replace --build_attempt 7
+
+ # Get the install shim dir: It is the newest build.
+ # This is the output dir for the factory shim, the factory test and
+ # release images will remain in IMG_DIR, defined previously.
+ SHIM_DIR="$(readlink ${IMAGES_DIR}/${FLAGS_board}/latest)"
+
+ echo "Factory image dir: ${IMG_DIR}"
+ echo "Factory install shim dir: ${SHIM_DIR}"
+fi
+
# Zip the build
echo "Compressing and archiving build..."
cd "$FLAGS_from"
@@ -182,8 +206,23 @@ zip -r "${ZIPFILE}" ${MANIFEST}
if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] || \
[ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]
then
- FACTORY_MANIFEST=`ls | grep factory`
- zip -r "${FACTORY_ZIPFILE}" ${FACTORY_MANIFEST}
+ # We need to have directory structure for factory package, as
+ # signing and packaging utilities need unpack_partitions.sh.
+ echo "Compressing factory software"
+ pushd ..
+ [ -n "${SHIM_DIR}" ] && rm -f factory_shim && ln -s "${SHIM_DIR}" factory_shim
+ [ -n "${IMG_DIR}" ] && rm -f factory_test && ln -s "${IMG_DIR}" factory_test
+
+ # Restore "latest" status to the original image.
+ # The "latest" symlink and latest timestamp are used extensively
+ # throughout the build scripts rather than explicitly specifying an image.
+ touch "${IMG_DIR}"
+ [ -n "${IMG_DIR}" ] && rm -f latest && ln -s "${IMG_DIR}" latest
+ FACTORY_MANIFEST=`find factory_shim factory_test -follow \
+ -type f | grep -E "(factory_image|factory_install|partition)"`
+ zip "${FACTORY_ZIPFILE}" ${FACTORY_MANIFEST}
+ echo "Zipped"
+ popd
chmod 644 "${FACTORY_ZIPFILE}"
fi
cd -
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698