diff options
author | Dan McGee <dan@archlinux.org> | 2011-11-03 20:39:59 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-11-03 20:39:59 -0500 |
commit | 5f2c3bf98baabf919681525e600639643aa2c119 (patch) | |
tree | 8738ae151d89319c2270a34ffefcfedc758bbd6b /packages/utils.py | |
parent | 8187b87143081a2be75032db91287f9deb9d1f89 (diff) |
Signoffs changes and improvements
* 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>
Diffstat (limited to 'packages/utils.py')
-rw-r--r-- | packages/utils.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/packages/utils.py b/packages/utils.py index 42cfbe0f..60b95e21 100644 --- a/packages/utils.py +++ b/packages/utils.py @@ -5,7 +5,8 @@ from django.db.models import Count, Max from main.models import Package, Repo from main.utils import cache_function, groupby_preserve_order, PackageStandin -from .models import PackageGroup, PackageRelation, SignoffSpecification, Signoff +from .models import (PackageGroup, PackageRelation, + SignoffSpecification, Signoff, DEFAULT_SIGNOFF_SPEC) @cache_function(300) def get_group_info(include_arches=None): @@ -148,9 +149,7 @@ SELECT DISTINCT id return relations -DEFAULT_SIGNOFF_SPEC = SignoffSpecification() - -def approved_by_signoffs(signoffs, spec=DEFAULT_SIGNOFF_SPEC): +def approved_by_signoffs(signoffs, spec): if signoffs: good_signoffs = sum(1 for s in signoffs if not s.revoked) return good_signoffs >= spec.required @@ -158,14 +157,13 @@ def approved_by_signoffs(signoffs, spec=DEFAULT_SIGNOFF_SPEC): class PackageSignoffGroup(object): '''Encompasses all packages in testing with the same pkgbase.''' - def __init__(self, packages, user=None): + def __init__(self, packages): if len(packages) == 0: raise Exception self.packages = packages - self.user = user + self.user = None self.target_repo = None self.signoffs = set() - self.specification = DEFAULT_SIGNOFF_SPEC first = packages[0] self.pkgbase = first.pkgbase @@ -175,6 +173,10 @@ class PackageSignoffGroup(object): self.last_update = first.last_update self.packager = first.packager + self.specification = \ + SignoffSpecification.objects.get_or_default_from_package(first) + self.default_spec = self.specification is DEFAULT_SIGNOFF_SPEC + version = first.full_version if all(version == pkg.full_version for pkg in packages): self.version = version |