From 7e3053003b42dfd8fbe40112496dbd7d13827222 Mon Sep 17 00:00:00 2001 From: Henning Garus Date: Sun, 7 Sep 2008 16:17:41 +0200 Subject: [PATCH] Fix duplicated dependencies in package details FS#11414 If a package was in several repos (testing and another one) dependencies were shown several times. With this patch a dependency for testing is looked up in testing first, then - if none was found - in the other repos. For the other repos testing is excluded from dependency lookups. --- main/models.py | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/main/models.py b/main/models.py index 018666b..1ddfd43 100644 --- a/main/models.py +++ b/main/models.py @@ -231,9 +231,18 @@ class Package(models.Model): deps = [] for dep in self.packagedepend_set.order_by('depname'): # we only need depend on same-arch-packages - pkgs = Package.objects.filter( - Q(arch__name__iexact='any') | Q(arch=self.arch), - pkgname=dep.depname) + # if a dependency for a package in testing is found in testing, + # don't look further. + if self.repo.name == 'Testing': + pkgs = Package.objects.filter( + Q(arch__name__iexact='any') | Q(arch=self.arch), + pkgname=dep.depname, repo=self.repo) + if self.repo.name != 'Testing' or len(pkgs) == 0: + pkgs = Package.objects.filter( + Q(arch__name__iexact='any') | Q(arch=self.arch), + pkgname=dep.depname) & \ + Package.objects.exclude( + repo__name='Testing') if len(pkgs) == 0: # couldn't find a package in the DB # it should be a virtual depend (or a removed package) -- 1.6.0.1