Fix LATEST file to appear in the right place.
BUG=chromium-os:17722
TEST=Run sample archive_build with --debug mode and verify location of gsutil.
Change-Id: Idf39bfc9a80cdcd5f25d63f4839e9168f593adfd
Reviewed-on: http://gerrit.chromium.org/gerrit/4264
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/archive_build.sh b/archive_build.sh
index 93816a9..2d3f1af 100755
--- a/archive_build.sh
+++ b/archive_build.sh
@@ -64,7 +64,7 @@
DEFINE_string gsutil_archive "" \
"Optional datastore archive location"
DEFINE_boolean gsutil_append_last_change $FLAGS_TRUE \
- "Optional Whether to append build # and chrome os hash to GS uploads"
+ "Optional whether to append build # and chrome os hash to GS uploads"
DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)"
DEFINE_boolean official_build $FLAGS_FALSE \
"Set CHROMEOS_OFFICIAL=1 for release builds."
@@ -271,32 +271,38 @@
cp -f "${FLAGS_from}/au-generator.zip" "${OUTDIR}/"
-function gsutil_archive() {
- IN_PATH="$1"
- OUT_PATH="$2"
- if [ ${FLAGS_gsutil_append_last_change} -eq ${FLAGS_TRUE} ]; then
- OUT_PATH="${LAST_CHANGE}/${OUT_PATH}"
- fi
-
- echo "Using gsutil to archive to ${OUT_PATH}..."
+function gsutil_archive_noappend() {
+ local in_path="$1"
+ local out_path="$2"
+ echo "Using gsutil to archive to ${out_path}..."
if [ -z "$FLAGS_gsutil_archive" -o ${FLAGS_debug} -eq ${FLAGS_TRUE} ]; then
echo -n "In debug mode. Would have run: "
- echo "gsutil cp ${IN_PATH} <gsutil_archive>/${OUT_PATH}"
+ echo "gsutil cp ${in_path} <gsutil_archive>/${out_path}"
return
fi
- FULL_OUT_PATH="${FLAGS_gsutil_archive}/${OUT_PATH}"
- ${FLAGS_gsutil} cp ${IN_PATH} ${FULL_OUT_PATH}
- ${FLAGS_gsutil} setacl ${FLAGS_acl} ${FULL_OUT_PATH}
+ local full_out_path="${FLAGS_gsutil_archive}/${out_path}"
+ ${FLAGS_gsutil} cp ${in_path} ${full_out_path}
+ ${FLAGS_gsutil} setacl ${FLAGS_acl} ${full_out_path}
if [ -n "$FLAGS_gsd_gen_index" ]; then
echo "Updating indexes..."
${FLAGS_gsd_gen_index} \
--gsutil=${FLAGS_gsutil} \
-a ${FLAGS_acl} \
- -p ${FULL_OUT_PATH} ${FLAGS_gsutil_archive}
+ -p ${full_out_path} ${FLAGS_gsutil_archive}
fi
}
+
+function gsutil_archive() {
+ local in_path="$1"
+ local out_path="$2"
+ if [ ${FLAGS_gsutil_append_last_change} -eq ${FLAGS_TRUE} ]; then
+ out_path="${LAST_CHANGE}/${out_path}"
+ fi
+ gsutil_archive_noappend "${in_path}" "${out_path}"
+}
+
if [ $FLAGS_test_mod -eq $FLAGS_TRUE -a $FLAGS_official_build -eq $FLAGS_TRUE ]
then
echo "Creating hwqual archive"
@@ -349,7 +355,7 @@
"factory_${FLAGS_zipname}"
fi
-gsutil_archive "${FLAGS_to}/LATEST" "LATEST"
+gsutil_archive_noappend "${FLAGS_to}/LATEST" "LATEST"
if [ -n "${FLAGS_gsutil_archive}" ]; then
if [ ${FLAGS_gsutil_append_last_change} -eq ${FLAGS_TRUE} ]; then