Gary Wu | fd17bf6 | 2018-08-24 15:43:28 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2017 Huawei Technologies Co., Ltd. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | cat projects.txt | grep -v oparent | grep -v doc | grep -v ci-management | while read p; do |
| 12 | pushd $p |
| 13 | |
| 14 | #git fetch origin |
| 15 | #git reset --hard origin |
| 16 | for pom in $(find -name pom.xml); do |
| 17 | git checkout origin/master -- $pom |
| 18 | dos2unix < $pom | cmp -s - $pom |
| 19 | IS_DOS=$? |
| 20 | if grep -q "oparent" $pom; then |
| 21 | 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 |
| 22 | sed -i 's/^[ \t]*$//' $pom |
| 23 | fi |
| 24 | if grep -q "guava" $pom; then |
| 25 | 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 |
| 26 | sed -i 's/^[ \t]*$//' $pom |
| 27 | fi |
| 28 | if [ $IS_DOS -ne 0 ]; then |
| 29 | unix2dos $pom |
| 30 | fi |
| 31 | done |
| 32 | git --no-pager diff |
| 33 | |
| 34 | |
| 35 | if [ $(git rev-parse HEAD) == $(git rev-parse @{u}) ]; then |
| 36 | |
| 37 | git commit -a -s -m 'Use managed guava version |
| 38 | |
| 39 | Use centrally managed guava version specified in |
| 40 | oparent. Includes upgrade to oparent 1.2.0. |
| 41 | |
| 42 | This change was submitted by script and may include |
| 43 | additional whitespace or formatting changes. |
| 44 | |
| 45 | Issue-ID: INT-619 |
| 46 | ' |
| 47 | else |
| 48 | git commit -a -s --amend --no-edit |
| 49 | fi |
| 50 | git review -r origin -D |
| 51 | popd |
| 52 | done |