[Secure-testing-commits] r32510 - bin
Holger Levsen
holger at moszumanska.debian.org
Thu Feb 26 15:49:46 UTC 2015
Author: holger
Date: 2015-02-26 15:49:46 +0000 (Thu, 26 Feb 2015)
New Revision: 32510
Modified:
bin/tracker_service.py
Log:
Rewrite last commit for output aggregated per release
Modified: bin/tracker_service.py
===================================================================
--- bin/tracker_service.py 2015-02-26 15:49:43 UTC (rev 32509)
+++ bin/tracker_service.py 2015-02-26 15:49:46 UTC (rev 32510)
@@ -1228,10 +1228,21 @@
return BinaryResult(''.join(data),'application/octet-stream')
def page_yaml(self, path, params, url):
- data = []
- old_pkg = ''
- releases = ('sid', 'jessie', 'wheezy', 'squeeze')
- for (pkg, bug, desc, debianbug, release, subrelease, version, status, urgency, remote, nodsa) in self.db.cursor().execute(
+
+ packages = []
+ issues = {}
+ descriptions = {}
+ debianbugs = {}
+ remote = {}
+ releases = {}
+ subreleases = {}
+ repositories = {}
+ version = {}
+ status = {}
+ urgency = {}
+ nodsa = {}
+ supported_releases = ('sid', 'jessie', 'wheezy', 'squeeze')
+ for (pkg, issue, desc, debianbug, release, subrelease, db_version, db_status, db_urgency, db_remote, db_nodsa) in self.db.cursor().execute(
"""SELECT sp.name, st.bug_name, bugs.description,
(SELECT debian_cve.bug FROM debian_cve
WHERE debian_cve.bug_name = st.bug_name
@@ -1246,41 +1257,86 @@
WHERE sp.rowid = st.package AND st.bug_name = bugs.name
AND ( sp.release = ? OR sp.release = ? OR sp.release = ?
OR sp.release = ? )
- ORDER BY sp.name, st.bug_name, sp.release, sp.subrelease""" , releases):
+ ORDER BY sp.name, st.bug_name, sp.release, sp.subrelease""" , supported_releases):
- if old_pkg != pkg:
- old_pkg = pkg
- old_bug = ''
- data.append(pkg+':\n')
- if old_bug != bug:
- old_bug = bug
- data.append(' '+bug+':\n')
- data.append(' description: '+desc+'\n')
- if str(debianbug) != 'None':
- data.append(' bug: '+str(debianbug)+'\n')
- data.append(' releases: \n')
-
+ if pkg not in packages:
+ packages.append(pkg)
+ issues[pkg] = []
+ debianbugs[pkg] = {}
+ remote[pkg] = {}
+ releases[pkg] = {}
+ subreleases[pkg] = {}
+ repositories[pkg] = {}
+ version[pkg] = {}
+ status[pkg] = {}
+ urgency[pkg] = {}
+ nodsa[pkg] = {}
+ if issue not in issues[pkg]:
+ issues[pkg].append(issue)
+ descriptions[issue] = desc
+ debianbugs[pkg][issue] = debianbug
+ remote[pkg][issue] = db_remote
+ releases[pkg][issue] = []
+ subreleases[pkg][issue] = []
+ repositories[pkg][issue] = []
+ version[pkg][issue] = {}
+ status[pkg][issue] = {}
+ urgency[pkg][issue] = {}
+ nodsa[pkg][issue] = {}
+ if release not in releases[pkg][issue]:
+ releases[pkg][issue].append(release)
+ subreleases[pkg][issue].append(subrelease)
if subrelease == '':
- my_release = release
+ repository = release
else:
- my_release = release+'-'+subrelease
+ repository = release+'-'+subrelease
+ if repository not in repositories[pkg][issue]:
+ repositories[pkg][issue].append(repository)
+ version[pkg][issue][repository] = db_version
+ status[pkg][issue][repository] = db_status
+ urgency[pkg][issue][repository] = db_urgency
+ if str(db_nodsa) != 'None':
+ nodsa[pkg][issue][repository] = db_nodsa
- data.append(' '+my_release+':\n')
- data.append(' version: '+version+'\n')
- if status > 0:
- # 1 = vulnerable, 2 = undetermined
- data.append(' status: open\n')
- else:
- data.append(' status: resolved\n')
- data.append(' urgency: '+urgency+'\n')
- if str(remote) == 'None':
- data.append(' range: no data\n')
- elif remote == 1:
- data.append(' range: remote\n')
- else:
- data.append(' range: local\n')
- if str(nodsa) != 'None':
- data.append(' nodsa: '+nodsa+'\n')
+ data = []
+ for pkg in packages:
+ data.append(pkg+':\n')
+ for issue in issues[pkg]:
+ data.append(' '+issue+':\n')
+ if descriptions[issue]:
+ data.append(' description: '+descriptions[issue]+'\n')
+ if debianbugs[pkg][issue] != None:
+ data.append(' debian bug: '+str(debianbugs[pkg][issue])+'\n')
+ if str(remote[pkg][issue]) == 'None':
+ data.append(' range: no data\n')
+ elif remote[pkg][issue] == 1:
+ data.append(' range: remote\n')
+ else:
+ data.append(' range: local\n')
+ for repository in repositories[pkg][issue]:
+ data.append(' '+repository+': '+version[pkg][issue][repository]+'\n')
+ for release in releases[pkg][issue]:
+ winner=''
+ for suffix in ('','-security','-lts'):
+ subrelease=release+suffix
+ if status[pkg][issue].has_key(subrelease):
+ if status[pkg][issue][subrelease] == 0:
+ winner=suffix
+ break
+ elif status[pkg][issue][subrelease] > 0 and winner == '':
+ winner=suffix
+ repository=release+winner
+ data.append(' '+release+'\n')
+ data.append(' repository: '+repository+'\n')
+ data.append(' version: '+version[pkg][issue][repository]+'\n')
+ if status[pkg][issue][repository] == 0:
+ # 1 = vulnerable, 2 = undetermined
+ data.append(' status: resolved\n')
+ else:
+ data.append(' status: open\n')
+ data.append(' urgency: '+urgency[pkg][issue][repository]+'\n')
+ if nodsa[pkg][issue].has_key(repository):
+ data.append(' nodsa: '+nodsa[pkg][issue][repository]+'\n')
return BinaryResult(''.join(data),'application/octet-stream')
More information about the Secure-testing-commits
mailing list