From: Luis Gomez Date: Wed, 27 Feb 2019 08:52:53 +0000 (-0800) Subject: Add knob for odlparent topic patch checkout X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=c4e73d530280a3e006d1d7baf19b052d9cc962a0;p=releng%2Fbuilder.git Add knob for odlparent topic patch checkout Change-Id: Iecf6ede3a40e4e9b2ef8e291859204ec79a6dad1 Signed-off-by: Luis Gomez --- diff --git a/jjb/integration/multipatch-distribution.sh b/jjb/integration/multipatch-distribution.sh index 682d0e301..9021af065 100755 --- a/jjb/integration/multipatch-distribution.sh +++ b/jjb/integration/multipatch-distribution.sh @@ -42,9 +42,19 @@ if ${BUILD_FAST}; then else fast_option="" fi -# check if topic exists, e.g. topic=binding-tlc-rpc -if [[ "${PATCHES_TO_BUILD}" == *topic* ]]; then - TOPIC="${PATCHES_TO_BUILD#*=}" +# check if topic exists: +# if topic=binding-rpc, then checkout first patch in binding-rpc topic (if it exists) +# if topic:binding-rpc, then cherry-pick first patch in binding-rpc topic (if it exists) +if [[ "${PATCHES_TO_BUILD}" == *"topic"* ]]; then + if [[ "${PATCHES_TO_BUILD}" == *"topic="* ]]; then + CHERRY_PICK="false" + TOPIC="${PATCHES_TO_BUILD#*=}" + elif [[ "${PATCHES_TO_BUILD}" == *"topic:"* ]]; then + CHERRY_PICK="true" + TOPIC="${PATCHES_TO_BUILD#*:}" + else + echo "ERROR: Topic has wrong format" && exit 1 + fi echo "Create topic ${TOPIC} patch list" PATCHES_TO_BUILD="" read -ra PROJECT_LIST <<< "${BUILD_ORDER}" @@ -76,9 +86,16 @@ if [[ "${PATCHES_TO_BUILD}" == *topic* ]]; then IFS=$'\n' SORT_REF=$(sort <<<"${REF_LIST[*]}") && unset IFS read -rd '' -a SORT_REF_LIST <<< "${SORT_REF[*]}" || true # add refspec to patches to build list + COUNT=0 for PATCH in "${SORT_REF_LIST[@]}"; do - # cherry-pick is better than checkout patch - PATCHES_TO_BUILD="${PATCHES_TO_BUILD}:${PATCH/*-/}" + COUNT=$((COUNT+1)) + if [ "${COUNT}" == "1" ] && [ "${CHERRY_PICK}" == "false" ]; then + # checkout patch + PATCHES_TO_BUILD="${PATCHES_TO_BUILD}=${PATCH/*-/}" + else + # cherry-pick is better than checkout patch + PATCHES_TO_BUILD="${PATCHES_TO_BUILD}:${PATCH/*-/}" + fi done fi done