X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;h=0d22bd1d236ec11b6ccf88c9632f5dd72d95bd68;hb=e2e32f8130e1e9a69acc5a5cb24f9d3de3330a42;hp=c4c55723ddee9f87fc64e3fab805ed4e56688c95;hpb=0b7e4a04a903492745ea03769c78da82bd9fb269;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index c4c55723..0d22bd1d 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -41,6 +41,7 @@ re_multi_line_field = re.compile(r"^\s(.*)") re_taint_free = re.compile(r"^[-+~/\.\w]+$") re_parse_maintainer = re.compile(r"^\s*(\S.*\S)\s*\<([^\>]+)\>") +re_gpg_uid = re.compile('^uid.*<([^>]*)>') re_srchasver = re.compile(r"^(\S+)\s+\((\S+)\)$") re_verwithext = re.compile(r"^(\d+)(?:\.(\d+))(?:\s+\((\S+)\))?$") @@ -60,6 +61,7 @@ default_config = "/etc/dak/dak.conf" default_apt_config = "/etc/dak/apt.conf" alias_cache = None +key_uid_email_cache = {} ################################################################################ @@ -1091,6 +1093,25 @@ used.""" ################################################################################ +def gpg_get_key_addresses(fingerprint): + """retreive email addresses from gpg key uids for a given fingerprint""" + addresses = key_uid_email_cache.get(fingerprint) + if addresses != None: + return addresses + addresses = set() + cmd = "gpg --no-default-keyring %s --fingerprint %s" \ + % (gpg_keyring_args(), fingerprint) + (result, output) = commands.getstatusoutput(cmd) + if result == 0: + for l in output.split('\n'): + m = re_gpg_uid.match(l) + if m: + addresses.add(m.group(1)) + key_uid_email_cache[fingerprint] = addresses + return addresses + +################################################################################ + # Inspired(tm) by http://www.zopelabs.com/cookbook/1022242603 def wrap(paragraph, max_length, prefix=""):