aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYang Xu <yang.xu3@huawei.com>2018-08-29 00:51:36 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-29 00:51:36 +0000
commitc3182f68df326e1de45e3d4c38fbf64e650232f9 (patch)
tree8359e5bf2ee5e11aded7f48f5768e5c758380fc1
parent60e0a22e835887d06d266707cc6c0787ef42fb73 (diff)
parentfd17bf6d75a185aa647af21a4c29f76179fa290c (diff)
Merge "Script to upgrade oparent in all projects"
-rwxr-xr-xversion-manifest/src/main/scripts/upgrade-oparent.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/version-manifest/src/main/scripts/upgrade-oparent.sh b/version-manifest/src/main/scripts/upgrade-oparent.sh
new file mode 100755
index 000000000..aec665ee9
--- /dev/null
+++ b/version-manifest/src/main/scripts/upgrade-oparent.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# Copyright 2017 Huawei Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+cat projects.txt | grep -v oparent | grep -v doc | grep -v ci-management | while read p; do
+ pushd $p
+
+ #git fetch origin
+ #git reset --hard origin
+ for pom in $(find -name pom.xml); do
+ git checkout origin/master -- $pom
+ dos2unix < $pom | cmp -s - $pom
+ IS_DOS=$?
+ if grep -q "oparent" $pom; then
+ xmlstarlet ed -L -P -N ns="http://maven.apache.org/POM/4.0.0" -u '/_:project/_:parent[_:groupId="org.onap.oparent" and _:artifactId="oparent"]/_:version' -v '1.2.0' $pom
+ sed -i 's/^[ \t]*$//' $pom
+ fi
+ if grep -q "guava" $pom; then
+ xmlstarlet ed -L -P -N ns="http://maven.apache.org/POM/4.0.0" -d '//_:dependency[_:groupId="com.google.guava" and _:artifactId="guava"]/_:version' $pom
+ sed -i 's/^[ \t]*$//' $pom
+ fi
+ if [ $IS_DOS -ne 0 ]; then
+ unix2dos $pom
+ fi
+ done
+ git --no-pager diff
+
+
+ if [ $(git rev-parse HEAD) == $(git rev-parse @{u}) ]; then
+
+ git commit -a -s -m 'Use managed guava version
+
+Use centrally managed guava version specified in
+oparent. Includes upgrade to oparent 1.2.0.
+
+This change was submitted by script and may include
+additional whitespace or formatting changes.
+
+Issue-ID: INT-619
+'
+ else
+ git commit -a -s --amend --no-edit
+ fi
+ git review -r origin -D
+ popd
+done