Fix bug when minor version number goes beyond 9
The upstream version determination might pick the wrong version if
a minor version was a prefix of another minor version. Observed when
going from EGit 5.9 to 5.10: the build would pick a JGit 5.1.* version
instead of 5.10.0 as upstream version.
Fix by including the period after the minor version in the prefix that
we check against our own version. Since "5.1." is not a prefix of
"5.10.", this will now pick the correct upstream version.
Change-Id: I0d8af8f938ac9f56448679badd1557de3d2dd8de
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
diff --git a/src/org/eclipse/egit/jenkins/Lib.groovy b/src/org/eclipse/egit/jenkins/Lib.groovy
index ba1cc35..c646a7c 100644
--- a/src/org/eclipse/egit/jenkins/Lib.groovy
+++ b/src/org/eclipse/egit/jenkins/Lib.groovy
@@ -87,7 +87,7 @@
def isRelease = ownVersion.endsWith('-r')
for (int i = tags.length - 1; i >= 0; i--) {
def t = tags[i].trim()
- def m = t =~ /.*refs\/tags\/v(\d+\.\d+)\.(\d+)\.(\d+)(-.*)/
+ def m = t =~ /.*refs\/tags\/v(\d+\.\d+\.)(\d+)\.(\d+)(-.*)/
if (m && ownVersion.startsWith(m[0][1])) {
if (isRelease && !t.endsWith('-r')) {
continue
@@ -97,10 +97,10 @@
if (patch > max) {
max = patch
maxTime = date
- tag = m[0][1] + '.' + m[0][2] + '.' + m[0][3] + m[0][4]
+ tag = m[0][1] + m[0][2] + '.' + m[0][3] + m[0][4]
} else if (patch == max && date > maxTime) {
maxTime = date
- tag = m[0][1] + '.' + m[0][2] + '.' + m[0][3] + m[0][4]
+ tag = m[0][1] + m[0][2] + '.' + m[0][3] + m[0][4]
}
}
}
@@ -118,12 +118,12 @@
def version = ownVersion
int max = -1
for (int i = 0; i < data.length; i++) {
- def m = data[i] =~ /<a href="[^"]*\/(\d+\.\d+)\.(\d+)-SNAPSHOT\/"[^>]*>/
+ def m = data[i] =~ /<a href="[^"]*\/(\d+\.\d+\.)(\d+)-SNAPSHOT\/"[^>]*>/
if (m && ownVersion.startsWith(m[0][1])) {
int patch = m[0][2] as Integer
if (patch > max) {
max = patch
- version = m[0][1] + '.' + m[0][2] + '-SNAPSHOT'
+ version = m[0][1] + m[0][2] + '-SNAPSHOT'
}
}
}