Skip to content

Commit

Permalink
Introduce a new "VERSION_RELEASE" template string for the "genversion…
Browse files Browse the repository at this point in the history
…" script. Also, the "VERSION_FULL" will no longer contain the release number in it
  • Loading branch information
mpatrascoiu committed Jun 10, 2022
1 parent 93da030 commit f3284bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
16 changes: 8 additions & 8 deletions genversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ def __init__(self, major, minor, patch, miniPatch=None, release=None):
self.minor = minor
self.patch = patch
self.miniPatch = miniPatch
self.release = release
self.release = 1

if self.miniPatch is None and release:
self.release = release

if self.patch == None: assert self.miniPatch == None
if self.miniPatch != None: assert self.release == None

def toString(self):
ret = "{0}.{1}".format(self.major, self.minor)
Expand All @@ -58,9 +60,6 @@ def toString(self):
if self.miniPatch is not None:
ret += ".{0}".format(self.miniPatch)

if self.release is not None:
ret += "-{0}".format(self.release)

return ret

class GitDescribe:
Expand All @@ -86,7 +85,7 @@ def parse(self):
potentialHash = parts.split("-")
if potentialHash and potentialHash[-1].startswith("g"):
self.commitHash = potentialHash[-1][1:]
parts = parts[0:(len(parts) - len(self.commitHash) - 2 )]
parts = parts[0:(len(parts) - len(self.commitHash) - 2)]

# Is there a number of commits since tag? Can only exist if hash has been
# found already.
Expand All @@ -97,11 +96,11 @@ def parse(self):
parts = parts[0:(len(parts) - len(tmp[-1]) - 1)]

# Do we have a release version? (e.g.: R_0_8_x-2)
# Set release version only for tags (no commit hash present)
# Note: release version is taken into account only for tags (no commit hash present)
self.release = None
tmp = parts.split("-")
if len(tmp) == 2:
self.release = int(tmp[-1]) if not self.commitHash else None
self.release = int(tmp[-1])
parts = parts[0:(len(parts) - len(tmp[-1]) - 1)]

# Are we using "_", ".", or "-" as delimiter?
Expand Down Expand Up @@ -258,6 +257,7 @@ def main():
["@VERSION_MINOR@", softwareVersion.minor],
["@VERSION_PATCH@", softwareVersion.patch],
["@VERSION_MINIPATCH@", softwareVersion.miniPatch],
["@VERSION_RELEASE@", softwareVersion.release],
["@VERSION_FULL@", softwareVersion.toString()]
]

Expand Down
2 changes: 1 addition & 1 deletion packaging/davix.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Name: davix
Version: @VERSION_FULL@
Release: 1%{?dist}
Release: @VERSION_RELEASE@%{?dist}
Summary: Toolkit for HTTP-based file management
License: LGPLv2+
URL: https://dmc-docs.web.cern.ch/dmc-docs/davix.html
Expand Down
3 changes: 2 additions & 1 deletion packaging/make-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ cp -r packaging/debian "${BUILD_ARENA}/davix-${VERSION_FULL}"
# releases, the changelog has been updated already by the release script.
#-------------------------------------------------------------------------------
MINIPATCH=$(./genversion.py --template-string "@VERSION_MINIPATCH@")
RELEASE=$(./genversion.py --template-string "@VERSION_RELEASE@")

if [[ ! -z "$MINIPATCH" ]]; then
pushd "${BUILD_ARENA}/davix-${VERSION_FULL}/debian"

CURRENT_DATE=$(date -R)
echo "davix (${VERSION_FULL}-1) unstable; urgency=low" >> patched-changelog
echo "davix (${VERSION_FULL}-${RELEASE}) unstable; urgency=low" >> patched-changelog
echo "" >> patched-changelog
echo " * CI build, update to version ${VERSION_FULL}" >> patched-changelog
echo "" >> patched-changelog
Expand Down

0 comments on commit f3284bb

Please sign in to comment.