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

jennifer: no more nulls in binaries/source



Hi,

currently, binNMUs have the value null in the source-field in the
binaries-table. We currently have more than 1700 packages with this, as
can be seen by this sql-query:
select * from binaries where source is NULL

This patch fixes this for further accepts. I tested it for a normal
upload and a binNMU-style one.

The basic logic is that Katie.source_exists returns not only 1 if there
is source available, but the source-version that was found.


Cheers,
Andi

--- /usr/bin/jennifer~~	2005-09-10 20:02:54.000000000 +0200
+++ /usr/bin/jennifer	2005-10-15 22:23:45.000000000 +0200
@@ -480,7 +480,10 @@
                     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, changes["distribution"].keys()):
+                source_by_sql = Katie.source_exists(source_package, source_version, changes["distribution"].keys())
+                if source_by_sql:
+                    files[file]["source version"] = source_by_sql
+                else:
                     # 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);
--- /usr/lib/python2.3/site-packages/katie.py~~	2005-09-10 23:10:38.000000000 +0200
+++ /usr/lib/python2.3/site-packages/katie.py	2005-10-15 22:17:51.000000000 +0200
@@ -665,6 +665,7 @@
 
     def source_exists (self, package, source_version, suites = ["any"]):
 	okay = 1
+	source = {}
 	for suite in suites:
 	    if suite == "any":
 	    	que = "SELECT s.version FROM source s WHERE s.source = '%s'" % \
@@ -691,21 +692,27 @@
 
             # Try (1)
             if source_version in ql:
+                source[source_version] = 1
                 continue
 
             # Try (2)
             orig_source_version = re_bin_only_nmu_of_mu.sub('', source_version)
             if orig_source_version in ql:
+                source[orig_source_version] = 1
                 continue
 
             # Try (3)
             orig_source_version = re_bin_only_nmu_of_nmu.sub('', source_version)
             if orig_source_version in ql:
+                source[orig_source_version] = 1
                 continue
 
             # No source found...
             okay = 0
-	return okay
+	if len(source) > 1: okay = 0 # means: we matched to different source versions in different suites
+	if okay:
+	    return source.keys()[0]
+	return None
 
     ################################################################################
     



Reply to: