diff options
author | Florian Weimer <fw@deneb.enyo.de> | 2007-02-18 16:50:24 +0000 |
---|---|---|
committer | Florian Weimer <fw@deneb.enyo.de> | 2007-02-18 16:50:24 +0000 |
commit | 3dca5be21f229998a75899d28f705f1611735acd (patch) | |
tree | 2632af519b92e99f7e31e6b1f65c18b91bce4d6d /lib | |
parent | 90714446f6f143406e90ab31101faa0688f47042 (diff) |
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.
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@5470 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/bugs.py | 10 | ||||
-rw-r--r-- | lib/python/security_db.py | 37 |
2 files changed, 19 insertions, 28 deletions
diff --git a/lib/python/bugs.py b/lib/python/bugs.py index 1db45c6770..b770d5f1ef 100644 --- a/lib/python/bugs.py +++ b/lib/python/bugs.py @@ -507,6 +507,10 @@ class FileBase(debian_support.PackageFile): 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 @@ class FileBase(debian_support.PackageFile): "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" diff --git a/lib/python/security_db.py b/lib/python/security_db.py index 6433acd664..68514a6847 100644 --- a/lib/python/security_db.py +++ b/lib/python/security_db.py @@ -694,6 +694,7 @@ class DB: 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 @@ class DB: 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 @@ class DB: 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 @@ class DB: 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).""" |