1 # create a fresh empty place to build this custom distribution
2 BUILD_DIR=${WORKSPACE}/patch_tester
3 POM_FILE=${WORKSPACE}/patch_tester/pom.xml
9 # create a root pom that will contain a module for each project we have a patch for
10 echo "<project>" >> $POM_FILE
11 echo "<groupId>org.opendaylight.test</groupId>" >> $POM_FILE
12 echo "<artifactId>test</artifactId>" >> $POM_FILE
13 echo "<version>0.1</version>" >> $POM_FILE
14 echo "<modelVersion>4.0.0</modelVersion>" >> $POM_FILE
15 echo "<packaging>pom</packaging>" >> $POM_FILE
16 echo "<modules>" >> $POM_FILE
18 IFS=',' read -ra PATCHES <<< "${PATCHES_TO_BUILD}"
20 # for each patch, clone the project, and fetch/checkout the patch set.
21 # each patch is found in the ${PATCHES_TO_BUILD} variable as a comma
22 # separated list of project:changeset values
23 # Example: PATCHES_TO_BUILD=snmp:97/27997/1,tcpmd5:91/26391/3
25 # TODO: this version will not handle multiple patches from the same project and will be
26 # done at a later time. cherry-picking will be needed, with more complex logic
27 # TODO: Another enchancement will be to allow distribution patches.
29 for i in "${PATCHES[@]}"
31 echo "working on ${i}"
32 PROJECT=`echo ${i} | cut -d\: -f 1`
33 PATCH=`echo ${i} | cut -d\: -f 2`
34 echo "<module>${PROJECT}</module>" >> $POM_FILE
35 echo "cloning ${PROJECT} and checking out ${PATCH}"
36 git clone https://git.opendaylight.org/gerrit/p/${PROJECT}
38 git fetch https://git.opendaylight.org/gerrit/${PROJECT} refs/changes/${PATCH}
39 git checkout FETCH_HEAD
44 # clone distribution and add it as a module in root pom
45 git clone https://git.opendaylight.org/gerrit/p/integration/distribution
47 echo "<module>distribution</module>" >> $POM_FILE
48 echo "</modules>" >> $POM_FILE
49 echo "</project>" >> $POM_FILE
51 # Extract the BUNDLEVERSION from the distribution pom.xml
52 BUNDLEVERSION=`xpath $BUILD_DIR/distribution/pom.xml '/project/version/text()' 2> /dev/null`
53 echo "Bundle version is ${BUNDLEVERSION}"
55 BUNDLEURL=${BUILD_URL}org.opendaylight.integration\$distribution-karaf/artifact/org.opendaylight.integration/distribution-karaf/${BUNDLEVERSION}/distribution-karaf-${BUNDLEVERSION}.zip
56 echo "Bundle url is ${BUNDLEURL}"
58 # Set BUNDLEVERSION & BUNDLEURL
59 echo BUNDLEVERSION=${BUNDLEVERSION} > ${WORKSPACE}/bundle.txt
60 echo BUNDLEURL=${BUNDLEURL} >> ${WORKSPACE}/bundle.txt