Author: fw Date: 2005-09-13 08:00:21 +0000 (Tue, 13 Sep 2005) New Revision: 1944 Modified: lib/python/security_db.py Log: lib/python/security_db.py: Rename "subrelease" to "archive" (although the purpose was initially different). Update test case. Modified: lib/python/security_db.py ==================================================================--- lib/python/security_db.py 2005-09-13 07:45:17 UTC (rev 1943) +++ lib/python/security_db.py 2005-09-13 08:00:21 UTC (rev 1944) @@ -93,17 +93,17 @@ cursor.execute("""CREATE TABLE source_packages (package TEXT NOT NULL, - release TEXT NOT NULL, subrelease TEXT NOT NULL, + release TEXT NOT NULL, archive TEXT NOT NULL, version TEXT NOT NULL, - PRIMARY KEY (package, release, subrelease));""") + PRIMARY KEY (package, release, archive));""") cursor.execute("""CREATE TABLE binary_packages (package TEXT NOT NULL, - release TEXT NOT NULL, subrelease TEXT NOT NULL, + release TEXT NOT NULL, archive TEXT NOT NULL, architecture TEXT NOT NULL, version TEXT NOT NULL, source TEXT NOT NULL, source_version TEXT NOT NULL, - PRIMARY KEY (package, release, subrelease, architecture));""") + PRIMARY KEY (package, release, archive, architecture));""") cursor.execute("""CREATE INDEX binary_packages_source ON binary_packages(source)""") @@ -143,20 +143,20 @@ normalized_target TEXT NOT NULL DEFAULT '''', PRIMARY KEY (source, target))""") - def updateSources(self, cursor, release, subrelease, packages): + def updateSources(self, cursor, release, archive, packages): """Reads a Sources file and adds it to the database. - Old records for the same release/subrelease pair are removed. + Old records for the same release/archive pair are removed. cursor - cursor used to update the database release - Debian release (e.g. sarge) - subrelease - fork of a release (e.g. security) + archive - fork of a release (e.g. security) packages - debian_support.PackageFile object with source packages """ cursor.execute(''DELETE FROM source_packages '' - + ''WHERE release = ? AND subrelease = ?'', - (release, subrelease)) + + ''WHERE release = ? AND archive = ?'', + (release, archive)) for pkg in packages: pkg_name = None @@ -174,22 +174,22 @@ ("package record for %s does not contain version" % pkg_name) cursor.execute(''INSERT INTO source_packages '' - + ''(package, release, subrelease, version) '' + + ''(package, release, archive, version) '' + ''VALUES (?, ?, ?, ?)'', - (pkg_name, release, subrelease, str(pkg_version))) + (pkg_name, release, archive, str(pkg_version))) def updatePackages(self, cursor, - release, subrelease, architecture, + release, archive, architecture, packages): """Reads a Packages file and adds it to the database. - Old records for the same release/subrelease/architecture + Old records for the same release/archive/architecture triple are removed. cursor - cursor used to update the database release - Debian release (e.g. sarge) - subrelease - fork of a release (e.g. security) + archive - fork of a release (e.g. security) architecture - architecture of binary packages (e.g. i386) packages - debian_support.PackageFile object with binary packages """ @@ -198,8 +198,8 @@ (r''^([a-zA-Z0-9.+-]+)(?:\s+\(([a-zA-Z0-9.+:-]+)\))?$'') cursor.execute(''DELETE FROM binary_packages '' - + ''WHERE release = ? AND subrelease = ? AND architecture = ?'', - (release, subrelease, architecture)) + + ''WHERE release = ? AND archive = ? AND architecture = ?'', + (release, archive, architecture)) for pkg in packages: @@ -233,10 +233,10 @@ pkg_source_version = pkg_version cursor.execute(''INSERT INTO binary_packages '' - + ''(package, release, subrelease, architecture,'' + + ''(package, release, archive, architecture,'' + ''version, source, source_version) '' + ''VALUES (?, ?, ?, ?, ?, ?, ?)'', - (pkg_name, release, subrelease, architecture, + (pkg_name, release, archive, architecture, str(pkg_version), pkg_source, str(pkg_source_version))) @@ -336,35 +336,35 @@ if cursor is None: cursor = self.cursor() - for (package, release, subrelease, architecture, source) in\ + for (package, release, archive, architecture, source) in\ cursor.execute( - """SELECT package, release, subrelease, architecture, source + """SELECT package, release, archive, architecture, source FROM binary_packages WHERE NOT EXISTS (SELECT * FROM source_packages AS sp WHERE sp.package = binary_packages.source AND sp.release = binary_packages.release - AND sp.subrelease = binary_packages.subrelease) + AND sp.archive = binary_packages.archive) """): print "error: binary package without source package" print " binary package:", package print " release:", release - if subrelease: - print " subrelease:", subrelease + if archive: + print " archive:", archive print " architecture:", architecture print " missing source package:", source - for (package, release, subrelease, architecture, version, + for (package, release, archive, architecture, version, source, source_version) \ in cursor.execute("""SELECT binary_packages.package, - binary_packages.release, binary_packages.subrelease, + binary_packages.release, binary_packages.archive, binary_packages.architecture,binary_packages.version, sp.package, sp.version FROM binary_packages, source_packages AS sp WHERE sp.package = binary_packages.source AND sp.release = binary_packages.release - AND sp.subrelease = binary_packages.subrelease + AND sp.archive = binary_packages.archive AND sp.version <> binary_packages.source_version"""): relation = cmp(debian_support.Version(version), debian_support.Version(source_version)) @@ -376,8 +376,8 @@ print " binary package: %s (%s)" % (package, version) print " source package: %s (%s)" % (source, source_version) print " release:", release - if subrelease: - print " subrelease:", subrelease + if archive: + print " archive:", archive print " architecture:", architecture def test(): @@ -415,7 +415,7 @@ b = bugs.BugFromDB(cursor, ''CAN-2005-2491'') assert b.name == ''CAN-2005-2491'', b.name - assert b.description == ''(Integer overflow in pcre_compile.c in Perl Compatible Regular ...)'', b.description + assert b.description == ''Integer overflow in pcre_compile.c in Perl Compatible Regular ...'', b.description assert len(b.xref) == 2, b.xref assert not b.not_for_us assert ''DSA-800-1'' in b.xref, b.xref