Merge branch 'master' into mead

This commit is contained in:
Mike McLean 2008-11-13 01:19:40 -05:00
commit d402a7d433
6 changed files with 41 additions and 13 deletions

View file

@ -1730,6 +1730,7 @@ class BuildTask(BaseTaskHandler):
'source' : src,
'task_id' : self.id,
'build_tag' : build_tag, #id
'skip_tag' : bool(self.opts.get('skip_tag')),
}
if target_info:
policy_data['target'] = target_info['id'],

View file

@ -691,10 +691,6 @@ def handle_build(options, session, args):
priority = 5
# try to check that source is an SRPM
if '://' not in source:
# only allow admins to perform non-scratch builds from srpm
if not opts.get('scratch') and not session.hasPerm('admin'):
parser.error(_("builds from srpm must use --scratch"))
assert False
#treat source as an srpm and upload it
print "Uploading srpm: %s" % source
serverdir = _unique_path('cli-build')

View file

@ -3,7 +3,7 @@
## Basic options ##
DBName = koji
DBUser = koji
DBHost = db.example.com
#DBHost = db.example.com
#DBPass = example_password
KojiDir = /mnt/koji
@ -37,10 +37,11 @@ LoginCreatesUser = On
KojiWebURL = http://kojiweb.example.com/koji
# The domain name that will be appended to Koji usernames
# when creating email notifications
#EmailDomain example.com
#EmailDomain = example.com
## Whether or not to report exception details for anticipated errors (i.e.
## koji's own exceptions -- subclasses of koji.GenericError).
## If KojiDebug is on, the hub will be /very/ verbose and will report exception
## details to clients for anticipated errors (i.e. koji's own exceptions --
## subclasses of koji.GenericError).
# KojiDebug = On
## Determines how much detail about exceptions is reported to the client (via faults)

View file

@ -4748,13 +4748,33 @@ class PackageTest(koji.policy.MatchTest):
class TagTest(koji.policy.MatchTest):
name = 'tag'
field = '_tagname'
def get_tag(self, data):
"""extract the tag to test against from the data
return None if there is no tag to test
"""
tag = data.get('tag')
if tag is None:
return None
return get_tag(tag, strict=False)
def run(self, data):
#we need to find the tag name from the base data
if not data['tag']:
tinfo = self.get_tag(data)
if tinfo is None:
return False
data[self.field] = get_tag(data['tag'])['name']
data[self.field] = tinfo['name']
return super(TagTest, self).run(data)
class FromTagTest(TagTest):
name = 'fromtag'
def get_tag(self, data):
tag = data.get('fromtag')
if tag is None:
return None
return get_tag(tag, strict=False)
class HasTagTest(koji.policy.BaseSimpleTest):
"""Check to see if build (currently) has a given tag"""
name = 'hastag'
@ -4769,6 +4789,15 @@ class HasTagTest(koji.policy.BaseSimpleTest):
#otherwise...
return False
class SkipTagTest(koji.policy.BaseSimpleTest):
"""Check for the skip_tag option
For policies regarding build tasks (e.g. build_from_srpm)
"""
name = 'skip_tag'
def run(self, data):
return bool(data.get('skip_tag'))
class BuildTagTest(koji.policy.BaseSimpleTest):
"""Check the build tag of the build
@ -4964,7 +4993,7 @@ def check_policy(name, data, default='deny', strict=False):
if not strict:
return False, reason
err_str = "policy violation"
if context.opts.get('KojiDebug', False):
if context.opts.get('KojiDebug') or context.opts.get('VerbosePolicy'):
err_str += " -- %s" % reason
raise koji.ActionNotAllowed, err_str

View file

@ -372,11 +372,12 @@ def load_config(req):
['EmailDomain', 'string', None],
['DisableNotifications', 'boolean', False],
['Plugins', 'string', None],
['Plugins', 'string', ''],
['PluginPath', 'string', '/usr/lib/koji-hub-plugins'],
['KojiDebug', 'boolean', False],
['KojiTraceback', 'string', None],
['VerbosePolicy', 'boolean', False],
['EnableFunctionDebug', 'boolean', False],
['MissingPolicyOK', 'boolean', True],

View file

@ -293,7 +293,7 @@ class SimpleRuleSet(object):
else:
line += ' :: '
ret.append(line)
ret = '\n... '.join(ret)
ret = '... '.join(ret)
if self.lastaction is None:
ret += "(no match)"
else: