summaryrefslogtreecommitdiff
path: root/packages/utils.py
AgeCommit message (Collapse)Author
2014-01-25Add 'Latest Update' column to stale package relationsDan McGee
This helps when doing the irregular cleanup of these things and making sure a relation has been stale for some time and not just a couple minutes or hours. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-23When retrieving signoff specs, select the arch object as wellrelease_2013-04-27Dan McGee
Otherwise we do one query per row in the signoff table to fetch the architecture and it's required_signoffs value, which is less than ideal. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-22Use required_signoffs value when creating signoff specsDan McGee
And respect it elsewhere when we create a fake default specification because a real one does not exist yet. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16Various minor code cleanups and fixesrelease_2013-04-16Dan McGee
Most of these were suggested by PyCharm, and include everything from little syntax issues and other bad smells to dead or bad code. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-03-11Remove function caching in packages/utilsDan McGee
We don't see these called enough to make caching the data worth it. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-10Fix split packages sitemaprelease_2013-02-16Dan McGee
We had a ton of duplicate entries included due to the query implicitly including a 'GROUP BY' clause on the default sorting by pkgname. Fix it and cut the sitemap down to the correct size without duplicate entries. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-22Use a subquery rather than two queries in attach_maintainersDan McGee
Now that we are using a database that doesn't stink, it makes more sense to do all of the stuff we need to do down at the database level. This helps a lot when 500+ packages are in play at a given time, such as some of our larger rebuild todo lists. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-18Use a set instead of list when gathering package differencesDan McGee
If we implement the __eq__ and __hash__ methods, we can use a set to gather package difference objects and make deduplication of objects a lot more efficient. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28Make attach_maintainers null-safeDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16Use python set comprehension syntax supported in 2.7Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16Use Python 2.7 dictionary comprehension syntaxDan McGee
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 McGee
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 McGee
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 McGee
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-08PEP8 cleanups in package utilsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-08Extract parse_version function from reporead logicDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-08Get multilib package differences query working on sqlite3Dan McGee
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-08Use a set instead of list when gathering package IDs to fetchDan McGee
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-18Switch to usage of new Depend objectDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-02Ensure order_by default value is cleared when using distinct()Dan McGee
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 McGee
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 McGee
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-11PyLint suggested cleanupsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-08Multilib differences reportDan McGee
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 sitemaprelease_2011-11-11Dan McGee
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 McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-04Rewrite get_target_repo_map() using raw SQLDan McGee
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 McGee
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 McGee
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-03Make maintainer lookup on todo lists fastDan McGee
This is rather sick to look at. Sorry, Django gives me no other choice. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-03Add new attach_maintainers() utility methodDan McGee
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-03Minor signoff query tweaks/optimizationsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-03Allow signoff manipulation if you are a maintainerDan McGee
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-03Signoffs changes and improvementsDan McGee
* 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 McGee
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 McGee
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 McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15Refactor common select_related into manager methodDan McGee
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 McGee
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 McGee
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 McGee
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-04Add some select_related() magicDan McGee
Made obvious when poking around with the Django debug toolbar. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08Implement package difference filteringDan McGee
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 McGee
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>