diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/templatetags/package_extras.py | 58 | ||||
-rw-r--r-- | packages/utils.py | 6 | ||||
-rw-r--r-- | packages/views/__init__.py | 5 |
3 files changed, 47 insertions, 22 deletions
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py index f7392a96..ca977c03 100644 --- a/packages/templatetags/package_extras.py +++ b/packages/templatetags/package_extras.py @@ -95,6 +95,18 @@ def maintainer_link(user): @register.simple_tag +def get_download_link(package): + parts = { + "repo": package.repo.name.lower(), + "arch": package.arch.name, + "pkgfile": package.filename + } + if parts["arch"] == "any": + parts["arch"] = "i686" + linkbase = "https://repo.parabolagnulinux.org/%(repo)s/os/%(arch)s/%(pkgfile)s" + return linkbase % parts + +@register.simple_tag def packager_link(user): if user: # TODO don't hardcode @@ -106,43 +118,51 @@ def packager_link(user): ) return '' - -@register.simple_tag -def scm_link(package, operation): - parts = (package.repo.svn_root, operation, package.pkgbase) - linkbase = ( - "https://projects.archlinux.org/svntogit/%s.git/%s/trunk?" - "h=packages/%s") - return linkbase % tuple(urlquote(part.encode('utf-8')) for part in parts) - - @register.simple_tag def get_wiki_link(package): - url = "https://wiki.archlinux.org/index.php/Special:Search" + url = "https://wiki.parabolagnulinux.org/index.php" data = { + 'title': "Special:Search", 'search': package.pkgname, } return link_encode(url, data) @register.simple_tag +def svn_arch(package): + repo = package.repo.name.lower() + return svn_link(package, "repos/%s-%s" % (repo, package.arch.name)) + +@register.simple_tag +def svn_trunk(package): + return svn_link(package, "trunk") + +@register.simple_tag def bugs_list(package): - url = "https://bugs.archlinux.org/" + url = "https://labs.parabola.nu/search/index/issue-tracker" data = { - 'project': package.repo.bugs_project, - 'cat[]': package.repo.bugs_category, - 'string': package.pkgname, + 'titles_only': '1', + 'issues': '1', + 'q': package.pkgname, } return link_encode(url, data) @register.simple_tag def bug_report(package): - url = "https://bugs.archlinux.org/newtask" + url = "https://labs.parabola.nu/projects/issue-tracker/issues/new" + data = { + 'issue[subject]': '[%s] PLEASE ENTER SUMMARY' % package.pkgname, + } + return link_encode(url, data) + +@register.simple_tag +def flag_unfree(package): + url = "https://labs.parabola.nu/projects/issue-tracker/issues/new" data = { - 'project': package.repo.bugs_project, - 'product_category': package.repo.bugs_category, - 'item_summary': '[%s] PLEASE ENTER SUMMARY' % package.pkgname, + 'issue[priority_id]': '1', # "freedom issue" + 'issue[watcher_user_ids][]': '62', # "dev-list" + 'issue[subject]': '[%s] Please put your reasons here (register first if you haven\'t)' % package.pkgname, } return link_encode(url, data) diff --git a/packages/utils.py b/packages/utils.py index 6ec39483..fade0855 100644 --- a/packages/utils.py +++ b/packages/utils.py @@ -137,6 +137,10 @@ SELECT p.id, q.id ) WHERE p.arch_id IN (%s, %s) AND ( + q.arch_id IN (%s, %s) + OR q.id IS NULL + ) + AND ( q.id IS NULL OR p.pkgver != q.pkgver OR p.pkgrel != q.pkgrel @@ -144,7 +148,7 @@ SELECT p.id, q.id ) """ cursor = connection.cursor() - cursor.execute(sql, [arch_a.id, arch_b.id]) + cursor.execute(sql, [arch_a.id, arch_b.id, arch_a.id, arch_b.id]) results = cursor.fetchall() # column A will always have a value, column B might be NULL to_fetch = {row[0] for row in results} diff --git a/packages/views/__init__.py b/packages/views/__init__.py index c1f0f492..b6e72d62 100644 --- a/packages/views/__init__.py +++ b/packages/views/__init__.py @@ -110,14 +110,15 @@ def update(request): def arch_differences(request): # TODO: we have some hardcoded magic here with respect to the arches. - arch_a = Arch.objects.get(name='i686') - arch_b = Arch.objects.get(name='x86_64') + arch_a = Arch.objects.get(name=request.GET.get('arch_a', 'i686')) + arch_b = Arch.objects.get(name=request.GET.get('arch_b', 'x86_64')) differences = get_differences_info(arch_a, arch_b) multilib_diffs = multilib_differences() context = { 'arch_a': arch_a, 'arch_b': arch_b, 'differences': differences, + 'arches': Arch.objects.filter(agnostic=False), 'multilib_differences': multilib_diffs } return render(request, 'packages/differences.html', context) |