From e5bd7694320185cd1613f8c026d0f9e7bf2a2316 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 17 Jun 2010 00:29:00 -0500 Subject: Remove arch from mirrorlist generation With pacman 3.4.0, we can now use the $arch variable so we don't need architecture-specific mirrorlists. Signed-off-by: Dan McGee --- mirrors/views.py | 14 +++----------- templates/mirrors/mirrorlist.txt | 2 +- urls.py | 5 +---- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/mirrors/views.py b/mirrors/views.py index 28297929..a67a2d7c 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -4,20 +4,16 @@ from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, render_to_response from django.template import RequestContext -from main.models import Arch, Mirror, MirrorUrl +from main.models import Mirror, MirrorUrl from main.utils import make_choice class MirrorlistForm(forms.Form): - arch = forms.ChoiceField(required=True) country = forms.ChoiceField(required=False) def __init__(self, *args, **kwargs): super(MirrorlistForm, self).__init__(*args, **kwargs) - arches = Arch.objects.exclude(name__iexact='any').order_by('name') mirrors = Mirror.objects.values_list( 'country', flat=True).distinct().order_by('country') - self.fields['arch'].choices = make_choice( - [arch.name for arch in arches]) self.fields['country'].choices = [('all', 'All')] + make_choice( [mirror for mirror in mirrors]) @@ -26,19 +22,16 @@ def choose(request): if request.POST: form = MirrorlistForm(data=request.POST) if form.is_valid(): - arch = form.cleaned_data['arch'] country = form.cleaned_data['country'] return HttpResponseRedirect(reverse(generate, - kwargs = {'arch' : arch, 'country' : country })) + kwargs = { 'country' : country })) else: form = MirrorlistForm() return render_to_response('mirrors/index.html', {'mirrorlist_form': form}, context_instance=RequestContext(request)) -def generate(request, arch='i686', country=None): - # do a quick sanity check on the architecture - archobj = get_object_or_404(Arch, name=arch) +def generate(request, country=None): qset = MirrorUrl.objects.select_related().filter( Q(protocol__protocol__iexact='HTTP') | Q(protocol__protocol__iexact='FTP'), @@ -50,7 +43,6 @@ def generate(request, arch='i686', country=None): res = render_to_response('mirrors/mirrorlist.txt', { 'mirror_urls': qset, - 'arch': arch, }, mimetype='text/plain') return res diff --git a/templates/mirrors/mirrorlist.txt b/templates/mirrors/mirrorlist.txt index 891800d1..9d5b6919 100644 --- a/templates/mirrors/mirrorlist.txt +++ b/templates/mirrors/mirrorlist.txt @@ -9,5 +9,5 @@ content right, and then go back later to fix it all up. #{% for mirror_url in mirror_urls %}{% ifchanged %} # {{ mirror_url.mirror.country }}{% endifchanged %} -#Server = {{ mirror_url.url}}$repo/os/{{ arch }}{% endfor %} +#Server = {{ mirror_url.url}}$repo/os/$arch{% endfor %} {% endautoescape %} diff --git a/urls.py b/urls.py index 64e60ccb..75de9546 100644 --- a/urls.py +++ b/urls.py @@ -66,10 +66,7 @@ (r'^mirrors/$', 'devel.views.mirrorlist'), (r'^mirrorlist/$', 'mirrors.views.choose'), - (r'^mirrorlist/(?P[\S]+)/(?P[A-z0-9 ]+)/$', - 'mirrors.views.generate'), - (r'^mirrorlist/(?P[\S]+)/$', - 'mirrors.views.generate'), + (r'^mirrorlist/(?P[A-z0-9 ]+)/$', 'mirrors.views.generate'), (r'^devel/$', 'devel.views.index'), (r'^devel/notify/$', 'devel.views.change_notify'), -- cgit v1.2.3-54-g00ecf