diff options
author | Oliver Smith <osmith@sysmocom.de> | 2023-09-12 17:03:04 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2023-09-12 17:31:45 +0200 |
commit | 39704878820d4381c4da675f3958452945b95a12 (patch) | |
tree | c242e4297659f7f9dffc5c88f52cd21c240fa8ee | |
parent | d27ba27a55effaf13f51fb77cf5e3401b6244537 (diff) |
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
-rw-r--r-- | scripts/obs/data/build_srcpkg.Dockerfile | 1 | ||||
-rw-r--r-- | scripts/obs/lib/config.py | 1 | ||||
-rw-r--r-- | scripts/obs/lib/debian.py | 17 |
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 |