Commit 864864ae authored by Michal Donat's avatar Michal Donat Committed by Jelle van der Waa
Browse files

add packages rss feeds for "all stable repos" and "all testing repos"

https://bugs.archlinux.org/task/59329
parent b7ed8303
......@@ -74,10 +74,23 @@ def get_object(self, request, arch='', repo=''):
qs = qs.filter(Q(arch=a) | Q(arch__agnostic=True))
obj['arch'] = a
if repo != '':
# feed for a single arch AND repo
r = Repo.objects.get(name__iexact=repo)
qs = qs.filter(repo=r)
obj['repo'] = r
if repo == 'stable-repos':
# feed for a single arch AND all stable repos
r = Repo.objects.filter(testing=False, staging=False)
qs = qs.filter(repo__in=r)
obj['repos'] = r
setattr(obj['repos'], 'name', 'all stable repositories')
elif repo == 'testing-repos':
# feed for a single arch AND all testing repos
r = Repo.objects.filter(testing=True, staging=False)
qs = qs.filter(repo__in=r)
obj['repos'] = r
setattr(obj['repos'], 'name', 'all testing repositories')
else:
# feed for a single arch AND repo
r = Repo.objects.get(name__iexact=repo)
qs = qs.filter(repo=r)
obj['repo'] = r
else:
qs = qs.filter(repo__staging=False)
obj['qs'] = qs[:50]
......@@ -85,24 +98,47 @@ def get_object(self, request, arch='', repo=''):
def title(self, obj):
s = 'Arch Linux: Recent package updates'
if 'repo' in obj and 'arch' in obj:
s += ' (%s [%s])' % (obj['arch'].name, obj['repo'].name.lower())
elif 'repo' in obj:
s += ' [%s]' % (obj['repo'].name.lower())
elif 'arch' in obj:
s += ' (%s)' % (obj['arch'].name)
return s
fields = dict(
arch=obj['arch'].name if 'arch' in obj else None,
repo='[%s]' % obj['repo'].name.lower() if 'repo' in obj else None,
repos=obj['repos'].name if 'repos' in obj else None,)
if fields['arch']:
if fields['repo']:
s += ' (%(arch)s in %(repo)s)'
elif fields['repos']:
s += ' (%(arch)s in %(repos)s)'
else:
s += ' (%(arch)s)'
elif fields['repo']:
s += ' in %(repo)s'
elif fields['repos']:
s += ' in %(repos)s'
return s % fields
def description(self, obj):
s = 'Recently updated packages in the Arch Linux package repositories'
if 'arch' in obj:
s += ' for the \'%s\' architecture' % obj['arch'].name.lower()
s = 'Recently updated packages'
fields = dict(
arch=obj['arch'].name if 'arch' in obj else None,
repo='[%s]' % obj['repo'].name.lower() if 'repo' in obj else None,
repos=', '.join(['[%s]' % r.name.lower() for r in obj['repos'].all()]) if 'repos' in obj else None,)
if fields['arch']:
s += ' for the \'%(arch)s\' architecture'
if not obj['arch'].agnostic:
s += ' (including \'any\' packages)'
if 'repo' in obj:
s += ' in the [%s] repository' % obj['repo'].name.lower()
if fields['repo']:
s += ' in the Arch Linux %(repo)s repository'
elif fields['repos']:
s += ' in the %(repos)s repositories'
else:
s += ' in the Arch Linux package repositories'
s += '.'
return s
return s % fields
subtitle = description
......@@ -165,10 +201,23 @@ def get_object(self, request, operation='', arch='', repo=''):
qs = qs.filter(Q(arch=a) | Q(arch__agnostic=True))
obj['arch'] = a
if repo != '':
# feed for a single arch AND repo
r = Repo.objects.get(name__iexact=repo)
qs = qs.filter(repo=r)
obj['repo'] = r
if repo == 'stable-repos':
# feed for a single arch AND all stable repos
r = Repo.objects.filter(testing=False, staging=False)
qs = qs.filter(repo__in=r)
obj['repos'] = r
setattr(obj['repos'], 'name', 'all stable repositories')
elif repo == 'testing-repos':
# feed for a single arch AND all testing repos
r = Repo.objects.filter(testing=True, staging=False)
qs = qs.filter(repo__in=r)
obj['repos'] = r
setattr(obj['repos'], 'name', 'all testing repositories')
else:
# feed for a single arch AND repo
r = Repo.objects.get(name__iexact=repo)
qs = qs.filter(repo=r)
obj['repo'] = r
else:
qs = qs.filter(repo__staging=False)
......@@ -176,25 +225,49 @@ def get_object(self, request, operation='', arch='', repo=''):
return obj
def title(self, obj):
s = 'Arch Linux: Recent {} packages'.format(obj['action'])
if 'repo' in obj and 'arch' in obj:
s += ' (%s [%s])' % (obj['arch'].name, obj['repo'].name.lower())
elif 'repo' in obj:
s += ' [%s]' % (obj['repo'].name.lower())
elif 'arch' in obj:
s += ' (%s)' % (obj['arch'].name)
return s
s = 'Arch Linux: Recently %(action)s packages' % obj
fields = dict(
arch=obj['arch'].name if 'arch' in obj else None,
repo='[%s]' % obj['repo'].name.lower() if 'repo' in obj else None,
repos=obj['repos'].name if 'repos' in obj else None,)
if fields['arch']:
if fields['repo']:
s += ' (%(arch)s in %(repo)s)'
elif fields['repos']:
s += ' (%(arch)s in %(repos)s)'
else:
s += ' (%(arch)s)'
elif fields['repo']:
s += ' in %(repo)s'
elif fields['repos']:
s += ' in %(repos)s'
return s % fields
def description(self, obj):
s = 'Recently {} packages in the Arch Linux package repositories'.format(obj['action'])
if 'arch' in obj:
s += ' for the \'%s\' architecture' % obj['arch'].name.lower()
s = 'Recently %(action)s packages' % obj
fields = dict(
arch=obj['arch'].name if 'arch' in obj else None,
repo='[%s]' % obj['repo'].name.lower() if 'repo' in obj else None,
repos=', '.join(['[%s]' % r.name.lower() for r in obj['repos'].all()]) if 'repos' in obj else None,)
if fields['arch']:
s += ' for the \'%(arch)s\' architecture'
if not obj['arch'].agnostic:
s += ' (including \'any\' packages)'
if 'repo' in obj:
s += ' in the [%s] repository' % obj['repo'].name.lower()
if fields['repo']:
s += ' in the Arch Linux %(repo)s repository'
elif fields['repos']:
s += ' in the %(repos)s repositories'
else:
s += ' in the Arch Linux package repositories'
s += '.'
return s
return s % fields
subtitle = description
......
......@@ -44,6 +44,20 @@ <h3>Package Feeds</h3>
<td><a href="/feeds/packages/{{ arch }}/" class="rss">Feed</a></td>
{% endfor %}
</tr>
<tr>
<td><strong>All Stable Repos</strong></td>
<td><a href="/feeds/packages/all/stable-repos/" class="rss">Feed</a></td>
{% for arch in arches %}
<td><a href="/feeds/packages/{{ arch }}/stable-repos/" class="rss">Feed</a></td>
{% endfor %}
</tr>
<tr>
<td><strong>All Testing Repos</strong></td>
<td><a href="/feeds/packages/all/testing-repos/" class="rss">Feed</a></td>
{% for arch in arches %}
<td><a href="/feeds/packages/{{ arch }}/testing-repos/" class="rss">Feed</a></td>
{% endfor %}
</tr>
{% for repo in repos %}
<tr>
<td><strong>{{ repo }}</strong></td>
......@@ -78,6 +92,20 @@ <h3>Package Feeds</h3>
<td><a href="/feeds/packages/added/{{ arch }}/" class="rss">Feed</a></td>
{% endfor %}
</tr>
<tr>
<td><strong>All Stable Repos</strong></td>
<td><a href="/feeds/packages/added/all/stable-repos/" class="rss">Feed</a></td>
{% for arch in arches %}
<td><a href="/feeds/packages/added/{{ arch }}/stable-repos/" class="rss">Feed</a></td>
{% endfor %}
</tr>
<tr>
<td><strong>All Testing Repos</strong></td>
<td><a href="/feeds/packages/added/all/testing-repos/" class="rss">Feed</a></td>
{% for arch in arches %}
<td><a href="/feeds/packages/added/{{ arch }}/testing-repos/" class="rss">Feed</a></td>
{% endfor %}
</tr>
{% for repo in repos %}
<tr>
<td><strong>{{ repo }}</strong></td>
......@@ -109,6 +137,20 @@ <h3>Package Feeds</h3>
<td><a href="/feeds/packages/removed/{{ arch }}/" class="rss">Feed</a></td>
{% endfor %}
</tr>
<tr>
<td><strong>All Stable Repos</strong></td>
<td><a href="/feeds/packages/removed/all/stable-repos/" class="rss">Feed</a></td>
{% for arch in arches %}
<td><a href="/feeds/packages/removed/{{ arch }}/stable-repos/" class="rss">Feed</a></td>
{% endfor %}
</tr>
<tr>
<td><strong>All Testing Repos</strong></td>
<td><a href="/feeds/packages/removed/all/testing-repos/" class="rss">Feed</a></td>
{% for arch in arches %}
<td><a href="/feeds/packages/removed/{{ arch }}/testing-repos/" class="rss">Feed</a></td>
{% endfor %}
</tr>
{% for repo in repos %}
<tr>
<td><strong>{{ repo }}</strong></td>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment