cros_chrome_make: Use CHROME_ORIGIN env variable
Previously cros_chrome_make would assume it was using GERRIT_SOURCE
if and only if a developer had cros_workon'd chromeos-chrome. This
resulted in a cros_workon'd LOCAL_SOURCE having the wrong runhooks
checks run.
Fixed to use CHROME_ORIGIN if set, and otherwise fall back to the
previous behavior. Always sets CHROME_ORIGIN on the ebuild command,
so similar bugs in the future should be more obvious.
BUG=chromium-os:25439
TEST=cros_chrome_make with LOCAL_ and GERRIT_SOURCE, and either
stable and 9999 ebuilds. Runhooks is not unnecessarily repeated.
Change-Id: I7e951860ed97ba2fb408edc863941f52368cb0eb
Reviewed-on: https://gerrit.chromium.org/gerrit/14743
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Chris Wolfe <cwolfe@chromium.org>
Tested-by: Chris Wolfe <cwolfe@chromium.org>
diff --git a/host/cros_chrome_make b/host/cros_chrome_make
index 00e1063..55b1895 100755
--- a/host/cros_chrome_make
+++ b/host/cros_chrome_make
@@ -163,10 +163,17 @@
use="$(decide_use_flags)"
-local_source=
-if [ "$(cros_workon_list | grep ${chrome_workon})" != "${chrome_workon}" ]; then
+if [ -z "${CHROME_ORIGIN}" ]; then
+ if [ "$(cros_workon_list | grep ${chrome_workon})" !=
+ "${chrome_workon}" ]; then
+ CHROME_ORIGIN="LOCAL_SOURCE"
+ else
+ CHROME_ORIGIN="GERRIT_SOURCE"
+ fi
+fi
+
+if [ "${CHROME_ORIGIN}" = "LOCAL_SOURCE" ]; then
auto_runhooks=decide_auto_runhooks_local_src
- local_source="CHROME_ORIGIN=LOCAL_SOURCE"
else
auto_runhooks=decide_auto_runhooks_gerrit_src
fi
@@ -187,13 +194,13 @@
# re-running the compile stage when the Chrome build switches to Ninja inside
# the chroot.
eval "USE='${use} -verbose ${runhooks}'" CCACHE_SIZE=2G \
- "FEATURES='${FEATURES} ${ccache}'" ${local_source} \
+ "FEATURES='${FEATURES} ${ccache}'" "CHROME_ORIGIN='${CHROME_ORIGIN}'" \
"${EBUILDCMD}" "${pkgfile}" clean compile
# If we didn't get to run hooks, don't update our cache.
if [ -e "${workpath}/.prepared" ]; then
echo "${use}" > ${useflags_file}
- if [ -z "${local_source}" ]; then
+ if [ "${CHROME_ORIGIN}" = "GERRIT_SOURCE" ]; then
echo "$(get_upstream_base_hash)" > ${src_hash_file}
fi
fi