summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-04-23 21:57:59 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-04-23 21:57:59 -0400
commit55b776d58999412cd6bf0787a41d6ab00bf80fb6 (patch)
treee6c151ee22207465346b230f92a42d75576409d1 /packages
parent4578eb77da75c24f9b366c2ade46f55b0702b340 (diff)
parentac1c00ee86cc0e355af5e4e6be47ca861091356b (diff)
Merge branch 'archweb' into archweb-generic2
Diffstat (limited to 'packages')
-rw-r--r--packages/management/commands/populate_signoffs.py6
-rw-r--r--packages/models.py12
-rw-r--r--packages/utils.py7
3 files changed, 17 insertions, 8 deletions
diff --git a/packages/management/commands/populate_signoffs.py b/packages/management/commands/populate_signoffs.py
index 97ba4146..a9c1c81c 100644
--- a/packages/management/commands/populate_signoffs.py
+++ b/packages/management/commands/populate_signoffs.py
@@ -29,7 +29,8 @@ logging.basicConfig(
logger = logging.getLogger()
class Command(NoArgsCommand):
- help = "Pull the latest commit message from SVN for a given package that is signoff-eligible and does not have an existing comment attached"
+ help = """Pull the latest commit message from SVN for a given package that
+is signoff-eligible and does not have an existing comment attached"""
def handle_noargs(self, **options):
v = int(options.get('verbosity', None))
@@ -74,10 +75,11 @@ cached_svn_log.cache = {}
def create_specification(package, log, finder):
trimmed_message = log['message'].strip()
+ required = package.arch.required_signoffs
spec = SignoffSpecification(pkgbase=package.pkgbase,
pkgver=package.pkgver, pkgrel=package.pkgrel,
epoch=package.epoch, arch=package.arch, repo=package.repo,
- comments=trimmed_message)
+ comments=trimmed_message, required=required)
spec.user = finder.find_by_username(log['author'])
return spec
diff --git a/packages/models.py b/packages/models.py
index f830aade..6477d412 100644
--- a/packages/models.py
+++ b/packages/models.py
@@ -60,7 +60,8 @@ class SignoffSpecificationManager(models.Manager):
pkgbase=pkg.pkgbase, pkgver=pkg.pkgver, pkgrel=pkg.pkgrel,
epoch=pkg.epoch, arch=pkg.arch, repo=pkg.repo)
except SignoffSpecification.DoesNotExist:
- return DEFAULT_SIGNOFF_SPEC
+ return fake_signoff_spec(pkg.arch)
+
class SignoffSpecification(models.Model):
'''
@@ -97,10 +98,15 @@ class SignoffSpecification(models.Model):
return u'%s-%s' % (self.pkgbase, self.full_version)
-# fake default signoff spec when we don't have a persisted one in the database
+# Fake signoff specs for when we don't have persisted ones in the database.
+# These have all necessary attributes of the real thing but are lighter weight
+# and have no chance of being persisted.
FakeSignoffSpecification = namedtuple('FakeSignoffSpecification',
('required', 'enabled', 'known_bad', 'comments'))
-DEFAULT_SIGNOFF_SPEC = FakeSignoffSpecification(2, True, False, u'')
+
+
+def fake_signoff_spec(arch):
+ return FakeSignoffSpecification(arch.required_signoffs, True, False, u'')
class SignoffManager(models.Manager):
diff --git a/packages/utils.py b/packages/utils.py
index 4f3b8665..6ec39483 100644
--- a/packages/utils.py
+++ b/packages/utils.py
@@ -14,7 +14,7 @@ from main.utils import (database_vendor,
groupby_preserve_order, PackageStandin)
from .models import (PackageGroup, PackageRelation,
License, Depend, Conflict, Provision, Replacement,
- SignoffSpecification, Signoff, DEFAULT_SIGNOFF_SPEC)
+ SignoffSpecification, Signoff, fake_signoff_spec)
VERSION_RE = re.compile(r'^((\d+):)?(.+)-([^-]+)$')
@@ -297,7 +297,6 @@ class PackageSignoffGroup(object):
self.user = None
self.target_repo = None
self.signoffs = set()
- self.specification = DEFAULT_SIGNOFF_SPEC
self.default_spec = True
first = packages[0]
@@ -308,6 +307,7 @@ class PackageSignoffGroup(object):
self.last_update = first.last_update
self.packager = first.packager
self.maintainers = first.maintainers
+ self.specification = fake_signoff_spec(first.arch)
version = first.full_version
if all(version == pkg.full_version for pkg in packages):
@@ -410,7 +410,8 @@ def get_current_signoffs(repos):
def get_current_specifications(repos):
'''Returns a list of signoff specification objects for the given repos.'''
to_fetch = signoffs_id_query(SignoffSpecification, repos)
- return SignoffSpecification.objects.in_bulk(to_fetch).values()
+ return SignoffSpecification.objects.select_related('arch').in_bulk(
+ to_fetch).values()
def get_target_repo_map(repos):