summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-11-04 03:20:50 +0100
committerDan McGee <dan@archlinux.org>2011-11-04 03:20:50 +0100
commit5e295a3dbb0b64f229e9419384721b154e013b9e (patch)
tree1b0706a3e681e852ee8be9169a9e2d82f1aa00a2 /packages
parent800ea45528e297c38e068775951e666f8191ef45 (diff)
downloadarchweb-5e295a3dbb0b64f229e9419384721b154e013b9e.tar.gz
archweb-5e295a3dbb0b64f229e9419384721b154e013b9e.tar.xz
Allow signoff options to apply to all packages across architectures
If you check the new box, you can set the options for both the i686 and the x86_64 packages at the same time. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/views.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/packages/views.py b/packages/views.py
index 00dd7f7..aa15d0c 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -6,6 +6,7 @@ from django.contrib.auth.decorators import permission_required
from django.conf import settings
from django.core.mail import send_mail
from django.core.serializers.json import DjangoJSONEncoder
+from django.db import transaction
from django.db.models import Q
from django.http import HttpResponse, Http404, HttpResponseForbidden
from django.shortcuts import (get_object_or_404, get_list_or_404,
@@ -426,10 +427,36 @@ def signoff_package(request, name, repo, arch, revoke=False):
return redirect('package-signoffs')
class SignoffOptionsForm(forms.ModelForm):
+ apply_all = forms.BooleanField(required=False,
+ help_text="Apply these options to all architectures?")
+
class Meta:
model = SignoffSpecification
fields = ('required', 'enabled', 'known_bad', 'comments')
+def _signoff_options_all(request, name, repo):
+ seen_ids = set()
+ with transaction.commit_on_success():
+ # find or create a specification for all architectures, then
+ # graft the form data onto them
+ packages = Package.objects.filter(pkgbase=name,
+ repo__name__iexact=repo, repo__testing=True)
+ for package in packages:
+ try:
+ spec = SignoffSpecification.objects.get_from_package(package)
+ if spec.pk in seen_ids:
+ continue
+ except SignoffSpecification.DoesNotExist:
+ spec = SignoffSpecification(pkgbase=package.pkgbase,
+ pkgver=package.pkgver, pkgrel=package.pkgrel,
+ epoch=package.epoch, arch=package.arch,
+ repo=package.repo)
+ spec.user = request.user
+ form = SignoffOptionsForm(request.POST, instance=spec)
+ if form.is_valid():
+ form.save()
+ seen_ids.add(form.instance.pk)
+
@permission_required('main.change_package')
@never_cache
def signoff_options(request, name, repo, arch):
@@ -453,7 +480,10 @@ def signoff_options(request, name, repo, arch):
if request.POST:
form = SignoffOptionsForm(request.POST, instance=spec)
if form.is_valid():
- form.save()
+ if form.cleaned_data['apply_all']:
+ _signoff_options_all(request, name, repo)
+ else:
+ form.save()
return redirect('package-signoffs')
else:
form = SignoffOptionsForm(instance=spec)