add owner attribute to Builder classes

This commit is contained in:
Nils Philippsen
2016-10-04 12:35:09 +02:00
parent 300f947425
commit b94c460184
4 changed files with 14 additions and 9 deletions

View File

@@ -224,9 +224,10 @@ class GenericBuilder(six.with_metaclass(ABCMeta)):
class Builder(object):
"""Wrapper class"""
def __new__(cls, module, backend, config, **extra):
def __new__(cls, owner, module, backend, config, **extra):
"""
:param module : a module string e.g. 'testmodule-1.0'
:param owner: a string representing who kicked off the builds
:param module: a module string e.g. 'testmodule-1.0'
:param backend: a string representing backend e.g. 'koji'
:param config: instance of rida.config.Config
@@ -235,7 +236,8 @@ class Builder(object):
"""
if backend == "koji":
return KojiModuleBuilder(module=module, config=config, **extra)
return KojiModuleBuilder(owner=owner, module=module,
config=config, **extra)
else:
raise ValueError("Builder backend='%s' not recognized" % backend)
@@ -245,12 +247,14 @@ class KojiModuleBuilder(GenericBuilder):
backend = "koji"
def __init__(self, module, config, tag_name):
def __init__(self, owner, module, config, tag_name):
"""
:param owner: a string representing who kicked off the builds
:param module: string representing module
:param config: rida.config.Config instance
:param tag_name: name of tag for given module
"""
self.owner = owner
self.module_str = module
self.tag_name = tag_name
self.__prep = False

View File

@@ -70,8 +70,8 @@ def _finalize(config, session, msg, state):
# And install the macros.
module_name = parent.name
tag = parent.koji_tag
builder = rida.builder.Builder(module_name, 'koji', config,
tag_name=tag)
builder = rida.builder.Builder(parent.owner, module_name, 'koji',
config, tag_name=tag)
builder.buildroot_connect()
# tag && add to srpm-build group
nvr = "{}-{}-{}".format(msg.build_name, msg.build_version,

View File

@@ -118,7 +118,8 @@ def wait(config, session, msg):
log.debug("Assigning koji tag=%s to module build" % tag)
build.koji_tag = tag
builder = rida.builder.Builder(build.name, 'koji', config, tag_name=tag)
builder = rida.builder.Builder(build.owner, build.name, 'koji', config,
tag_name=tag)
build.buildroot_task_id = builder.buildroot_connect()
log.debug("Adding dependencies %s into buildroot for module %s" % (dependencies, module_info))
builder.buildroot_add_repos(dependencies)

View File

@@ -75,8 +75,8 @@ def done(config, session, msg):
log.warn("Odd! All components in batch failed for %r." % module_build)
return
builder = rida.builder.Builder(module_build.name, 'koji', config,
tag_name=tag)
builder = rida.builder.Builder(module_build.owner, module_build.name,
'koji', config, tag_name=tag)
builder.buildroot_connect()
# Ok, for the subset of builds that did complete successfully, check to