summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-09-08 11:12:43 -0500
committerDan McGee <dan@archlinux.org>2010-09-08 11:12:43 -0500
commit04da5f03b254a6000c92eb4e32bdfaa88724f4a4 (patch)
treece7dd0ff708ce92e37b52a2ff4f6f9cad35bed7a /main
parent5c78ad746942cafa03ed4834eefac98832021558 (diff)
Use arch.agnostic flag everywhere
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main')
-rw-r--r--main/models.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/main/models.py b/main/models.py
index 70ab4bd6..0f4ae967 100644
--- a/main/models.py
+++ b/main/models.py
@@ -155,9 +155,11 @@ class Package(models.Model):
"""
Returns a list of package objects.
"""
+ arches = list(Arch.objects.filter(agnostic=True))
+ arches.append(self.arch)
requiredby = Package.objects.select_related('arch', 'repo').filter(
packagedepend__depname=self.pkgname,
- arch__name__in=(self.arch.name, 'any')).distinct()
+ arch__in=arches).distinct()
return requiredby.order_by('pkgname')
@cache_function(300)
@@ -168,12 +170,15 @@ class Package(models.Model):
else pkg will be None if it is a 'virtual' dependency.
"""
deps = []
+ arches = list(Arch.objects.filter(agnostic=True))
+ arches.append(self.arch)
# TODO: we can use list comprehension and an 'in' query to make this more effective
for dep in self.packagedepend_set.order_by('depname'):
- pkgs = Package.objects.select_related('arch', 'repo').filter(pkgname=dep.depname)
- if self.arch.name != 'any':
+ pkgs = Package.objects.select_related('arch', 'repo').filter(
+ pkgname=dep.depname)
+ if not self.arch.agnostic:
# make sure we match architectures if possible
- pkgs = pkgs.filter(arch__name__in=(self.arch.name, 'any'))
+ pkgs = pkgs.filter(arch__in=arches)
if len(pkgs) == 0:
# couldn't find a package in the DB
# it should be a virtual depend (or a removed package)