diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2018-06-15 10:59:20 +0200 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2018-06-15 10:59:20 +0200 |
commit | ebe678460d2044fe6c4ea52c707e2a76e0187b76 (patch) | |
tree | 38cba22bc0894eed41b67e662684f179a770c952 | |
parent | 6ebaabcfa933fd1e69b533719c260b25baa5747b (diff) |
sources: add name and path info
This avoids having to guess the name from the path.
-rw-r--r-- | data/config.json | 12 | ||||
-rw-r--r-- | lib/python/security_db.py | 15 |
2 files changed, 15 insertions, 12 deletions
diff --git a/data/config.json b/data/config.json index 9c62a4fe9e..1509d28988 100644 --- a/data/config.json +++ b/data/config.json @@ -83,10 +83,10 @@ "release": "unstable" } }, - "sources": { - "/CVE/list": "CVEFile", - "/DSA/list": "DSAFile", - "/DTSA/list": "DTSAFile", - "/DLA/list": "DSAFile" - } + "sources": [ + {"name": "CVE", "path": "/CVE/list", "class": "CVEFile"}, + {"name": "DSA", "path": "/DSA/list", "class": "DSAFile"}, + {"name": "DTSA", "path": "/DTSA/list", "class": "DTSAFile"}, + {"name": "DLA", "path": "/DLA/list", "class": "DSAFile"} + ] } diff --git a/lib/python/security_db.py b/lib/python/security_db.py index 9bcbb3eaec..dcca00f9fd 100644 --- a/lib/python/security_db.py +++ b/lib/python/security_db.py @@ -866,9 +866,9 @@ class DB: sources = self.getSources() advs = [] - for path, cls in sources.iteritems(): - name = path.split('/')[1] - + for src in sources: + name = src["name"] + cls = src["class"] if cls == 'DSAFile': advs.append(name) @@ -936,9 +936,10 @@ class DB: source_removed_packages = '/packages/removed-packages' sources = self.getSources() + source_paths = [src["path"] for src in sources] unchanged = True - for filename in sources.keys() + [source_removed_packages]: + for filename in source_paths + [source_removed_packages]: if has_changed(path + filename): unchanged = False break @@ -958,9 +959,11 @@ class DB: """INSERT OR REPLACE INTO inodeprints (inodeprint, file) VALUES (?, ?)""", (current_print, filename)) - for name, cls in sources.iteritems(): + for src in sources: + srcpath = src["path"] + cls = src["class"] cls = getattr(bugs, cls) - read_one(cls(path + name)) + read_one(cls(path + srcpath)) if self.verbose: print " update removed packages" |