summaryrefslogtreecommitdiff
path: root/src/moz_version.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/moz_version.py')
-rw-r--r--src/moz_version.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/moz_version.py b/src/moz_version.py
index 832d65f..24c4680 100644
--- a/src/moz_version.py
+++ b/src/moz_version.py
@@ -124,6 +124,17 @@ def extract_upstream_version(debian_version):
del parts[-1]
upstream_version = '-'.join(parts)
+ # remove epoch
+ parts = upstream_version.split(':')
+ if len(parts) > 1:
+ del parts[0]
+ upstream_version = ':'.join(parts)
+
+ return upstream_version
+
+def convert_debian_to_moz_version(debian_version, verbose=False):
+ upstream_version = extract_upstream_version(debian_version)
+
# compatibility: strip +nobinonly and +build
parts = upstream_version.split('+')
if len(parts) > 1 and parts[-1] == "nobinonly":
@@ -132,9 +143,23 @@ def extract_upstream_version(debian_version):
del parts[-1]
upstream_version = '+'.join(parts)
- return upstream_version
-
-def convert_debian_to_moz_version(debian_version, verbose=False):
- upstream_version = extract_upstream_version(debian_version)
moz_version = upstream_version.replace("~", "")
return moz_version
+
+def convert_moz_to_debian_version(moz_version, epoch=0, verbose=False):
+ parts = decode_version(moz_version, verbose)
+ # tranform parts
+ for i in xrange(len(parts)):
+ (number_a, string_b, number_c, string_d) = parts[i]
+ part = ""
+ if string_d != "":
+ part = "~" + string_d
+ if number_c != 0 or string_d != "":
+ part = str(number_c) + part
+ if string_b != "":
+ part = "~" + string_b + part
+ parts[i] = str(number_a) + part
+ debian_version = ".".join(parts)
+ if epoch != 0:
+ debian_version = str(epoch) + ":" + debian_version
+ return debian_version