From: Michael Casadevall Date: Fri, 26 Dec 2008 23:05:33 +0000 (-0500) Subject: Modified dak to use non-braindead DM schema, and use an actual column for X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b1f0efc3965793443da9260e8f80f895b7dccd1;p=dak Modified dak to use non-braindead DM schema, and use an actual column for logged DM rights in the archive. Much better :-) Signed-off-by: Michael Casadevall --- diff --git a/ChangeLog b/ChangeLog index c1b8944e..7233547e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-12-26 Michael Casadevall + + * 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 + + 2008-12-26 Michael Casadevall * dak/process_unchecked.py - Implemented new dm_upload_allowed field in source diff --git a/dak/import_keyring.py b/dak/import_keyring.py index a70a2e78..d6bdde9a 100755 --- a/dak/import_keyring.py +++ b/dak/import_keyring.py @@ -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: diff --git a/dak/import_ldap_fingerprints.py b/dak/import_ldap_fingerprints.py index b5682853..7e754d48 100755 --- a/dak/import_ldap_fingerprints.py +++ b/dak/import_ldap_fingerprints.py @@ -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)) diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index 1d63a024..68a882f8 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -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) diff --git a/scripts/debian/byhand-dm b/scripts/debian/byhand-dm index a410f703..37438805 100755 --- a/scripts/debian/byhand-dm +++ b/scripts/debian/byhand-dm @@ -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 <