summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-11-11 18:57:04 +0100
committerDan McGee <dan@archlinux.org>2011-11-11 18:57:04 +0100
commita883b0af23143364ab0724fda2ecdef9aba8191f (patch)
treef13ceb1a24ee1b9618c6fdc9fb543f6c1a957671 /packages
parent022692b3f33de8c45741d3cb27fa95f9f6facdea (diff)
downloadarchweb-a883b0af23143364ab0724fda2ecdef9aba8191f.tar.gz
archweb-a883b0af23143364ab0724fda2ecdef9aba8191f.tar.xz
Add a split packages sitemap
With very low priority, but this should at least give a few more cross-linking pages to any crawlers using sitemaps. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/utils.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/packages/utils.py b/packages/utils.py
index 0df0e38..f8e1f2a 100644
--- a/packages/utils.py
+++ b/packages/utils.py
@@ -2,10 +2,10 @@ from collections import defaultdict
from operator import itemgetter
from django.db import connection
-from django.db.models import Count, Max
+from django.db.models import Count, Max, F
from django.contrib.auth.models import User
-from main.models import Package, Repo
+from main.models import Package, Arch, Repo
from main.utils import cache_function, groupby_preserve_order, PackageStandin
from .models import (PackageGroup, PackageRelation,
SignoffSpecification, Signoff, DEFAULT_SIGNOFF_SPEC)
@@ -49,6 +49,20 @@ def get_group_info(include_arches=None):
groups.extend(val.itervalues())
return sorted(groups, key=itemgetter('name', 'arch'))
+def get_split_packages_info():
+ '''Return info on split packages that do not have an actual package name
+ matching the split pkgbase.'''
+ pkgnames = Package.objects.values('pkgname')
+ split_pkgs = Package.objects.exclude(pkgname=F('pkgbase')).exclude(
+ pkgbase__in=pkgnames).values('pkgbase', 'repo', 'arch').annotate(
+ last_update=Max('last_update'))
+ all_arches = Arch.objects.in_bulk(set(s['arch'] for s in split_pkgs))
+ all_repos = Repo.objects.in_bulk(set(s['repo'] for s in split_pkgs))
+ for split in split_pkgs:
+ split['arch'] = all_arches[split['arch']]
+ split['repo'] = all_repos[split['repo']]
+ return split_pkgs
+
class Difference(object):
def __init__(self, pkgname, repo, pkg_a, pkg_b):
self.pkgname = pkgname