osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ci/+/34395?usp=email )
Change subject: OBS: don't downgrade version in debian/changelog
......................................................................
OBS: don't downgrade version in debian/changelog
Fix the bug that the version in debian/changelog could get lowered if a
release was made and the release git tag was not pushed yet.
Fixes: OS#6173
Change-Id: I550ed10a60c863626d870e35034028f0bd066211
---
M scripts/obs/data/build_srcpkg.Dockerfile
M scripts/obs/lib/config.py
M scripts/obs/lib/debian.py
3 files changed, 32 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/95/34395/1
diff --git a/scripts/obs/data/build_srcpkg.Dockerfile
b/scripts/obs/data/build_srcpkg.Dockerfile
index 75482bc..5475a94 100644
--- a/scripts/obs/data/build_srcpkg.Dockerfile
+++ b/scripts/obs/data/build_srcpkg.Dockerfile
@@ -18,6 +18,7 @@
libxml2-utils \
meson \
osc \
+ python3-packaging \
python3-setuptools \
rebar3 \
sed \
diff --git a/scripts/obs/lib/config.py b/scripts/obs/lib/config.py
index 038122b..3a3e9ad 100644
--- a/scripts/obs/lib/config.py
+++ b/scripts/obs/lib/config.py
@@ -25,6 +25,7 @@
]
required_python_modules = [
+ "packaging",
"setuptools",
]
diff --git a/scripts/obs/lib/debian.py b/scripts/obs/lib/debian.py
index 8a82e16..2995185 100644
--- a/scripts/obs/lib/debian.py
+++ b/scripts/obs/lib/debian.py
@@ -7,6 +7,13 @@
import lib
import lib.git
+# Imports that may not be available during startup, ignore it here and rely on
+# lib.check_required_programs() checking this later on (possibly after the
+# script executed itself in docker if using --docker).
+try:
+ import packaging.version
+except ImportError:
+ pass
def control_add_depend(project, pkgname, version):
""" :param pkgname: of the meta-package to depend on (e.g.
osmocom-nightly)
@@ -89,6 +96,16 @@
""" Adjust the changelog if the version in the changelog is different
from
the given version. """
version_changelog = get_last_version_from_changelog(project)
+
+ # Don't use a lower number (OS#6173)
+ if packaging.version.parse(version_changelog.split("-")[0]) > \
+ packaging.version.parse(version.split("-")[0]):
+ print(f"{project}: WARNING: version from changelog"
+ f" ({version_changelog}) is higher than version based on git
tag"
+ f" ({version}), using version from changelog (git tag not
pushed"
+ " yet?)")
+ return
+
if version_changelog == version:
return
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ci/+/34395?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I550ed10a60c863626d870e35034028f0bd066211
Gerrit-Change-Number: 34395
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange