summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2018-08-12 18:11:47 +0200
committerJelle van der Waa <jelle@vdwaa.nl>2018-08-12 19:53:58 +0200
commit3283144db265106b5e225d33e6edc19140f48ee8 (patch)
treebb86bce144907b9e3d2da4ddfad9d177904db6cf /packages
parent94c9b901934bfa1aa2bd4ed2db61bb335efa3a4f (diff)
downloadarchweb-3283144db265106b5e225d33e6edc19140f48ee8.tar.gz
archweb-3283144db265106b5e225d33e6edc19140f48ee8.zip
packages: remove unused get_differences_info
The view which used get_differences_info was removed in 373a426cb1ccbcaf9c43f but didn't clean up the utility functions.
Diffstat (limited to 'packages')
-rw-r--r--packages/utils.py55
-rw-r--r--packages/views/__init__.py7
2 files changed, 4 insertions, 58 deletions
diff --git a/packages/utils.py b/packages/utils.py
index ccf5e1b5..dbf8b90c 100644
--- a/packages/utils.py
+++ b/packages/utils.py
@@ -1,6 +1,6 @@
from collections import defaultdict
from itertools import chain
-from operator import attrgetter, itemgetter
+from operator import itemgetter
import re
from django.core.serializers.json import DjangoJSONEncoder
@@ -119,59 +119,6 @@ class Difference(object):
return hash(self.__key())
-def get_differences_info(arch_a, arch_b):
- # This is a monster. Join packages against itself, looking for packages in
- # our non-'any' architectures only, and not having a corresponding package
- # entry in the other table (or having one with a different pkgver). We will
- # then go and fetch all of these packages from the database and display
- # them later using normal ORM models.
- sql = """
-SELECT p.id, q.id
- FROM packages p
- LEFT JOIN packages q
- ON (
- p.pkgname = q.pkgname
- AND p.repo_id = q.repo_id
- AND p.arch_id != q.arch_id
- AND p.id != q.id
- )
- WHERE p.arch_id IN (%s, %s)
- AND (
- q.id IS NULL
- OR p.pkgver != q.pkgver
- OR p.pkgrel != q.pkgrel
- OR p.epoch != q.epoch
- )
-"""
- cursor = connection.cursor()
- cursor.execute(sql, [arch_a.id, arch_b.id])
- results = cursor.fetchall()
- # column A will always have a value, column B might be NULL
- to_fetch = {row[0] for row in results}
- # fetch all of the necessary packages
- pkgs = Package.objects.normal().in_bulk(to_fetch)
- # now build a set containing differences
- differences = set()
- for row in results:
- pkg_a = pkgs.get(row[0])
- pkg_b = pkgs.get(row[1])
- # We want arch_a to always appear first
- # pkg_a should never be None
- if pkg_a.arch == arch_a:
- item = Difference(pkg_a.pkgname, pkg_a.repo, pkg_a, pkg_b)
- else:
- # pkg_b can be None in this case, so be careful
- name = pkg_a.pkgname if pkg_a else pkg_b.pkgname
- repo = pkg_a.repo if pkg_a else pkg_b.repo
- item = Difference(name, repo, pkg_b, pkg_a)
- differences.add(item)
-
- # now sort our list by repository, package name
- key_func = attrgetter('repo.name', 'pkgname')
- differences = sorted(differences, key=key_func)
- return differences
-
-
def multilib_differences():
# Query for checking multilib out of date-ness
if database_vendor(Package) == 'sqlite':
diff --git a/packages/views/__init__.py b/packages/views/__init__.py
index d1dc8177..4d254420 100644
--- a/packages/views/__init__.py
+++ b/packages/views/__init__.py
@@ -11,14 +11,13 @@ from django.shortcuts import redirect, render
from django.views.decorators.cache import cache_control
from django.views.decorators.http import require_safe, require_POST
-from main.models import Package, Arch
+from main.models import Package
from ..models import PackageRelation
-from ..utils import (get_differences_info,
- multilib_differences, get_wrong_permissions)
+from ..utils import multilib_differences, get_wrong_permissions
# make other views available from this same package
from .display import (details, groups, group_details, files, details_json,
- files_json, download)
+ files_json, download)
from .flag import flaghelp, flag, flag_confirmed, unflag, unflag_all
from .search import search_json
from .signoff import signoffs, signoff_package, signoff_options, signoffs_json