Commit 131f7f7c authored by Simon McVittie's avatar Simon McVittie

Merge branch 'handle-no-native-to-native' into 'master'

deb-git-version-gen: Handle switching from non-native to native

See merge request smcv/deb-build-snapshot!3
parents 825a0738 d46b7564
Pipeline #6816 passed with stages
in 1 minute and 34 seconds
......@@ -372,14 +372,25 @@ class Versioner:
# describes a corresponding Debian revision: go with that
snapshot_version = changelog_version
elif is_upstream or is_native:
# VVV+NN+gCCCCCCC-0~snapshot
snapshot_version.upstream_version = '{}{}'.format(
snapshot_version.upstream_version, snapshot_marker)
if not is_native:
# we need some sort of Debian revision number, and the one
# in the changelog is meaningless because we've bumped the
# upstream version
snapshot_version.debian_revision = '0~snapshot'
if is_native and snapshot_version.debian_revision is not None:
# Rare special case: we are switching a non-native package
# to be native, so we need to get rid of the Debian revision.
# Replace VVV-WW with VVV+WW+gCCCCCCC
snapshot_version.upstream_version = '{}+{}{}'.format(
snapshot_version.upstream_version,
snapshot_version.debian_revision,
snapshot_marker,
)
snapshot_version.debian_revision = None
else:
# VVV+NN+gCCCCCCC
snapshot_version.upstream_version = '{}{}'.format(
snapshot_version.upstream_version, snapshot_marker)
if not is_native:
# We need some sort of Debian revision number, and the one
# in the changelog is meaningless because we've bumped the
# upstream version, so use VVV+WW+gCCCCCCC-0~snapshot
snapshot_version.debian_revision = '0~snapshot'
elif snapshot_version.debian_revision is None:
# Rare special case: we are going from a native version
# VVV to a non-native version VVV-WW. Use VVV-0+NN+gCCCCCCC,
......@@ -391,6 +402,9 @@ class Versioner:
snapshot_version.debian_revision = '{}{}'.format(
snapshot_version.debian_revision, snapshot_marker)
assert is_native or snapshot_version.debian_revision is not None
assert not is_native or snapshot_version.debian_revision is None
if (tagged_version is not None and
changelog_version.upstream_version
!= Version(tagged_version).upstream_version):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment