From 96fecb1079a1ad4a2b574616bc6611678fa53dc8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 8 Dec 2011 10:51:52 -0600 Subject: Multilib differences report This new tables shows multilib packages paired with their regular counterparts in the normal repos if the pkgver differs. A few name hacks are needed to trim lib32-, -multilib, etc. from the name to find the matching package. Signed-off-by: Dan McGee --- packages/utils.py | 43 +++++++++++++++++++ packages/views/__init__.py | 4 +- sitestatic/archweb.css | 6 ++- templates/packages/differences.html | 86 ++++++++++++++++++++++++++----------- 4 files changed, 113 insertions(+), 26 deletions(-) diff --git a/packages/utils.py b/packages/utils.py index f8e1f2a1..5703db3b 100644 --- a/packages/utils.py +++ b/packages/utils.py @@ -1,4 +1,5 @@ from collections import defaultdict +from itertools import chain from operator import itemgetter from django.db import connection @@ -63,6 +64,7 @@ def get_split_packages_info(): split['repo'] = all_repos[split['repo']] return split_pkgs + class Difference(object): def __init__(self, pkgname, repo, pkg_a, pkg_b): self.pkgname = pkgname @@ -89,6 +91,7 @@ class Difference(object): return cmp(self.__dict__, other.__dict__) return False + @cache_function(300) def get_differences_info(arch_a, arch_b): # This is a monster. Join packages against itself, looking for packages in @@ -143,6 +146,46 @@ SELECT p.id, q.id return differences +def multilib_differences(): + # Query for checking multilib out of date-ness + sql = """ +SELECT ml.id, reg.id + FROM packages ml + JOIN packages reg + ON ( + reg.pkgname = ( + CASE WHEN ml.pkgname LIKE %s + THEN SUBSTRING(ml.pkgname, 7) + WHEN ml.pkgname LIKE %s + THEN SUBSTRING(ml.pkgname FROM 1 FOR CHAR_LENGTH(ml.pkgname) - 9) + ELSE + ml.pkgname + END + ) + AND reg.pkgver != ml.pkgver + ) + JOIN repos r ON reg.repo_id = r.id + WHERE ml.repo_id = %s + AND r.testing = %s + AND r.staging = %s + AND reg.arch_id = %s + ORDER BY ml.last_update +""" + multilib = Repo.objects.get(name__iexact='multilib') + i686 = Arch.objects.get(name='i686') + params = ['lib32-%', '%-multilib', multilib.id, False, False, i686.id] + + cursor = connection.cursor() + cursor.execute(sql, params) + results = cursor.fetchall() + + # fetch all of the necessary packages + to_fetch = set(chain.from_iterable(results)) + pkgs = Package.objects.normal().in_bulk(to_fetch) + + return [(pkgs[ml], pkgs[reg]) for ml, reg in results] + + def get_wrong_permissions(): sql = """ SELECT DISTINCT id diff --git a/packages/views/__init__.py b/packages/views/__init__.py index 13ad0c71..aa7da262 100644 --- a/packages/views/__init__.py +++ b/packages/views/__init__.py @@ -16,7 +16,7 @@ from main.models import Package, PackageFile, Arch, Repo from mirrors.models import MirrorUrl from ..models import PackageRelation, PackageGroup from ..utils import (get_group_info, get_differences_info, - get_wrong_permissions) + multilib_differences, get_wrong_permissions) # make other views available from this same package from .flag import flaghelp, flag, flag_confirmed, unflag, unflag_all @@ -233,10 +233,12 @@ def arch_differences(request): arch_a = Arch.objects.get(name='i686') arch_b = Arch.objects.get(name='x86_64') differences = get_differences_info(arch_a, arch_b) + multilib_diffs = multilib_differences() context = { 'arch_a': arch_a, 'arch_b': arch_b, 'differences': differences, + 'multilib_differences': multilib_diffs } return direct_to_template(request, 'packages/differences.html', context) diff --git a/sitestatic/archweb.css b/sitestatic/archweb.css index a354cb96..3407cb4b 100644 --- a/sitestatic/archweb.css +++ b/sitestatic/archweb.css @@ -668,9 +668,13 @@ div#pkglist-about { } /* search fields and other filter selections */ +.filter-criteria { + margin-bottom: 1em; +} + .filter-criteria h3 { font-size: 1em; - margin-top:0; + margin-top: 0; } .filter-criteria div { diff --git a/templates/packages/differences.html b/templates/packages/differences.html index 33455d26..f5416d2b 100644 --- a/templates/packages/differences.html +++ b/templates/packages/differences.html @@ -4,31 +4,32 @@ {% block content %} {% if differences %} -
+

Package Differences by Architecture

-

Filter Differences View

-
-
- Select filter criteria -
- -
-
-
-
-
-
-
-
-
+
+

Filter Differences View

+
+
+ Select filter criteria +
+ +
+
+
+
+
+
+
+
+
+ {# TODO some sort of spacing here #} -
- +
@@ -57,17 +58,54 @@
Package Name
+ +
+

Multilib Differences to Main Packages

+ + + + + + + + + + + + + + + {% for pkg1, pkg2 in multilib_differences %} + + + + + + + + + + {% endfor %} + +
Multilib NameMultilib Versioni686 Versioni686 Namei686 RepoMultilib Last Updatedi686 Last Updated
{{ pkg1.pkgname }}{{ pkg1.full_version }}{{ pkg2.full_version }}{{ pkg2.pkgname }}{{ pkg2.repo }}{{ pkg1.last_update|date }}{{ pkg2.last_update|date }}
+ +
+ {% load cdn %}{% jquery %} {% endif %} -- cgit v1.2.3