aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2023-05-01 17:51:40 +0200
committerGuido Günther <agx@sigxcpu.org>2023-05-01 18:49:57 +0200
commita420bc9a4d13037354278e44b69c2d6d35ff6a02 (patch)
treec3b5f86125f02b7be0a4ada63a81a7e9e492d7a5
parent29370b5e4f7df53f921ba4fb88d687a768f6bd71 (diff)
gbp/deb/git: Dont' strip ~ patterns unconditionally
They're needed when packaging upstream beta versions. So use a positive list instead. Fixes: a5575e178639a8e167c7f3090263a03b362e05e7
-rw-r--r--gbp/deb/git.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/gbp/deb/git.py b/gbp/deb/git.py
index dffa978b..24f24d62 100644
--- a/gbp/deb/git.py
+++ b/gbp/deb/git.py
@@ -33,6 +33,8 @@ class DebianGitRepository(PkgGitRepository):
"""A git repository that holds the source of a Debian package"""
version_mangle_re = PkgPolicy.version_mangle_re
+ # Extensions to strip from version numbers
+ splitexts = ['repack', 'py', 'dfsg', 'ds']
def __init__(self, *args, **kwargs):
super(DebianGitRepository, self).__init__(*args, **kwargs)
@@ -149,6 +151,9 @@ class DebianGitRepository(PkgGitRepository):
... "2.3+really2.2")
('2.2', None)
>>> DebianGitRepository._upstream_version_from_debian_upstream(
+ ... "42~beta1")
+ ('42~beta1', None)
+ >>> DebianGitRepository._upstream_version_from_debian_upstream(
... "4.99.4+dfsg+really4.10.0+py3")
('4.10.0', None)
>>> DebianGitRepository._upstream_version_from_debian_upstream(
@@ -160,6 +165,9 @@ class DebianGitRepository(PkgGitRepository):
>>> DebianGitRepository._upstream_version_from_debian_upstream(
... "1.1.0+really1.0.0+git20181028.94f6ae3")
(None, '94f6ae3')
+ >>> DebianGitRepository._upstream_version_from_debian_upstream(
+ ... "1.1.0")
+ ('1.1.0', None)
"""
# If version starts with an epoch, remove it.
@@ -177,8 +185,8 @@ class DebianGitRepository(PkgGitRepository):
if m:
return (None, m.group(2))
- # Strip off anything starting with [+~] and return the rest.
- return (re.split(r'[+~]', version)[0], None)
+ # Strip off common extensions starting with [+~] and return the rest.
+ return (re.split(r'[+~]({})'.format('|'.join(cls.splitexts)), version)[0], None)
@staticmethod
def _build_legacy_tag(format, version):