]> err.no Git - dak/commitdiff
send mails to sponsors
authorThomas Viehmann <tv@beamnet.de>
Tue, 22 Apr 2008 22:40:23 +0000 (22:40 +0000)
committerThomas Viehmann <tv@beamnet.de>
Tue, 22 Apr 2008 22:40:23 +0000 (22:40 +0000)
dak/process_unchecked.py
daklib/queue.py
daklib/utils.py

index 30737ed1252fb7d7996d1612541798ad76d87db4..d33408cfa229d1829a6a91694d8bb1943a11cd61 100755 (executable)
@@ -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))
index 05cd0be0a2d142f4c74d7552512e21defdcb6a6d..7b3aba09d080e23f5413492e52f1ee778879b0b7 100755 (executable)
@@ -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"]
index 16cc1ff16ed54df640d0ccbfb1da8e5879e4eef2..f2024b98efef662f25ecdf7411f2352c92607431 100755 (executable)
@@ -468,6 +468,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 +1156,20 @@ 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):
+  aliasfn = which_alias_file()
+  uid = email.split('@')[0]
+  if not aliasfn:
+      return False
+  for l in open(aliasfn):
+      if l.startswith(uid+': '):
+          return True
+  return False
+
+################################################################################
+
 apt_pkg.init()
 
 Cnf = apt_pkg.newConfiguration()