diff --git a/builder/kojid b/builder/kojid index 979f4876..d93001f0 100755 --- a/builder/kojid +++ b/builder/kojid @@ -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'], diff --git a/cli/koji b/cli/koji index bc13d932..4fca826c 100755 --- a/cli/koji +++ b/cli/koji @@ -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') diff --git a/hub/hub.conf b/hub/hub.conf index a1ddb3a4..4b5d81cf 100644 --- a/hub/hub.conf +++ b/hub/hub.conf @@ -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) diff --git a/hub/kojihub.py b/hub/kojihub.py index 0d78d464..a52b11be 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -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 diff --git a/hub/kojixmlrpc.py b/hub/kojixmlrpc.py index 5d7105aa..1bc6c614 100644 --- a/hub/kojixmlrpc.py +++ b/hub/kojixmlrpc.py @@ -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], diff --git a/koji/policy.py b/koji/policy.py index d05bbfb6..e1ac22c0 100644 --- a/koji/policy.py +++ b/koji/policy.py @@ -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: