Use required_signoffs value when creating signoff specs
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>
This commit is contained in:
parent
007b8d7573
commit
6fa6a8db07
@ -29,7 +29,8 @@
|
||||
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 @@ def cached_svn_log(pkgbase, repo):
|
||||
|
||||
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
|
||||
|
||||
|
@ -60,7 +60,8 @@ def get_or_default_from_package(self, pkg):
|
||||
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 @@ def __unicode__(self):
|
||||
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):
|
||||
|
@ -14,7 +14,7 @@
|
||||
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 @@ def __init__(self, packages):
|
||||
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 @@ def __init__(self, packages):
|
||||
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):
|
||||
|
@ -68,7 +68,7 @@ <h3>Filter Displayed Signoffs</h3>
|
||||
{% endif %}
|
||||
<td>{% include "packages/signoff_cell.html" %}</td>
|
||||
<td class="wrap note">{% if not group.default_spec %}{% with group.specification as spec %}{% comment %}
|
||||
{% endcomment %}{% if spec.required != 2 %}Required signoffs: {{ spec.required }}<br/>{% endif %}{% comment %}
|
||||
{% endcomment %}{% if spec.required != spec.arch.required_signoffs %}Required signoffs: {{ spec.required }}<br/>{% endif %}{% comment %}
|
||||
{% endcomment %}{% if not spec.enabled %}Signoffs are not currently enabled<br/>{% endif %}{% comment %}
|
||||
{% endcomment %}{% if spec.known_bad %}Package is known to be bad<br/>{% endif %}{% comment %}
|
||||
{% endcomment %}{{ spec.comments|default:""|linebreaksbr }}
|
||||
|
Loading…
Reference in New Issue
Block a user