diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2018-06-01 15:24:58 +0200 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2018-06-08 09:26:45 +0200 |
commit | 0cb94dee777219c6edf3b3c2579c17fe46afc13f (patch) | |
tree | 8ba82afe2b18004b0c409045002dd512cf96bac0 /lib | |
parent | 375ba023951257874416fd6fc291945210354d66 (diff) |
Move source list to a config file
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/security_db.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/python/security_db.py b/lib/python/security_db.py index dbb7cd8048..9c7d4afd8b 100644 --- a/lib/python/security_db.py +++ b/lib/python/security_db.py @@ -856,6 +856,12 @@ class DB: VALUES (?, ?, ?, ?, ?, ?, ?, ?)""", gen()) + def getSources(self): + config = debian_support.getconfig() + sources = config["sources"] + + return sources + def readBugs(self, cursor, path): if self.verbose: print "readBugs:" @@ -913,15 +919,11 @@ class DB: return True source_removed_packages = '/packages/removed-packages' - sources = ((bugs.CVEFile, '/CVE/list'), - (bugs.DSAFile, '/DSA/list'), - (bugs.DTSAFile, '/DTSA/list'), - (bugs.DSAFile, '/DLA/list'), - (None, source_removed_packages)) + sources = self.getSources() unchanged = True - for (_, name) in sources: - if has_changed(path + name): + for filename in sources.keys() + [source_removed_packages]: + if has_changed(path + filename): unchanged = False break if unchanged: @@ -940,9 +942,8 @@ class DB: """INSERT OR REPLACE INTO inodeprints (inodeprint, file) VALUES (?, ?)""", (current_print, filename)) - for (cls, name) in sources: - if cls is None: - continue + for name, cls in sources.iteritems(): + cls = getattr(bugs, cls) read_one(cls(path + name)) if self.verbose: |