Your message dated Sat, 20 Sep 2014 09:43:25 +0200 with message-id <20140920074325.GA27769@eldamar.local> and subject line Re: Bug#762214: security-tracker: sort "Available releases" view correctly has caused the Debian Bug report #762214, regarding security-tracker: sort "Available releases" view correctly to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@bugs.debian.org immediately.) -- 762214: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762214 Debian Bug Tracking System Contact owner@bugs.debian.org with problems
--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: security-tracker: sort "Available releases" view correctly
- From: Holger Levsen <holger@layer-acht.org>
- Date: Fri, 19 Sep 2014 17:10:52 +0200
- Message-id: <[🔎] 201409191710.58746.holger@layer-acht.org>
package: security-tracker severity: minor Hi, the attached non-intrusive patch basically rewrites the availableRelease() function which is only used to create https://security-tracker.debian.org/tracker/data/releases which currently is not ordered at all. The patch makes it logically by release, subrelease and archive. Shall I push this patch into SVN? cheers, Holger, finally finished chasing what he thought was a low hanging fruit ;)From f1841ee6be909cd6c8e8c8bf94385edf9637954f Mon Sep 17 00:00:00 2001 From: Holger Levsen <holger@layer-acht.org> Date: Fri, 19 Sep 2014 17:02:36 +0200 Subject: [PATCH] rewrite DB.availableReleases() to make it possible to sort by release, subrelease and archive --- bin/tracker_service.py | 2 ++ lib/python/security_db.py | 49 +++++++++++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/bin/tracker_service.py b/bin/tracker_service.py index 4ad08be..4e87dc1 100644 --- a/bin/tracker_service.py +++ b/bin/tracker_service.py @@ -1141,6 +1141,8 @@ not unimportant."""), sources = 'yes' else: sources = 'no' + if 'source' in archs: + archs.remove('source') yield rel, subrel, archive, sources, make_list(archs) return self.create_page( url, "Available releases", diff --git a/lib/python/security_db.py b/lib/python/security_db.py index 4917b46..1abfb8a 100644 --- a/lib/python/security_db.py +++ b/lib/python/security_db.py @@ -440,6 +440,14 @@ class DB: return -1 self.db.createscalarfunction("subrelease_to_number", subrelease_to_number, 1) + archives = ['main', 'contrib', 'non-free'] + def archive_to_number(u): + try: + return archives.index(u) + except ValueError: + return -1 + self.db.createscalarfunction("archive_to_number", archive_to_number, 1) + def release_name(release, subrelease, archive): if archive <> 'main': release = release + '/' + archive @@ -451,6 +459,10 @@ class DB: self.db.createcollation("version", debian_support.version_compare) + def source_arch(): + return "source" + self.db.createscalarfunction("source_arch", source_arch, 0) + def filePrint(self, filename): """Returns a fingerprint string for filename.""" @@ -860,24 +872,27 @@ class DB: if cursor is None: cursor = self.cursor() - releases = {} - for r in cursor.execute( - """SELECT DISTINCT release, subrelease, archive - FROM source_packages"""): - releases[r] = (True, []) - - for (rel, subrel, archive, archs) in cursor.execute( - """SELECT DISTINCT release, subrelease, archive, archs - FROM binary_packages"""): - key = (rel, subrel, archive) - if not releases.has_key(key): - releases[key] = (False, []) - releases[key][1][:] = mergeLists(releases[key][1], archs) - result = [] - for ((rel, subrel, archive), (sources, archs)) in releases.items(): - result.append((rel, subrel, archive, sources, archs)) - result.sort() + result.append(('', '', '', False, [])) + for (rel, subrel, archive, archs) in cursor.execute( + """SELECT * FROM + (SELECT DISTINCT release, subrelease, archive, archs + FROM binary_packages + UNION SELECT DISTINCT release, subrelease, archive, source_arch() as archs + FROM source_packages) + ORDER BY release_to_number(release), subrelease_to_number(subrelease), archive_to_number(archive)"""): + if "source" in archs: + sources=True + else: + sources=False + (p_rel, p_subrel, p_archive, p_sources, p_archs) = result.pop() + if rel == p_rel and subrel == p_subrel and archive == p_archive: + sources = sources or p_sources + result.append((rel, subrel, archive, sources, mergeLists(p_archs, archs))) + else: + result.append((p_rel, p_subrel, p_archive, p_sources, mergeLists([], p_archs))) + result.append((rel, subrel, archive, sources, mergeLists([], archs))) + result.pop(0) return result -- 1.9.1Attachment: signature.asc
Description: This is a digitally signed message part.
--- End Message ---
--- Begin Message ---
- To: 762214-done@bugs.debian.org
- Cc: Holger Levsen <holger@layer-acht.org>
- Subject: Re: Bug#762214: security-tracker: sort "Available releases" view correctly
- From: Salvatore Bonaccorso <carnil@debian.org>
- Date: Sat, 20 Sep 2014 09:43:25 +0200
- Message-id: <20140920074325.GA27769@eldamar.local>
- In-reply-to: <[🔎] 20140920071131.GA27336@eldamar.local>
- References: <[🔎] 201409191710.58746.holger@layer-acht.org> <[🔎] 20140920071131.GA27336@eldamar.local>
Hi Holger, On Sat, Sep 20, 2014 at 09:11:31AM +0200, Salvatore Bonaccorso wrote: > Hi Holger, > > On Fri, Sep 19, 2014 at 05:10:52PM +0200, Holger Levsen wrote: > > package: security-tracker > > severity: minor > > > > Hi, > > > > the attached non-intrusive patch basically rewrites the availableRelease() > > function which is only used to create > > https://security-tracker.debian.org/tracker/data/releases which currently > > is not ordered at all. The patch makes it logically by release, subrelease > > and archive. > > > > Shall I push this patch into SVN? > > Looks good to me at first glance. If you feel confortable with the > changes just push this :) Activated on soler. Regards, Salvatore
--- End Message ---