Move differences into it's own function
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
971e9faf90
commit
4c3100ab90
@ -400,17 +400,14 @@ def download(request, name='', repo='', arch=''):
|
|||||||
url = string.Template('${host}${repo}/os/${arch}/${file}').substitute(details)
|
url = string.Template('${host}${repo}/os/${arch}/${file}').substitute(details)
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
def arch_differences(request):
|
@cache_function(300)
|
||||||
|
def get_differences_information(arch_a, arch_b):
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from operator import itemgetter
|
|
||||||
# This is a monster. Join packages against itself, looking for packages in
|
# This is a monster. Join packages against itself, looking for packages in
|
||||||
# our non-'any' architectures only, and not having a corresponding package
|
# 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
|
# 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
|
# then go and fetch all of these packages from the database and display
|
||||||
# them later using normal ORM models.
|
# them later using normal ORM models.
|
||||||
# TODO: we have some hardcoded magic here with respect to the arches.
|
|
||||||
arch_a = Arch.objects.get(name='i686')
|
|
||||||
arch_b = Arch.objects.get(name='x86_64')
|
|
||||||
sql = """
|
sql = """
|
||||||
SELECT p.id, q.id
|
SELECT p.id, q.id
|
||||||
FROM packages p
|
FROM packages p
|
||||||
@ -458,7 +455,13 @@ def arch_differences(request):
|
|||||||
|
|
||||||
# now sort our list by repository, package name
|
# now sort our list by repository, package name
|
||||||
differences.sort(key=lambda a: (a[1].name, a[0]))
|
differences.sort(key=lambda a: (a[1].name, a[0]))
|
||||||
|
return differences
|
||||||
|
|
||||||
|
def arch_differences(request):
|
||||||
|
# TODO: we have some hardcoded magic here with respect to the arches.
|
||||||
|
arch_a = Arch.objects.get(name='i686')
|
||||||
|
arch_b = Arch.objects.get(name='x86_64')
|
||||||
|
differences = get_differences_information(arch_a, arch_b)
|
||||||
context = {
|
context = {
|
||||||
'arch_a': arch_a,
|
'arch_a': arch_a,
|
||||||
'arch_b': arch_b,
|
'arch_b': arch_b,
|
||||||
|
Loading…
Reference in New Issue
Block a user