summaryrefslogtreecommitdiffstats
path: root/packages/utils.py
AgeCommit message (Collapse)AuthorFilesLines
2012-12-28Make attach_maintainers null-safeDan McGee1-1/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16Use python set comprehension syntax supported in 2.7Dan McGee1-5/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16Use Python 2.7 dictionary comprehension syntaxDan McGee1-3/+2
Rather than the old idiom of dict((k, v) for <> in <>). Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-14Refactor signoff-grabbing queriesDan McGee1-22/+18
Make them a bit more efficient by adding an explicit condition on both the packages and signoff table for the repo ID, and move the common code into a shared function both can use. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-12Make wrong permissions query more efficientDan McGee1-5/+6
This removes the subplan and per-row query in favor of a LEFT JOIN where we look for non-matching rows. Tested in sqlite3 and PostgreSQL. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-15Fix signoffs SQL queryDan McGee1-1/+2
Although the old query returned the same results, the repos IN clause should really be a part of the WHERE, not the JOIN condition. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-09PEP8 cleanups in package utilsDan McGee1-6/+11
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-09Extract parse_version function from reporead logicDan McGee1-0/+18
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-09Get multilib package differences query working on sqlite3Dan McGee1-9/+22
Thank you database engines for all implementing such simple operations as substring() and length() in different ways. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-09Use a set instead of list when gathering package IDs to fetchDan McGee1-1/+1
If we have duplicates in this list, it makes no sense to include them in the list we send to the database. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-19Switch to usage of new Depend objectDan McGee1-3/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-02Ensure order_by default value is cleared when using distinct()Dan McGee1-1/+2
Otherwise the queryset returns nonsensical results. I find the design of this less than obvious but so be it; we can ensure the results work regardless of a default ordering on the model. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07Move PackageJSONEncoder into package.utils moduleDan McGee1-1/+36
This will allow it to be used elsewhere, and doesn't really belong in views anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-05Adjust page and content caching lengths and decoratorsDan McGee1-2/+2
Remove never_cache from many places now that we don't actually need it since we aren't caching by default. Adjust our cache_function decorator times be shorter values, and also randomize them a bit to make cache invalidations not all line up. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12PyLint suggested cleanupsDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-08Multilib differences reportDan McGee1-0/+43
This new tables shows multilib packages paired with their regular counterparts in the normal repos if the pkgver differs. A few name hacks are needed to trim lib32-, -multilib, etc. from the name to find the matching package. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-11Add a split packages sitemapDan McGee1-2/+16
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>
2011-11-11Show relevant signoffs on dashboardDan McGee1-1/+6
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Rewrite get_target_repo_map() using raw SQLDan McGee1-8/+20
This improves the shitty query plan brought upon us by MySQL by rewriting it to use JOINs only and no dependent subqueries. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Fix signoff target repo mappingDan McGee1-0/+1
I clearly should not have removed this code yesterday, otherwise packages have their target repo matched to a testing one. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Find all potential package signoff specifications upfrontDan McGee1-15/+39
This should save a significant amount of time in the case where there are a lot of signups to look up; at least one query per signoff row. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Make maintainer lookup on todo lists fastDan McGee1-0/+1
This is rather sick to look at. Sorry, Django gives me no other choice. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Add new attach_maintainers() utility methodDan McGee1-3/+31
This allows us to alleviate the N+1 query problem when we want maintainer data for a queryset of packages. We use it on signoffs here; we should also be able to apply this to the todolist section where this problem has existed for some time. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Minor signoff query tweaks/optimizationsDan McGee1-4/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Allow signoff manipulation if you are a maintainerDan McGee1-0/+4
This is a more expensive and not-yet-optimized way of doing this, but we can fix that later as needed. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Signoffs changes and improvementsDan McGee1-7/+9
* Better signoff report with more detail * Show signoff specification in signoffs view * Honor disabled/bad flags and display in approval column * Various other small bugfixes and tweaks Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-03Refactor more package signoff stuffDan McGee1-9/+125
This sets up some shared utility code for use in a later package signoff email report command. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-06Add get_current_signoffs utility methodDan McGee1-3/+28
This is another SQL-based utility method that dramatically cuts back on how many queries we run and gets around the shortcoming of arbitrary joins in Django. It will be used by the new signoff page logic. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05Simplify package differences codeDan McGee1-10/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15Refactor common select_related into manager methodDan McGee1-1/+1
For a Package object query, we almost always did .select_related('arch', 'repo). Refactor this into the manager as a 'normal()' method so we can avoid sprinkling the same logic everywhere. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-13Add package epoch supportDan McGee1-0/+2
This comes with pacman 3.5, replacing the old "force" PKGBUILD option. We parse it and store it for now, but don't display it anywhere just yet. Also update a few queries relying on version differences in any of the multiple parts. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-23Add stale package relations status screenDan McGee1-1/+23
For now it is read only. Display a few tables of various ways of detecting stale package relations. These include inactive users, pkgbase values that no longer exist, and users that are listed as maintainers that don't have the proper permissions for that package anymore. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-18Add arch-specific group overview pagesDan McGee1-4/+6
This is easy enough to refactor and support with our current infrastructure and group-fetching functions. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05Add some select_related() magicDan McGee1-1/+1
Made obvious when poking around with the Django debug toolbar. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08Implement package difference filteringDan McGee1-3/+29
This is done as client-side JS which makes the page nice and fast. Minor versions can be excluded, as can packages in [multilib]. In addition, architecture filtering is in place so you can limit the subset of shown packages to those in any, both, one or the other. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-28Move package utility functionsDan McGee1-0/+103
We now have a few of them, so move them to their own file like we do in the other applications. Signed-off-by: Dan McGee <dan@archlinux.org>