]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
buildpackages: populate version file with RPM version
authorNathan Cutler <ncutler@suse.com>
Fri, 10 Feb 2017 22:09:02 +0000 (23:09 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Mon, 14 Oct 2019 14:47:01 +0000 (16:47 +0200)
Until now, the "version" file contained a string like 10.2.5-6244-g9027e75

The RPM version obtained by doing "rpm -q $PKG --qf %{VERSION}-%{RELEASE}"
looks like this: 10.2.5-6244.g9027e75

When teuthology compares these two strings, they don't match even though
the version numbers are effectively the same.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
teuthology/task/buildpackages/make-rpm.sh

index f0286628306bda012f0f70f50f6a72a6be434035..9555afb1d40350a5f66d9898713b1b437eca1b62 100755 (executable)
@@ -52,9 +52,18 @@ releasedir=$base/$distro/WORKDIR
 # a) human readable
 # b) is unique for each commit
 # c) compares higher than any previous commit
+#    WAIT, c) DOES NOT HOLD:
+#    >>> print 'v10.2.5-7-g000000' < 'v10.2.5-8-g000000'
+#    True
+#    >>> print 'v10.2.5-9-g000000' < 'v10.2.5-10-g000000'
+#    False
 # d) contains the short hash of the commit
 #
-vers=$(git describe --match "v*" | sed s/^v//)
+# Regardless, we use it for the RPM version number, but strip the leading 'v'
+# and replace the '-' before the 'g000000' with a '.' to match the output of
+# "rpm -q $PKG --qf %{VERSION}-%{RELEASE}"
+#
+vers=$(git describe --match "v*" | sed -r -e 's/^v//' -e 's/\-([[:digit:]]+)\-g/\-\1\.g/')
 ceph_dir=$(pwd)
 
 #