From 2d5a651910c9084ec4c6e3656dfb0d4d51b6bcc2 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Tue, 29 Jul 2003 14:00:39 +0000 Subject: [PATCH] * katie.py (source_exists): add an extra parameter to limit thedistribution(s) the source must exist in.* kelly, lisa, jennifer: update to use the new source_exists --- jennifer | 6 +++--- katie.py | 54 +++++++++++++++++++++++++++++++----------------------- kelly | 6 +++--- lisa | 6 +++--- 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/jennifer b/jennifer index 071d27d1..a769b63b 100755 --- a/jennifer +++ b/jennifer @@ -2,7 +2,7 @@ # Checks Debian packages from Incoming # Copyright (C) 2000, 2001, 2002, 2003 James Troup -# $Id: jennifer,v 1.34 2003-05-02 13:54:52 troup Exp $ +# $Id: jennifer,v 1.35 2003-07-29 14:00:39 ajt Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ re_valid_pkg_name = re.compile(r"^[\dA-Za-z][\dA-Za-z\+\-\.]+$"); ################################################################################ # Globals -jennifer_version = "$Revision: 1.34 $"; +jennifer_version = "$Revision: 1.35 $"; Cnf = None; Options = None; @@ -432,7 +432,7 @@ def check_files(): reject("source version (%s) for %s doesn't match changes version %s." % (source_version, file, changes["version"])); else: # Check in the SQL database - if not Katie.source_exists(source_package, source_version): + if not Katie.source_exists(source_package, source_version, changes["distribution"].keys()): # Check in one of the other directories source_epochless_version = utils.re_no_epoch.sub('', source_version); dsc_filename = "%s_%s.dsc" % (source_package, source_epochless_version); diff --git a/katie.py b/katie.py index c71fdef0..198ee001 100644 --- a/katie.py +++ b/katie.py @@ -2,7 +2,7 @@ # Utility functions for katie # Copyright (C) 2001, 2002, 2003 James Troup -# $Id: katie.py,v 1.34 2003-07-15 17:29:19 troup Exp $ +# $Id: katie.py,v 1.35 2003-07-29 14:00:39 ajt Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -601,28 +601,36 @@ distribution."""; # (2) Bin-only NMU of an MU => 1.0-3.0.1 # (3) Bin-only NMU of a sourceful-NMU => 1.0-3.1.1 - def source_exists (self, package, source_version): - q = self.projectB.query("SELECT s.version FROM source s WHERE s.source = '%s'" % (package)); - - # Reduce the query results to a list of version numbers - ql = map(lambda x: x[0], q.getresult()); - - # Try (1) - if ql.count(source_version): - return 1; - - # Try (2) - orig_source_version = re_bin_only_nmu_of_mu.sub('', source_version); - if ql.count(orig_source_version): - return 1; - - # Try (3) - orig_source_version = re_bin_only_nmu_of_nmu.sub('', source_version); - if ql.count(orig_source_version): - return 1; - - # No source found... - return 0; + def source_exists (self, package, source_version, suites = ["any"]): + okay = 1 + for suite in suites: + if suites == "any": + que = "SELECT s.version FROM source s WHERE s.source = '%s'" % \ + (package) + else: + suite_id = db_access.get_suite_id(suite); + que = "SELECT s.version FROM source s JOIN src_associations sa ON (s.id = sa.source) WHERE sa.suite = %d AND s.source = '%s'" % (suite_id, package) + q = self.projectB.query(que) + + # Reduce the query results to a list of version numbers + ql = map(lambda x: x[0], q.getresult()); + + # Try (1) + if ql.count(source_version): + continue + + # Try (2) + orig_source_version = re_bin_only_nmu_of_mu.sub('', source_version) + if ql.count(orig_source_version): + continue + + # Try (3) + orig_source_version = re_bin_only_nmu_of_nmu.sub('', source_version) + if ql.count(orig_source_version): + continue + + # No source found... + okay = 0 ################################################################################ diff --git a/kelly b/kelly index 0afc8357..37b6db47 100755 --- a/kelly +++ b/kelly @@ -2,7 +2,7 @@ # Installs Debian packages # Copyright (C) 2000, 2001, 2002, 2003 James Troup -# $Id: kelly,v 1.9 2003-07-15 17:29:22 troup Exp $ +# $Id: kelly,v 1.10 2003-07-29 14:00:39 ajt Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ import db_access, katie, logging, utils; ############################################################################### # Globals -kelly_version = "$Revision: 1.9 $"; +kelly_version = "$Revision: 1.10 $"; Cnf = None; Options = None; @@ -119,7 +119,7 @@ def check(): source_version = files[file]["source version"]; source_package = files[file]["source package"]; if not changes["architecture"].has_key("source") \ - and not Katie.source_exists(source_package, source_version): + and not Katie.source_exists(source_package, source_version, changes["distribution"].keys()): reject("no source found for %s %s (%s)." % (source_package, source_version, file)); # Version and file overwrite checks diff --git a/lisa b/lisa index b065e682..a1b5c90f 100755 --- a/lisa +++ b/lisa @@ -2,7 +2,7 @@ # Handles NEW and BYHAND packages # Copyright (C) 2001, 2002, 2003 James Troup -# $Id: lisa,v 1.23 2003-03-14 19:06:02 troup Exp $ +# $Id: lisa,v 1.24 2003-07-29 14:00:39 ajt Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ import apt_pkg, apt_inst; import db_access, fernanda, katie, logging, utils; # Globals -lisa_version = "$Revision: 1.23 $"; +lisa_version = "$Revision: 1.24 $"; Cnf = None; Options = None; @@ -75,7 +75,7 @@ def recheck(): source_version = files[file]["source version"]; source_package = files[file]["source package"]; if not Katie.pkg.changes["architecture"].has_key("source") \ - and not Katie.source_exists(source_package, source_version): + and not Katie.source_exists(source_package, source_version, changes["distribution"].keys()): source_epochless_version = utils.re_no_epoch.sub('', source_version); dsc_filename = "%s_%s.dsc" % (source_package, source_epochless_version); if not os.path.exists(Cnf["Dir::Queue::Accepted"] + '/' + dsc_filename): -- 2.39.5