aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/obs/data/build_srcpkg.Dockerfile1
-rw-r--r--scripts/obs/lib/config.py1
-rw-r--r--scripts/obs/lib/debian.py17
3 files changed, 19 insertions, 0 deletions
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 @@ RUN apt-get update && \
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_programs = [
]
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 shlex
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 @@ def changelog_add_entry_if_needed(project, version):
""" 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