]> git.decadent.org.uk Git - dak.git/commitdiff
Merge commit 'dak-master/master' into dm_upload_allowed
authorMichael Casadevall <sonicmctails@gmail.com>
Mon, 29 Dec 2008 19:23:07 +0000 (14:23 -0500)
committerMichael Casadevall <sonicmctails@gmail.com>
Mon, 29 Dec 2008 19:23:07 +0000 (14:23 -0500)
Conflicts:

ChangeLog

Signed-off-by: Michael Casadevall <sonicmctails@gmail.com>
ChangeLog
dak/import_keyring.py
dak/import_ldap_fingerprints.py
dak/process_accepted.py
dak/process_unchecked.py
scripts/debian/byhand-dm
setup/init_pool.sql

index 03a60f63510581e3228c29d32385ff4a955fe27f..c3d4a6e23417b7667f24be23e28de0f9ee4f90ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,29 @@
 
        * dak/override.py (main): Handle source-only packages better
 
+2008-12-26  Michael Casadevall <sonicmctails@gmail.com>
+
+        * dak/import_keyring.py - Debrainized the projectb schema w.r.t. to DMs
+                                  Now uses Debian-Maintainer column in uid tabl
+
+        * dak/import_ldap_fingerprints.py - Ditto
+
+        * dak/process_unchecked.py - Same
+
+        * scripts/debian/byhand-dm - See Above
+
+        * setup/init_pool.sql - More of the same
+
+        * dak/process_unchecked.py - Implemented new dm_upload_allowed field in source
+
+        * dak/process_unchecked.py - Fixed bug where dm-upload-allowed would not be respected
+          in cases where only experimental had the DM-Upload-Allowed: yes flag.
+
+        * dak/process_accepted.py - Ditto, also causes new uploads to include uploaders
+          table to properly include all uploads
+
+        * setup/init_pool.sql - Updated schema
+
 2008-12-23  Michael Casadevall <sonicmctails@gmail.com>
 
         * dak/queue_report.py - Added 822 output format
index a70a2e7811b9d8f10b9013efafa3c49867e415d5..d6bdde9aecb4c6faaa2e676298c1c1ef2602a725 100755 (executable)
@@ -173,6 +173,7 @@ def usage (exit_code=0):
   -h, --help                  show this help and exit.
   -L, --import-ldap-users     generate uid entries for keyring from LDAP
   -U, --generate-users FMT    generate uid entries from keyring as FMT"""
+  -d, --debian-maintainer     mark generated uids as debian-maintainers
     sys.exit(exit_code)
 
 
@@ -185,7 +186,8 @@ def main():
     Arguments = [('h',"help","Import-Keyring::Options::Help"),
                  ('L',"import-ldap-users","Import-Keyring::Options::Import-Ldap-Users"),
                  ('U',"generate-users","Import-Keyring::Options::Generate-Users", "HasArg"),
-                ]
+                 ('D',"debian-maintainer","Import-Keyring::Options::Debian-Maintainer"),
+        ]
 
     for i in [ "help", "report-changes", "generate-users", "import-ldap-users" ]:
         if not Cnf.has_key("Import-Keyring::Options::%s" % (i)):
@@ -268,6 +270,11 @@ def main():
     # For the keys in this keyring, add/update any fingerprints that've
     # changed.
 
+    # Determine if we need to set the DM flag
+    is_dm = "no"
+    if Cnf("Import-Keyring::Options::Debian-Maintainer"):
+        is_dm = "yes"
+
     for f in fpr:
         newuid = fpr[f][0]
         newuiduid = db_uid_byid.get(newuid, [None])[0]
@@ -277,9 +284,9 @@ def main():
         if oldfid == -1:
             changes.append((newuiduid, "Added key: %s" % (f)))
             if newuid:
-                projectB.query("INSERT INTO fingerprint (fingerprint, uid, keyring) VALUES ('%s', %d, %d)" % (f, newuid, keyring_id))
+                projectB.query("INSERT INTO fingerprint (fingerprint, uid, keyring, debian_maintainer) VALUES ('%s', %d, %d, %s)" % (f, newuid, keyring_id, is_dm))
             else:
-                projectB.query("INSERT INTO fingerprint (fingerprint, keyring) VALUES ('%s', %d)" % (f, keyring_id))
+                projectB.query("INSERT INTO fingerprint (fingerprint, keyring) VALUES ('%s', %d, %s)" % (f, keyring_id, is_dm))
         else:
             if newuid and olduid != newuid:
                 if olduid != -1:
index b568285357180b6d53a0dc690c3c922e207c6e92..7e754d481987a1f73b50d594cdde51f67d418657 100755 (executable)
@@ -120,11 +120,11 @@ def main():
     db_uid_name = {}
     ldap_fin_uid_id = {}
     q = projectB.query("""
