summaryrefslogtreecommitdiff
path: root/gbp/rpm/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'gbp/rpm/__init__.py')
-rw-r--r--gbp/rpm/__init__.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
index 22983d2d..d5fa1ee8 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -901,70 +901,4 @@ def string_to_int(val_str):
else:
return int(val_str)
-
-def split_version_str(version):
- """
- Parse full version string and split it into individual "version
- components", i.e. upstreamversion, epoch and release
-
- @param version: full version of a package
- @type version: C{str}
- @return: individual version components
- @rtype: C{dict}
-
- >>> split_version_str("1")
- {'release': None, 'epoch': None, 'upstreamversion': '1'}
- >>> split_version_str("1.2.3-5.3")
- {'release': '5.3', 'epoch': None, 'upstreamversion': '1.2.3'}
- >>> split_version_str("3:1.2.3")
- {'release': None, 'epoch': '3', 'upstreamversion': '1.2.3'}
- >>> split_version_str("3:1-0")
- {'release': '0', 'epoch': '3', 'upstreamversion': '1'}
- """
- ret = {'epoch': None, 'upstreamversion': None, 'release': None}
-
- e_vr = version.split(":", 1)
- if len(e_vr) == 1:
- v_r = e_vr[0].split("-", 1)
- else:
- ret['epoch'] = e_vr[0]
- v_r = e_vr[1].split("-", 1)
- ret['upstreamversion'] = v_r[0]
- if len(v_r) > 1:
- ret['release'] = v_r[1]
-
- return ret
-
-def compose_version_str(evr):
- """
- Compose a full version string from individual "version components",
- i.e. epoch, version and release
-
- @param evr: dict of version components
- @type evr: C{dict} of C{str}
- @return: full version
- @rtype: C{str}
-
- >>> compose_version_str({'epoch': '', 'upstreamversion': '1.0'})
- '1.0'
- >>> compose_version_str({'epoch': '2', 'upstreamversion': '1.0', 'release': None})
- '2:1.0'
- >>> compose_version_str({'epoch': None, 'upstreamversion': '1', 'release': '0'})
- '1-0'
- >>> compose_version_str({'epoch': '2', 'upstreamversion': '1.0', 'release': '2.3'})
- '2:1.0-2.3'
- >>> compose_version_str({'epoch': '2', 'upstreamversion': '', 'release': '2.3'})
- """
- if 'upstreamversion' in evr and evr['upstreamversion']:
- version = ""
- if 'epoch' in evr and evr['epoch']:
- version += "%s:" % evr['epoch']
- version += evr['upstreamversion']
- if 'release' in evr and evr['release']:
- version += "-%s" % evr['release']
- if version:
- return version
- return None
-
-
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: