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
This commit is contained in:
Oliver Smith 2023-09-12 17:03:04 +02:00
parent d27ba27a55
commit 3970487882
3 changed files with 19 additions and 0 deletions

View File

@ -18,6 +18,7 @@ RUN apt-get update && \
libxml2-utils \
meson \
osc \
python3-packaging \
python3-setuptools \
rebar3 \
sed \

View File

@ -25,6 +25,7 @@ required_programs = [
]
required_python_modules = [
"packaging",
"setuptools",
]

View File

@ -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