-SELECT f.fingerprint, f.id, u.uid FROM fingerprint f, uid u WHERE f.uid = u.id
+SELECT f.fingerprint, f.id, u.uid, u.debian_maintainer FROM fingerprint f, uid u WHERE f.uid = u.id
  UNION SELECT f.fingerprint, f.id, null FROM fingerprint f where f.uid is null""")
     for i in q.getresult():
         (fingerprint, fingerprint_id, uid) = i
-        db_fin_uid[fingerprint] = (uid, fingerprint_id)
+        db_fin_uid[fingerprint] = (uid, fingerprint_id, debian_maintainer)
 
     q = projectB.query("SELECT id, name FROM uid")
     for i in q.getresult():
@@ -145,14 +145,14 @@ SELECT f.fingerprint, f.id, u.uid FROM fingerprint f, uid u WHERE f.uid = u.id
         for fingerprint in fingerprints:
             ldap_fin_uid_id[fingerprint] = (uid, uid_id)
             if db_fin_uid.has_key(fingerprint):
-                (existing_uid, fingerprint_id) = db_fin_uid[fingerprint]
+                (existing_uid, fingerprint_id, is_dm) = db_fin_uid[fingerprint]
                 if not existing_uid:
                     q = projectB.query("UPDATE fingerprint SET uid = %s WHERE id = %s" % (uid_id, fingerprint_id))
                     print "Assigning %s to 0x%s." % (uid, fingerprint)
                 elif existing_uid == uid:
                     pass
-                elif existing_uid[:3] == "dm:":
-                    q = projectB.query("UPDATE fingerprint SET uid = %s WHERE id = %s" % (uid_id, fingerprint_id))
+                elif is_dm = "t":
+                    q = projectB.query("UPDATE fingerprint SET uid = %s AND debian_maintainer = 'f' WHERE id = %s" % (uid_id, fingerprint_id))
                     print "Promoting DM %s to DD %s with keyid 0x%s." % (existing_uid, uid, fingerprint)
                 else:
                     utils.warn("%s has %s in LDAP, but projectB says it should be %s." % (uid, fingerprint, existing_uid))
index 0d5a5387e3fbcf556c96872608d93cfc843f9005..ea238ef783d1eed36ab0861a27633e820a3cb2d4 100755 (executable)
@@ -298,10 +298,14 @@ def install ():
             filename = files[file]["pool name"] + file
             dsc_component = files[file]["component"]
             dsc_location_id = files[file]["location id"]
+            if dsc.has_key("dm-upload-allowed") and  dsc["dm-upload-allowed"] == "yes":
+                dm_upload_allowed = "true"
+            else:
+                dm_upload_allowed = "false"
             if not files[file].has_key("files id") or not files[file]["files id"]:
                 files[file]["files id"] = database.set_files_id (filename, files[file]["size"], files[file]["md5sum"], files[file]["sha1sum"], files[file]["sha256sum"], dsc_location_id)
-            projectB.query("INSERT INTO source (source, version, maintainer, changedby, file, install_date, sig_fpr) VALUES ('%s', '%s', %d, %d, %d, '%s', %s)"
-                           % (package, version, maintainer_id, changedby_id, files[file]["files id"], install_date, fingerprint_id))
+            projectB.query("INSERT INTO source (source, version, maintainer, changedby, file, install_date, sig_fpr, dm_upload_allowed) VALUES ('%s', '%s', %d, %d, %d, '%s', %s, %s)"
+                           % (package, version, maintainer_id, changedby_id, files[file]["files id"], install_date, fingerprint_id, dm_upload_allowed))
 
             for suite in changes["distribution"].keys():
                 suite_id = database.get_suite_id(suite)
@@ -322,21 +326,20 @@ def install ():
                 projectB.query("INSERT INTO dsc_files (source, file) VALUES (currval('source_id_seq'), %d)" % (files_id))
 
             # Add the src_uploaders to the DB
-            if dsc.get("dm-upload-allowed", "no") == "yes":
-                uploader_ids = [maintainer_id]
-                if dsc.has_key("uploaders"):
-                    for u in dsc["uploaders"].split(","):
-                        u = u.replace("'", "\\'")
-                        u = u.strip()
-                        uploader_ids.append(
-                            database.get_or_set_maintainer_id(u))
-                added_ids = {}
-                for u in uploader_ids:
-                    if added_ids.has_key(u):
-                        utils.warn("Already saw uploader %s for source %s" % (u, package))
-                        continue
-                    added_ids[u]=1
-                    projectB.query("INSERT INTO src_uploaders (source, maintainer) VALUES (currval('source_id_seq'), %d)" % (u))
+            uploader_ids = [maintainer_id]
+            if dsc.has_key("uploaders"):
+                for u in dsc["uploaders"].split(","):
+                    u = u.replace("'", "\\'")
+                    u = u.strip()
+                    uploader_ids.append(
+                        database.get_or_set_maintainer_id(u))
+            added_ids = {}
+            for u in uploader_ids:
+                if added_ids.has_key(u):
+                    utils.warn("Already saw uploader %s for source %s" % (u, package))
+                    continue
+                added_ids[u]=1
+                projectB.query("INSERT INTO src_uploaders (source, maintainer) VALUES (currval('source_id_seq'), %d)" % (u))
 
 
     # Add the .deb files to the DB
index 690c1c115e19a51f66f29244b09c33e6bb8d0684..68a882f85d9ac2dc2d98280e78e840aa9d46c46a 100755 (executable)
@@ -997,7 +997,7 @@ def check_timestamps():
 ################################################################################
 
 def lookup_uid_from_fingerprint(fpr):
-    q = Upload.projectB.query("SELECT u.uid, u.name FROM fingerprint f, uid u WHERE f.uid = u.id AND f.fingerprint = '%s'" % (fpr))
+    q = Upload.projectB.query("SELECT u.uid, u.name, u.debian_maintainer FROM fingerprint f, uid u WHERE f.uid = u.id AND f.fingerprint = '%s'" % (fpr))
     qs = q.getresult()
     if len(qs) == 0:
         return (None, None)
@@ -1007,7 +1007,7 @@ def lookup_uid_from_fingerprint(fpr):
 def check_signed_by_key():
     """Ensure the .changes is signed by an authorized uploader."""
 
-    (uid, uid_name) = lookup_uid_from_fingerprint(changes["fingerprint"])
+    (uid, uid_name, is_dm) = lookup_uid_from_fingerprint(changes["fingerprint"])
     if uid_name == None:
         uid_name = ""
 
@@ -1017,8 +1017,8 @@ def check_signed_by_key():
         may_nmu, may_sponsor = 1, 1
         # XXX by default new dds don't have a fingerprint/uid in the db atm,
         #     and can't get one in there if we don't allow nmu/sponsorship
-    elif uid[:3] == "dm:":
-        uid_email = uid[3:]
+    elif is_dm is "t":
+        uid_email = uid
         may_nmu, may_sponsor = 0, 0
     else:
         uid_email = "%s@debian.org" % (uid)
@@ -1045,6 +1045,7 @@ def check_signed_by_key():
         source_ids = []
         check_suites = changes["distribution"].keys()
         if "unstable" not in check_suites: check_suites.append("unstable")
+        if "experimental" not in check_suites: check_suites.append("experimental")
         for suite in check_suites:
             suite_id = database.get_suite_id(suite)
             q = Upload.projectB.query("SELECT s.id FROM source s JOIN src_associations sa ON (s.id = sa.source) WHERE s.source = '%s' AND sa.suite = %d" % (changes["source"], suite_id))
@@ -1053,8 +1054,7 @@ def check_signed_by_key():
 
         is_nmu = 1
         for si in source_ids:
-            is_nmu = 1
-            q = Upload.projectB.query("SELECT m.name FROM maintainer m WHERE m.id IN (SELECT maintainer FROM src_uploaders WHERE src_uploaders.source = %s)" % (si))
+            q = Upload.projectB.query("SELECT m.name FROM maintainer m WHERE m.id IN (SELECT su.maintainer FROM src_uploaders su JOIN source s ON (s.id = su.source) WHERE su.source = %s AND s.dm_upload_allowed = 'yes')" % (si))
             for m in q.getresult():
                 (rfc822, rfc2047, name, email) = utils.fix_maintainer(m[0])
                 if email == uid_email or name == uid_name:
index a410f703e5a9365dfe2fbd160695ea0f886f70d3..3743880507feb9ced4fabf7cf9d686306ccf66ab 100755 (executable)
@@ -41,7 +41,7 @@ echo "Authorised upload by $ID, copying into place"
 OUT=$(mktemp)
 
 cp "$BYHAND" "$DESTKR"
-dak import-keyring --generate-users "dm:%s" "$DESTKR" >$OUT
+dak import-keyring -D --generate-users "%s" "$DESTKR" >$OUT
 
 if [ -s "$OUT" ]; then
   /usr/sbin/sendmail -odq -oi -t <<EOF
index 1e3639406cf1c8f79b072a1eb90e13f3a070c995..bbb82e7415e60a7f24da35840f133ee235568779 100644 (file)
@@ -38,6 +38,7 @@ CREATE TABLE uid (
        id SERIAL PRIMARY KEY,
        uid TEXT UNIQUE NOT NULL,
        name TEXT
+       debian_maintainer BOOLEAN NOT NULL,
 );
 
 CREATE TABLE keyrings (
@@ -84,6 +85,7 @@ CREATE TABLE source (
         file INT4 UNIQUE NOT NULL, -- REFERENCES files
        install_date TIMESTAMP NOT NULL,
        sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
+        dm-upload-allowed BOOLEAN NOT NULL,
        unique (source, version)
 );