summaryrefslogtreecommitdiffstats
path: root/jjb/include-update-pom-versions-not-parent.sh
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-10-06 09:52:29 -0400
committerDan Timoney <dtimoney@att.com>2017-10-06 09:52:29 -0400
commita44e0b43309f79a52ee35ca3b51eb2727767c654 (patch)
treeff74c02964d860bbc714a2c799afd47a2cb332da /jjb/include-update-pom-versions-not-parent.sh
parent9e2684749cc71a9335436ab42b05eca8e3fdc82d (diff)
Define new template for subproject release build
Define a new template for subproject release builds that does not update the version tag within the <parent>. This is needed for the oparent-odlparent subproject of oparent, whose parent is an external POM from the OpenDaylight project. Change-Id: I798b0292f17b6b9d5234f147910488e4bb6ecee2 Issue-ID: CIMAN-99 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'jjb/include-update-pom-versions-not-parent.sh')
-rw-r--r--jjb/include-update-pom-versions-not-parent.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/jjb/include-update-pom-versions-not-parent.sh b/jjb/include-update-pom-versions-not-parent.sh
new file mode 100644
index 000000000..ace2350a2
--- /dev/null
+++ b/jjb/include-update-pom-versions-not-parent.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+## Will update POM in workspace with release version
+
+if [ ! -e version.properties ]; then
+ echo "Missing version.properties"
+ exit 1
+fi
+
+## will setup variable release_version
+source ./version.properties
+
+RELEASE_VERSION=$release_version
+
+echo Changing POM version to $RELEASE_VERSION
+
+## handle POM
+for file in $(find . -name pom.xml); do
+ VERSION=$(xpath -q -e '//project/version/text()' $file)
+ PVERSION=$(xpath -q -e '//project/parent/version/text()' $file)
+ echo before changes VERSION=$VERSION PVERSION=$PVERSION file=$file
+ if [ "$VERSION" != "" ]; then
+ awk -v v=$RELEASE_VERSION '
+ /<version>/ {
+ if (! done) {
+ sub(/<version>.*</,"<version>" v "<",$0)
+ done = 1
+ }
+ }
+ { print $0 }
+ ' $file > $file.tmp
+ mv $file.tmp $file
+ fi
+ VERSION=$(xpath -q -e '//project/version/text()' $file)
+ PVERSION=$(xpath -q -e '//project/parent/version/text()' $file)
+ echo after changes VERSION=$VERSION PVERSION=$PVERSION file=$file
+done
+