Add a dependency-version-bumping script 75/81575/2
authorStephen Kitt <skitt@redhat.com>
Thu, 11 Apr 2019 17:01:31 +0000 (19:01 +0200)
committerStephen Kitt <skitt@redhat.com>
Fri, 12 Apr 2019 07:57:17 +0000 (09:57 +0200)
Change-Id: I7659eb6a045a074039ee2f3a6985f4aec0afd3eb
Signed-off-by: Stephen Kitt <skitt@redhat.com>
scripts/bump-odl-version [new file with mode: 0755]

diff --git a/scripts/bump-odl-version b/scripts/bump-odl-version
new file mode 100755 (executable)
index 0000000..5a042ff
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Copyright © 2019 Red Hat, Inc. and others.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
+
+if [ $# -ne 3 ]; then
+    echo "Usage: $0 <project> <current version> <target version>"
+    echo "Bumps all dependencies on the given project from <current version>"
+    echo "to <target version>."
+    echo "E.g. $0 odlparent 3.0.2 3.1.0-SNAPSHOT"
+    exit 1
+fi
+
+project=$1
+curver=$2
+target=$3
+
+# We use find/grep instead of git grep to allow running this on
+# multiple repositories
+for file in $(find . -type f -name pom.xml | xargs grep -l ${curver})
+do
+    echo -n Processing ${file}...
+    xmlstarlet ed -P -L -N mvn=http://maven.apache.org/POM/4.0.0 -u //mvn:version[../mvn:groupId=\"org.opendaylight.${project}\"] -v ${target} ${file}
+    echo " done."
+done