From 3d494da55b2c55a4027ecb2aece45dee0f5bbb9a Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sun, 11 Jan 2015 11:17:09 +0100 Subject: reproducible: common: add a strip_epoch() function --- bin/reproducible_common.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'bin') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index 25ae07b5..11b02f8d 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -226,6 +226,21 @@ def join_status_icon(status, package=None, version=None): ') not recognized') return (status, '') +def strip_epoch(version): + """ + Stip the epoch out of the version string. Some file (e.g. buildlogs, debs) + do not have epoch in their filenames. + This recognize a epoch if there is a colon in the second or third character + of the version. + """ + try: + if version[1] == ':' or version[2] == ':': + return version.split(':', 1)[1] + else: + return version + except IndexError: + return version + # do the db querying conn = init_conn() -- cgit v1.2.3-70-g09d2