blob: aec665ee925dd6323cbfec4cf145e2cc7c7b50cd [file] [log] [blame]
Gary Wufd17bf62018-08-24 15:43:28 -07001#!/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#
11cat 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
39Use centrally managed guava version specified in
40oparent. Includes upgrade to oparent 1.2.0.
41
42This change was submitted by script and may include
43additional whitespace or formatting changes.
44
45Issue-ID: INT-619
46'
47 else
48 git commit -a -s --amend --no-edit
49 fi
50 git review -r origin -D
51 popd
52done