[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Added dm-upload-allowed flag to exist, and added support for all uploaders to properly appear in src_uploaders table as per Tom's suggestion



SQL database change:
ALTER TABLE source ADD COLUMN dm_upload_allowed BOOLEAN DEFAULT 'no' NOT NULL;
---
 ChangeLog                |    9 +++++++++
 dak/process_accepted.py  |   37 ++++++++++++++++++++-----------------
 dak/process_unchecked.py |    2 +-
 setup/init_pool.sql      |    1 +
 4 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 06516cc..9503636 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-12-26  Michael Casadevall <sonicmctails@gmail.com>
+
+        * dak/process_unchecked.py - Implemented new dm_upload_allowed field in source
+
+        * 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
diff --git a/dak/process_accepted.py b/dak/process_accepted.py
index 0d5a538..ea238ef 100755
--- a/dak/process_accepted.py
+++ b/dak/process_accepted.py
@@ -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
diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py
index 690c1c1..2a479ce 100755
--- a/dak/process_unchecked.py
+++ b/dak/process_unchecked.py
@@ -1054,7 +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:
diff --git a/setup/init_pool.sql b/setup/init_pool.sql
index 1e36394..6d295db 100644
--- a/setup/init_pool.sql
+++ b/setup/init_pool.sql
@@ -84,6 +84,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)
 );
 
-- 
1.5.6.5



Reply to: