From ef849a0e1b91d90f37fa08451ce954e5d342b580 Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 29 Dec 2008 15:27:20 -0500 Subject: [PATCH] Changed process_unchecked.py to handle DM's (slightly) more sanely. Previously, process_unchecked only checked unstable to determine DM upload rights. This caused issues with experimental since a package could have DM-Allowed-Upload in experimental but not in stable causing a REJECT. The applied code change causes dak to find the highest version of a package, and use its uploaders/DM-Allowed-Uploader flag to determine upload rights to that package. This also resolves a corner case usage where a package only exists in testing/stable/oldstable, and upload rights to {t-|o-}p-u. Note: In addition to the previous ALTER TABLE statememnt, the following SQL query is necessary to finish the schema updates. This does not apply to installations not using DMs. UPDATE source SET dm_upload_allowed = 't' WHERE id = (SELECT source FROM src_uploaders); Signed-off-by: Michael Casadevall --- ChangeLog | 11 ++++++++++- dak/process_unchecked.py | 34 +++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3d4a6e2..d656a267 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-12-28 Michael Casadevall + + * dak/process_unchecked.py - Modified DM to comply strictly with the DM GR + Upload right to a package is determined by the + newest version of that package in the archive + + * dak/process_unchecked.py - Added new REJECT for DM-Upload-Allowed not being set + and clarified NMU reject message. + 2008-12-28 Frank Lichtenheld * dak/override.py (main): Handle source-only packages better @@ -5,7 +14,7 @@ 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 + Now uses Debian-Maintainer column in uid table * dak/import_ldap_fingerprints.py - Ditto diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index 68a882f8..7d8d4f23 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -1043,25 +1043,29 @@ def check_signed_by_key(): if not sponsored and not may_nmu: 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)) - for si in q.getresult(): - if si[0] not in source_ids: source_ids.append(si[0]) - - is_nmu = 1 - for si in source_ids: - 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)) + q = Upload.projectB.query("SELECT s.id, s.version FROM source s JOIN src_associations sa ON (s.id = sa.source) WHERE s.source = '%s' AND s.dm_upload_allowed = 'yes'" % (changes["source"])) + + highest_sid, highest_version = None, None + + is_allowed = 1 + for si in q.getresult(): + if highest_version == None or apt_pkg.VersionCompare(si[1], highest_version) == 1: + highest_sid = si[0] + highest_version = si[1] + + print highest_sid + if highest_sid == None: + reject("Source package %s does not have 'DM-Upload-Allowed: yes' in its most recent version" % changes["source"]) + else: + 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)" % (highest_sid)) for m in q.getresult(): (rfc822, rfc2047, name, email) = utils.fix_maintainer(m[0]) if email == uid_email or name == uid_name: - is_nmu=0 + is_allowed=0 break - if is_nmu: - reject("%s may not upload/NMU source package %s" % (uid, changes["source"])) + + if is_allowed: + reject("%s is not in Maintainer or Uploaders of source package %s" % (uid, changes["source"])) for b in changes["binary"].keys(): for suite in changes["distribution"].keys(): -- 2.39.5