summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/models.py17
-rw-r--r--packages/views.py13
2 files changed, 19 insertions, 11 deletions
diff --git a/main/models.py b/main/models.py
index 05e63fed..e0017069 100644
--- a/main/models.py
+++ b/main/models.py
@@ -226,6 +226,7 @@ class Package(models.Model):
groupby(requiredby, lambda x: x.pkg.id)]
# find another package by this name in the opposite testing setup
+ # TODO: figure out staging exclusions too
if not Package.objects.filter(pkgname=self.pkgname,
arch=self.arch).exclude(id=self.id).exclude(
repo__testing=self.repo.testing).exists():
@@ -241,7 +242,8 @@ class Package(models.Model):
dep = dep_pkgs[0]
if len(dep_pkgs) > 1:
dep_pkgs = [d for d in dep_pkgs
- if d.pkg.repo.testing == self.repo.testing]
+ if d.pkg.repo.testing == self.repo.testing and
+ d.pkg.repo.staging = self.repo.staging]
if len(dep_pkgs) > 0:
dep = dep_pkgs[0]
trimmed.append(dep)
@@ -273,7 +275,8 @@ class Package(models.Model):
# grab the first though in case we fail
pkg = pkgs[0]
# prevents yet more DB queries, these lists should be short
- pkgs = [p for p in pkgs if p.repo.testing == self.repo.testing]
+ pkgs = [p for p in pkgs if p.repo.testing == self.repo.testing
+ and p.repo.staging = self.repo.staging]
if len(pkgs) > 0:
pkg = pkgs[0]
deps.append({'dep': dep, 'pkg': pkg})
@@ -293,7 +296,8 @@ class Package(models.Model):
# this package might be split across repos? just find one
# that matches the correct [testing] repo flag
pkglist = Package.objects.filter(arch=self.arch,
- repo__testing=self.repo.testing, pkgname=self.pkgbase)
+ repo__testing=self.repo.testing,
+ repo__staging=self.repo.staging, pkgname=self.pkgbase)
if len(pkglist) > 0:
return pkglist[0]
return None
@@ -303,11 +307,12 @@ class Package(models.Model):
Return all packages that were built with this one (e.g. share a pkgbase
value). The package this method is called on will never be in the list,
and we will never return a package that does not have the same
- repo.testing flag. For any non-split packages, the return value will be
- an empty list.
+ repo.testing and repo.staging flags. For any non-split packages, the
+ return value will be an empty list.
"""
return Package.objects.filter(arch__in=self.applicable_arches(),
- repo__testing=self.repo.testing, pkgbase=self.pkgbase).exclude(id=self.id)
+ repo__testing=self.repo.testing, repo__staging=self.repo.staging,
+ pkgbase=self.pkgbase).exclude(id=self.id)
def is_same_version(self, other):
'is this package similar, name and version-wise, to another'
diff --git a/packages/views.py b/packages/views.py
index 02b9f93b..01d01e20 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -118,7 +118,8 @@ def details(request, name='', repo='', arch=''):
arches.extend(Arch.objects.filter(agnostic=True))
repo = get_object_or_404(Repo, name__iexact=repo)
pkgs = Package.objects.normal().filter(pkgbase=name,
- repo__testing=repo.testing, arch__in=arches).order_by('pkgname')
+ repo__testing=repo.testing, repo__staging=repo.staging,
+ arch__in=arches).order_by('pkgname')
if len(pkgs) == 0:
raise Http404
context = {
@@ -343,8 +344,8 @@ def unflag_all(request, name, repo, arch):
pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
# find all packages from (hopefully) the same PKGBUILD
- pkgs = Package.objects.filter(
- pkgbase=pkg.pkgbase, repo__testing=pkg.repo.testing)
+ pkgs = Package.objects.filter(pkgbase=pkg.pkgbase,
+ repo__testing=pkg.repo.testing, repo__staging=pkg.repo.staging)
pkgs.update(flag_date=None)
return redirect(pkg)
@@ -416,7 +417,8 @@ def flag(request, name, repo, arch):
# find all packages from (hopefully) the same PKGBUILD
pkgs = Package.objects.normal().filter(
pkgbase=pkg.pkgbase, flag_date__isnull=True,
- repo__testing=pkg.repo.testing).order_by(
+ repo__testing=pkg.repo.testing,
+ repo__staging=pkg.repo.staging).order_by(
'pkgname', 'repo__name', 'arch__name')
if request.POST:
@@ -471,7 +473,8 @@ def flag_confirmed(request, name, repo, arch):
pkgname=name, repo__name__iexact=repo, arch__name=arch)
pkgs = Package.objects.normal().filter(
pkgbase=pkg.pkgbase, flag_date=pkg.flag_date,
- repo__testing=pkg.repo.testing).order_by(
+ repo__testing=pkg.repo.testing,
+ repo__staging=pkg.repo.staging).order_by(
'pkgname', 'repo__name', 'arch__name')
context = {'package': pkg, 'packages': pkgs}