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 | 71460b51ce2e60daaec625cb17243320337c1078 (patch) | |
tree | c3a7886d7bc8627cbcc0f485138c1c8d91710ee2 /lib | |
parent | 85358069b8a1cdf6ba0859d425c7e5fe44d5b498 (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: |