Skip to content

Commit 88680f0

Browse files
committed
Flag lib32 out of date when non lib32 marked out of date
Signed-off-by: Lars Rustand <[email protected]>
1 parent c47aacb commit 88680f0

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

packages/views/flag.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from django.template import loader
1010
from django.utils.timezone import now
1111
from django.views.decorators.cache import cache_page, never_cache
12+
from django.db.models import Q
13+
from django.http import Http404
1214

1315
from ..models import FlagRequest
1416
from main.models import Package
@@ -54,13 +56,32 @@ def flag(request, name, repo, arch):
5456
if pkg.flag_date is not None:
5557
# already flagged. do nothing.
5658
return render(request, 'packages/flagged.html', {'pkg': pkg})
57-
# find all packages from (hopefully) the same PKGBUILD
58-
pkgs = Package.objects.normal().filter(
59-
pkgbase=pkg.pkgbase, flag_date__isnull=True,
59+
60+
# Find packages based on the same packagebase
61+
pkg_filter = Q(pkgbase=pkg.pkgbase, flag_date__isnull=True,
6062
repo__testing=pkg.repo.testing,
61-
repo__staging=pkg.repo.staging).order_by(
62-
'pkgname', 'repo__name', 'arch__name')
63+
repo__staging=pkg.repo.staging)
64+
65+
if "lib32-" in name:
66+
# Find normal version of lib32 packages
67+
non_lib32_pkg = get_object_or_404(Package.objects.normal(),
68+
pkgname=name.replace("lib32-",""))
69+
pkg_filter = pkg_filter | Q(pkgbase=non_lib32_pkg.pkgbase,
70+
flag_date__isnull=True)
71+
else:
72+
# Find lib32 version of normal packages
73+
try:
74+
lib32_pkg = get_object_or_404(Package.objects.normal(),
75+
pkgname="lib32-"+pkg.pkgbase)
76+
pkg_filter = pkg_filter | Q(pkgbase=lib32_pkg.pkgbase,
77+
flag_date__isnull=True)
78+
except Http404:
79+
pass # Do not raise an error when there is no lib32 version
80+
6381

82+
83+
pkgs = Package.objects.normal().filter(pkg_filter).order_by(
84+
'pkgname', 'repo__name', 'arch__name')
6485
authenticated = request.user.is_authenticated
6586

6687
if request.POST:

0 commit comments

Comments
 (0)