From 7fc8da7d959556b1204b7864959e73e7f5f5ec59 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 13 Apr 2013 13:05:02 -0500 Subject: Show replacments for package if it has been removed This covers the case where we can't find the package in any other repositories, but it was removed recently enough that we have a found package update object. Signed-off-by: Dan McGee --- packages/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'packages/models.py') diff --git a/packages/models.py b/packages/models.py index 7bcdc000..92566a56 100644 --- a/packages/models.py +++ b/packages/models.py @@ -321,6 +321,15 @@ class Update(models.Model): return Package.objects.normal().filter( pkgname=self.pkgname, arch=self.arch) + def replacements(self): + pkgs = Package.objects.normal().filter( + replaces__name=self.pkgname) + if not self.arch.agnostic: + # make sure we match architectures if possible + arches = self.pkg.applicable_arches() + pkgs = pkgs.filter(arch__in=arches) + return pkgs + def __unicode__(self): return u'%s of %s on %s' % (self.get_action_flag_display(), self.pkgname, self.created) -- cgit v1.2.3-2-g168b From 4d7d08f93de9e6af9e664a00e090158e738a890c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 14 Apr 2013 13:45:00 -0500 Subject: Fix missing attribute error in replacment find code Whoops. Just introduced this when ensuring we look for both the packgae in other repositories as well as any replacments. Signed-off-by: Dan McGee --- packages/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/models.py') diff --git a/packages/models.py b/packages/models.py index 92566a56..f830aade 100644 --- a/packages/models.py +++ b/packages/models.py @@ -326,7 +326,8 @@ class Update(models.Model): replaces__name=self.pkgname) if not self.arch.agnostic: # make sure we match architectures if possible - arches = self.pkg.applicable_arches() + arches = set(Arch.objects.filter(agnostic=True)) + arches.add(self.arch) pkgs = pkgs.filter(arch__in=arches) return pkgs -- cgit v1.2.3-2-g168b