Remove odlparent-3.0.x jobs
[releng/builder.git] / jjb / integration / multipatch-distribution.sh
index eb61446ec9a3e4829ceff6dd1a7a36c7ecf6e250..5a189d4f4113a17350b704ecfd1947c8294aa51c 100755 (executable)
@@ -5,12 +5,13 @@ set -e
 # create a fresh empty place to build this custom distribution
 BUILD_DIR=${WORKSPACE}/patch_tester
 DISTRIBUTION_BRANCH_TO_BUILD=$DISTROBRANCH  #renaming variable for clarity
-MAVEN_OPTIONS="$(echo --show-version \
+MAVEN_OPTIONS="${MAVEN_PARAMS} \
+    --show-version \
     --batch-mode \
     -Djenkins \
     -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
     -Dmaven.repo.local=/tmp/r \
-    -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
+    -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r"
 
 rm -rf $BUILD_DIR
 mkdir -p $BUILD_DIR
@@ -43,6 +44,7 @@ if [[ "${PATCHES_TO_BUILD}" == *topic* ]]; then
     echo "Create topic ${TOPIC} patch list"
     PATCHES_TO_BUILD=""
     read -ra PROJECT_LIST <<< "${BUILD_ORDER}"
+    echo "List of projects to check patch in topic: ${PROJECT_LIST[*]}"
     for PROJECT in "${PROJECT_LIST[@]}"; do
         # get all patches number for a topic for a given project
         IFS=$'\n' read -rd '' -a GERRIT_PATCH_LIST <<< "$(ssh -p 29418 jenkins-$SILO@git.opendaylight.org gerrit query status:open topic:${TOPIC} project:${PROJECT} \
@@ -71,12 +73,16 @@ if [[ "${PATCHES_TO_BUILD}" == *topic* ]]; then
             read -rd '' -a SORT_REF_LIST <<< "${SORT_REF[*]}" || true
             # add refspec to patches to build list
             for PATCH in "${SORT_REF_LIST[@]}"; do
-                PATCHES_TO_BUILD="${PATCHES_TO_BUILD}:${PATCH/*-/}"
+                # if project is odlparent or yangtools, do not cherry-pick
+                if [[ "${PROJECT}" == "odlparent" || "${PROJECT}" == "yangtools" ]]; then
+                    PATCHES_TO_BUILD="${PATCHES_TO_BUILD}=${PATCH/*-/}"
+                else
+                    PATCHES_TO_BUILD="${PATCHES_TO_BUILD}:${PATCH/*-/}"
+                fi
             done
         fi
     done
 fi
-
 echo "Patches to build: ${PATCHES_TO_BUILD}"
 IFS=',' read -ra PATCHES <<< "${PATCHES_TO_BUILD}"
 
@@ -162,28 +168,49 @@ fi
 # 2. Extract project MSI version from mdsal project
 # 3. Replace version in patch by MSI version
 # Otherwise release the MRI project
+
 if [[ -d "odlparent" ]]; then
     if [[ -d "mdsal" ]]; then
-        # Extract patch and MSI used version
+        # Extract patch and MSI used odlparent version
         patch_version="$(xpath ./odlparent/odlparent-lite/pom.xml '/project/version/text()' 2> /dev/null)"
         msi_version="$(xpath ./mdsal/pom.xml '/project/parent/version/text()' 2> /dev/null)"
-        # Replace version
+        # Replace odlparent version
         find ./odlparent -name "*.xml" -print0 | xargs -0 sed -i "s/${patch_version}/${msi_version}/g"
+        echo "odlparent project version changed to ${msi_version}"
     else
-        # Release project
+        # Release odlparent
         find ./odlparent -name "*.xml" -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'
+        odlparent_version=${patch_version%"-SNAPSHOT"}
+        echo "odlparent project version changed to ${odlparent_version}"
     fi
 fi
 if [[ -d "yangtools" ]]; then
-        if [[ -d "mdsal" ]]; then
-        # Extract patch and MSI used version
+    if [[ -d "mdsal" ]]; then
+        # Adjust yangtools and odlparent version to mdsal
+        # Extract patch and MSI used yangtools version
         patch_version="$(xpath ./yangtools/pom.xml '/project/version/text()' 2> /dev/null)"
-        msi_version="$(xpath ./mdsal/binding/yang-binding/pom.xml '/project/dependencyManagement/dependencies/dependency/version/text()' 2> /dev/null)"
-        # Replace version
+        msi_version="$(xpath ./mdsal/dom/dom-parent/pom.xml '/project/dependencyManagement/dependencies/dependency[artifactId="yangtools-artifacts"]/version/text()' 2> /dev/null)"
+        # Replace yangtools version
         find ./yangtools -name "*.xml" -print0 | xargs -0 sed -i "s/${patch_version}/${msi_version}/g"
+        echo "yangtools project version changed to ${msi_version}"
+        # Extract patch and MSI used odlparent version
+        patch_version="$(xpath ./yangtools/pom.xml '/project/parent/version/text()' 2> /dev/null)"
+        msi_version="$(xpath ./mdsal/pom.xml '/project/parent/version/text()' 2> /dev/null)"
+        # Replace odlparent version
+        find ./yangtools -name "*.xml" -print0 | xargs -0 sed -i "s/${patch_version}/${msi_version}/g"
+        echo "yangtools project odlparent version changed to ${msi_version}"
     else
-        # Release project
+        # Release yangtools and adjust odlparent version if required
         find ./yangtools -name "*.xml" -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'
+        yangtools_version=${patch_version%"-SddNAPSHOT"}
+        echo "yangtools project version changed to ${yangtools_version}"
+        if [[ -d "odlparent" ]]; then
+            # Extract odlparent version from odlparent
+            patch_version="$(xpath ./yangtools/pom.xml '/project/parent/version/text()' 2> /dev/null)"
+            # Replace odlparent version
+            find ./yangtools -name "*.xml" -print0 | xargs -0 sed -i "s/${patch_version}/${odlparent_version}/g"
+            echo "yangtools project odlparent version changed to ${odlparent_version}"
+        fi
     fi
 fi