From: Joerg Jaspert Date: Wed, 23 Apr 2008 23:22:36 +0000 (+0200) Subject: Merge from Thomas X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=ebc80c6941140d9d81a18069d45097478c8d1c60;hp=d3bfcc6bffe3518df04e203ee9789bb82587c53a;p=dak.git Merge from Thomas --- diff --git a/ChangeLog b/ChangeLog index 4f72b591..8aef43b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-04-23 Thomas Viehmann + + * dak/process_unchecked.py: add changes["sponsoremail"] + for sponsored uploads if desired + * daklib/utils.py: add functions + is_email_alias to check which accounts allow email forwarding and + which_alias_file to find the alias file + 2008-04-22 Joerg Jaspert * setup/init_pool.sql: added a function/aggregate for the release @@ -12,7 +20,7 @@ dumps, using a scheme to keep more of the recent dumps. * config/debian/cron.daily: Use the new script. Also - compress - all files older than 7 days, instead of 30. + all files older than 7 days, instead of 30. * dak/process_accepted.py (install): Do not break if a source/maintainer combination is already in src_uploaders, "just" diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index 30737ed1..d33408cf 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -1072,6 +1072,8 @@ def check_signed_by_key(): if uid_name == "": sponsored = 1 else: sponsored = 1 + if daklib.utils.is_email_alias(uid_email): + changes["sponsoremail"] = uid_email if sponsored and not may_sponsor: reject("%s is not authorised to sponsor uploads" % (uid)) diff --git a/daklib/queue.py b/daklib/queue.py index 9fac0cc0..a5a8eab4 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -279,6 +279,8 @@ class Upload: Subst["__MAINTAINER_FROM__"] = changes["changedby2047"] Subst["__MAINTAINER_TO__"] = "%s, %s" % (changes["changedby2047"], changes["maintainer2047"]) + if "sponsoremail" in changes: + Subst["__MAINTAINER_TO__"] += ", %s"%changes["sponsoremail"] Subst["__MAINTAINER__"] = changes.get("changed-by", "Unknown") else: Subst["__MAINTAINER_FROM__"] = changes["maintainer2047"] diff --git a/daklib/utils.py b/daklib/utils.py index 16cc1ff1..c4c55723 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -59,6 +59,8 @@ tried_too_hard_exc = "Tried too hard to find a free filename." default_config = "/etc/dak/dak.conf" default_apt_config = "/etc/dak/apt.conf" +alias_cache = None + ################################################################################ class Error(Exception): @@ -468,6 +470,14 @@ def which_apt_conf_file (): else: return default_apt_config +def which_alias_file(): + hostname = socket.gethostbyaddr(socket.gethostname())[0] + aliasfn = '/var/lib/misc/'+hostname+'/forward-alias' + if os.path.exists(aliasfn): + return aliasfn + else: + return None + ################################################################################ # Escape characters which have meaning to SQL's regex comparison operator ('~') @@ -1148,6 +1158,21 @@ If 'dotprefix' is non-null, the filename will be prefixed with a '.'.""" ################################################################################ +# checks if the user part of the email is listed in the alias file + +def is_email_alias(email): + global alias_cache + if alias_cache == None: + aliasfn = which_alias_file() + alias_cache = set() + if aliasfn: + for l in open(aliasfn): + alias_cache.add(l.split(':')[0]) + uid = email.split('@')[0] + return uid in alias_cache + +################################################################################ + apt_pkg.init() Cnf = apt_pkg.newConfiguration()