From: Michael Casadevall Date: Fri, 26 Dec 2008 12:31:32 +0000 (-0500) Subject: Added dm-upload-allowed flag to exist, and added support for all X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=d36e2e1219a6c9ad9110bbdb779ca61dfb444c2c;p=dak.git 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; --- diff --git a/ChangeLog b/ChangeLog index 06516ccd..95036361 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-12-26 Michael Casadevall + + * 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 * dak/queue_report.py - Added 822 output format diff --git a/dak/process_accepted.py b/dak/process_accepted.py index 0d5a5387..ea238ef7 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 690c1c11..2a479ced 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 1e363940..6d295dbf 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) );