X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;h=4e048d3ccccff4f90f827b47995d0d080684f5f1;hb=3d9c9fe2f794caa47f3bf4b7626f2c84108bf50e;hp=1e182958e3f7a06ae161f3a1f1abc710cd9820c8;hpb=e2110abd8654360401bd66eaf32b16e66a92d059;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index 1e182958..4e048d3c 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -22,7 +22,7 @@ ################################################################################ import codecs, commands, email.Header, os, pwd, re, select, socket, shutil, \ - string, sys, tempfile, traceback + sys, tempfile, traceback import apt_pkg import database @@ -42,6 +42,8 @@ re_taint_free = re.compile(r"^[-+~/\.\w]+$") re_parse_maintainer = re.compile(r"^\s*(\S.*\S)\s*\<([^\>]+)\>") +re_srchasver = re.compile(r"^(\S+)\s+\((\S+)\)$") + changes_parse_error_exc = "Can't parse line in .changes file" invalid_dsc_format_exc = "Invalid .dsc file" nk_format_exc = "Unknown Format: in .changes file" @@ -97,14 +99,6 @@ def our_raw_input(prompt=""): ################################################################################ -def str_isnum (s): - for c in s: - if c not in string.digits: - return 0 - return 1 - -################################################################################ - def extract_component_from_section(section): component = "" @@ -231,6 +225,14 @@ The rules for (signing_rules == 1)-mode are: changes_in.close() changes["filecontents"] = "".join(lines) + if changes.has_key("source"): + # Strip the source version in brackets from the source field, + # put it in the "source-version" field instead. + srcver = re_srchasver.search(changes["source"]) + if srcver: + changes["source"] = srcver.group(1) + changes["source-version"] = srcver.group(2) + if error: raise changes_parse_error_exc, error @@ -616,7 +618,7 @@ argument: orig_filename = filename if filename.endswith(".dak"): - filename = filename[:-6]+".changes" + filename = filename[:-4]+".changes" if not filename.endswith(".changes"): error = "invalid file type; not a changes file"