From a91d1ef3a6500b1c0da54898313d860392bb0337 Mon Sep 17 00:00:00 2001 From: Vishal Bhoj Date: Thu, 19 Mar 2015 12:08:58 +0530 Subject: Switch support to gerrit trigger plugin Change-Id: I1707eda179aadde44db598cde6582701fdd6eeb3 Signed-off-by: Vishal Bhoj --- build-scripts/build-android | 12 ++++++++++++ node/build | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/build-scripts/build-android b/build-scripts/build-android index d2950db..b6ba5b7 100644 --- a/build-scripts/build-android +++ b/build-scripts/build-android @@ -67,6 +67,18 @@ else repo-sync-from-mirror "${1}" fi + if [ -n "$GERRIT_PROJECT" ] && [ $GERRIT_EVENT_TYPE -eq "patchset-created" ]; then + if [ "$GERRIT_PROJECT" == "platform/manifest" ]; then + cd .repo/local_manifests; + git pull http://review.android.git.linaro.org/platform/manifest $GERRIT_REFSPEC + cd - + else + cd `grep -rni $GERRIT_PROJECT\" .repo/local_manifests | grep -Po 'path="\K[^"]*'` + git pull http://review.android.git.linaro.org/$GERRIT_PROJECT $GERRIT_REFSPEC + cd - + fi + fi + if [ -n "$PATCHSETS" ]; then for i in $PATCHSETS; do sh ./android-patchsets/$i diff --git a/node/build b/node/build index 4026433..b4ddfec 100755 --- a/node/build +++ b/node/build @@ -23,6 +23,19 @@ cat /etc/issue set -xe +# We need to map which build config to trigger based on the change. +function map_build_config() { + case $GERRIT_PROJECT in + "platform/manifest") echo "armv8-android-juno-lsk";; + "android/device/linaro/juno") echo "armv8-android-juno-lsk";; + "device/linaro/common") echo "armv8-android-juno-lsk";; + "device/linaro/juno32") echo "armv8-android-juno32-lsk";; + "device/linaro/vexpress") echo "vexpress-lcr";; + "device/linaro/fvp-armv8") echo "armv8-android-fvp-lsk";; + "android-patchsets") echo "armv8-android-juno-lsk";; + esac +} + # We need ramdisk size when executing under root, but still don't want # to evaluate build config (== arbitrary code) as such. function get_ramdisk_size () { @@ -54,14 +67,29 @@ source $(get_build_config)/build-tools/build-config if [ -n "$BUILD_CONFIG_REPO" ]; then echo "Fetching build config indirectly from git" + save_dir=$PWD + rm -rf /tmp/buildconf.$$ + mkdir -p /tmp/buildconf.$$ + cd /tmp/buildconf.$$ + git clone "$BUILD_CONFIG_REPO" + cd * + git checkout "$BUILD_CONFIG_BRANCH" + $BUILD_SCRIPT_ROOT/../node/prepare_build_config.py "$(cat "$BUILD_CONFIG_FILENAME")" + cd $save_dir + source $(get_build_config)/build-tools/build-config +fi + +if [ -n "$GERRIT_PROJECT" ] && [ $GERRIT_EVENT_TYPE == "patchset-created" ] ; then + echo "Fetching build config indirectly from git for gerrit trigger" save_dir=$PWD rm -rf /tmp/buildconf.$$ mkdir -p /tmp/buildconf.$$ cd /tmp/buildconf.$$ - git clone "$BUILD_CONFIG_REPO" + git clone https://git.linaro.org/people/vishal.bhoj/android-build-configs.git cd * - git checkout "$BUILD_CONFIG_BRANCH" - $BUILD_SCRIPT_ROOT/../node/prepare_build_config.py "$(cat "$BUILD_CONFIG_FILENAME")" + git checkout master + build_config=$(map_build_config) + $BUILD_SCRIPT_ROOT/../node/prepare_build_config.py "$(cat $build_config)" cd $save_dir source $(get_build_config)/build-tools/build-config fi -- cgit v1.2.3