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 | |
parent | 375ba023951257874416fd6fc291945210354d66 (diff) |
Move source list to a config file
-rw-r--r-- | data/config.json | 11 | ||||
-rw-r--r-- | lib/python/security_db.py | 21 |
2 files changed, 20 insertions, 12 deletions
diff --git a/data/config.json b/data/config.json index ee89ac614a..f59ee1b8d4 100644 --- a/data/config.json +++ b/data/config.json @@ -30,13 +30,13 @@ "members" : { "supported" : ["lenny", "lenny-security"], "optional" : ["lenny-proposed-updates"] - }, + } }, "squeeze" : { "members" : { "supported" : ["squeeze", "squeeze-security"], "optional" : ["squeeze-proposed-updates"] - }, + } }, "wheezy" : { "members" : { @@ -65,5 +65,12 @@ }, "release" : "unstable" } + }, + + "sources" : { + "/CVE/list" : "CVEFile", + "/DSA/list" : "DSAFile", + "/DTSA/list" : "DTSAFile", + "/DLA/list" : "DSAFile" } } 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: |