forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetnextversion.sh
More file actions
executable file
·154 lines (125 loc) · 4.64 KB
/
setnextversion.sh
File metadata and controls
executable file
·154 lines (125 loc) · 4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
usage() {
cat << USAGE
Usage: setnextversion.sh --version string [OPTIONS]...
Set the next version of CloudStack in the POMs.
Mandatory arguments:
-v, --version string Set the next version to be applied
Optional arguments:
-b, --branch string Set the branch to update the version into (default "main")
-s, --sourcedir string Set the source directory to clone repo into (default "$sourcedir")
-n, --no-commit Apply only the version change and don't git commit them (default "false")
Other arguments:
-h, --help Display this help message and exit
Examples:
setnextversion.sh --version x.y.z.a-SNAPSHOT
setnextversion.sh --version x.y.z.a-SNAPSHOT --branch foo-feature
setnextversion.sh --version x.y.z.a-SNAPSHOT --sourcedir /path/to/cloudstack/repo
setnextversion.sh --version x.y.z.a-SNAPSHOT --no-commit
USAGE
exit 0
}
while [ -n "$1" ]; do
case "$1" in
-h | --help)
usage
;;
-v | --version)
if [ -n "$version" ]; then
echo "ERROR: you have already entered value for -v, --version"
exit 1
else
version=$2
shift 2
fi
;;
-b | --branch)
if [ -n "$branch" ]; then
echo "ERROR: you have already entered value for -b, --branch"
exit 1
else
branch=$2
shift 2
fi
;;
-s | --sourcedir)
if [ -n "$sourcedir" ]; then
echo "ERROR: you have already entered value for -s, --sourcedir"
exit 1
else
sourcedir=$2
shift 2
fi
;;
-n | --no-commit)
if [ "$nocommit" == "true" ]; then
echo "ERROR: you have already entered value for -n, --no-commit"
exit 1
else
nocommit="true"
shift 1
fi
;;
-*|*)
echo "ERROR: no such option $1. -h or --help for help"
exit 1
;;
esac
done
if [ -z "$version" ]; then
echo >&2 "A version must be specified with the -v, --version option: $0 -v 4.0.0.RC1"
exit 1
fi
if [ -z "$branch" ]; then
branch="main"
fi
if [ -z "$sourcedir" ]; then
sourcedir="~/cloudstack/"
fi
if [ -z "$nocommit" ]; then
nocommit="false"
fi
echo "Using version : $version"
echo "Using source directory : $sourcedir"
echo "Using branch : $branch"
cd $sourcedir
echo "checking out correct branch"
git checkout $branch
echo "determining current POM version"
export currentversion=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -B | grep -v '\['`
echo "found $currentversion"
echo "setting new version numbers"
mvn versions:set -DnewVersion=$version -P vmware -P developer -P systemvm -P simulator -Dnoredist versions:commit
perl -pi -e "s/$currentversion/$version/" debian/changelog
perl -pi -e "s/$currentversion/$version/" tools/checkstyle/pom.xml
perl -pi -e "s/$currentversion/$version/" tools/marvin/setup.py
# Dockerfiles
perl -pi -e "s/Version=\"$currentversion\"/Version=\"$version\"/" tools/docker/Dockerfile
# Marvin Dockerfiles
perl -pi -e "s/Version=\"$currentversion\"/Version=\"$version\"/" tools/docker/Dockerfile.marvin
perl -pi -e "s/Marvin-(.*).tar.gz/Marvin-${version}.tar.gz/" tools/docker/Dockerfile.marvin
# systemtpl.sh: system vm template version without -SNAPSHOT
git clean -f
if [ "$nocommit" == "false" ]; then
echo "commit changes"
git commit -a -s -m "Updating pom.xml version numbers for release $version"
export commitsh=`git show HEAD | head -n 1 | cut -d ' ' -f 2`
echo "committed as $commitsh"
fi