[Secure-testing-commits] r5470 - bin lib/python
Florian Weimer
fw at alioth.debian.org
Sun Feb 18 16:50:24 UTC 2007
Author: fw
Date: 2007-02-18 17:50:24 +0100 (Sun, 18 Feb 2007)
New Revision: 5470
Modified:
bin/update-db
lib/python/bugs.py
lib/python/security_db.py
Log:
Treat packages marked as <removed> as source packages.
This allows us to track firefox issues again.
* lib/python/bugs.py (FileBase):
Keep track of removed packages.
* lib/python/security_db.py
(DB.readBugs): Populate removed_packages table using <removed> entries.
(DB.readRemovedPackages): Remove method.
* bin/update-db:
Do not call readRemovedPackages anymore.
Modified: bin/update-db
===================================================================
--- bin/update-db 2007-02-18 00:53:28 UTC (rev 5469)
+++ bin/update-db 2007-02-18 16:50:24 UTC (rev 5470)
@@ -64,10 +64,6 @@
db.commit(cursor)
cursor = db.writeTxn()
-# Removed packages
-
-db.readRemovedPackages(cursor, 'data/packages/removed-packages')
-
# Calculate vulnerability information.
warnings = db.calculateVulnerabilities(cursor)
Modified: lib/python/bugs.py
===================================================================
--- lib/python/bugs.py 2007-02-18 00:53:28 UTC (rev 5469)
+++ lib/python/bugs.py 2007-02-18 16:50:24 UTC (rev 5470)
@@ -507,6 +507,10 @@
re_note = re.compile(r'^NOTE:\s+(.*)$')
re_todo = re.compile(r'^TODO:\s+(.*)$')
+ def __init__(self, name, fileObj=None):
+ debian_support.PackageFile.__init__(self, name, fileObj)
+ self.removed_packages = {}
+
def isUniqueName(self, name):
"""Returns True if the name is a real, unique name."""
return True
@@ -661,9 +665,13 @@
"ITP note needs Debian bug reference",
lineno)
pkg_notes.append(x)
- elif v in ('unfixed', 'removed'):
+ elif v == 'unfixed':
pkg_notes.append(PackageNoteParsed
(p, None, d, release=release))
+ elif v == 'removed':
+ pkg_notes.append(PackageNoteParsed
+ (p, None, d, release=release))
+ self.removed_packages[p] = True
else:
self.raiseSyntaxError(
"invalid special version %s in package entry"
Modified: lib/python/security_db.py
===================================================================
--- lib/python/security_db.py 2007-02-18 00:53:28 UTC (rev 5469)
+++ lib/python/security_db.py 2007-02-18 16:50:24 UTC (rev 5470)
@@ -694,6 +694,7 @@
cursor.execute("DELETE FROM bugs_notes")
cursor.execute("DELETE FROM bugs_xref")
cursor.execute("DELETE FROM package_notes_nodsa")
+ cursor.execute("DELETE FROM removed_packages")
# The *_status tables are regenerated anyway, no need to
# delete them here.
@@ -717,6 +718,10 @@
if errors:
raise InsertError(errors)
+ cursor.executemany(
+ "INSERT OR REPLACE INTO removed_packages (name) VALUES (?)",
+ map(lambda x: (x,), source.removed_packages.keys()))
+
def has_changed(filename):
current_print = self.filePrint(filename)
for (old_print,) in cursor.execute(
@@ -979,6 +984,11 @@
AND EXISTS (SELECT * FROM source_packages AS p
WHERE p.name = package_notes.package)""")
cursor.execute(
+ """UPDATE package_notes SET package_kind = 'source'
+ WHERE package_kind = 'unknown'
+ AND EXISTS (SELECT * FROM removed_packages AS p
+ WHERE p.name = package_notes.package)""")
+ cursor.execute(
"""UPDATE package_notes SET package_kind = 'binary'
WHERE package_kind = 'unknown'
AND EXISTS (SELECT * FROM binary_packages AS p
@@ -1850,33 +1860,6 @@
ORDER BY bug""", (bug, bug, bug, bug)):
yield bug_name
- def readRemovedPackages(self, cursor, filename):
- """Reads a file of removed packages and stores it in the database."""
-
- f = file(filename)
-
- re_package = re.compile(r'^\s*([a-z0-9]\S+)\s*$')
-
- # Not very good error reporting, but changes to that file are
- # rare.
-
- def gen():
- for line in f:
- if line == '':
- break
- if line[0] == '#' or line == '\n':
- continue
- match = re_package.match(line)
- if match:
- yield match.groups()
- else:
- raise ValueError, "not a package: " + `line`
-
- cursor.execute("DELETE FROM removed_packages")
- cursor.executemany("INSERT INTO removed_packages (name) VALUES (?)",
- gen())
-
-
def getUnknownPackages(self, cursor):
"""Returns a generator for a list of unknown packages.
Each entry has the form (PACKAGE, BUG-LIST)."""
More information about the Secure-testing-commits
mailing list