Fix the buildroot_connect calls in repos and models and set 'system' to 'mock' when invoked from manage.py using build_module_locally

This commit is contained in:
Jan Kaluza
2016-11-22 10:54:38 +01:00
parent 88e6ddf953
commit c719e1d0c1
3 changed files with 28 additions and 2 deletions

View File

@@ -108,6 +108,7 @@ def cleardb():
@manager.command
def build_module_locally(url):
conf.set_item("system", "mock")
username = getpass.getuser()
cleardb()

View File

@@ -79,7 +79,20 @@ def _finalize(config, session, msg, state):
tag = parent.koji_tag
builder = module_build_service.builder.GenericBuilder.create(
parent.owner, module_name, config.system, config, tag_name=tag)
builder.buildroot_connect()
try:
groups = {
'build': parent.resolve_profiles(session, 'buildroot'),
'srpm-build': parent.resolve_profiles(session, 'srpm-buildroot'),
}
except ValueError:
reason = "Failed to gather buildroot groups from SCM."
log.exception(reason)
parent.transition(config, state="failed", state_reason=reason)
session.commit()
raise
builder.buildroot_connect(groups)
# tag && add to srpm-build group
nvr = "{}-{}-{}".format(msg.build_name, msg.build_version,
msg.build_release)

View File

@@ -79,10 +79,22 @@ def done(config, session, msg):
log.warn("Odd! All components in batch failed for %r." % module_build)
return
try:
groups = {
'build': module_build.resolve_profiles(session, 'buildroot'),
'srpm-build': module_build.resolve_profiles(session, 'srpm-buildroot'),
}
except ValueError:
reason = "Failed to gather buildroot groups from SCM."
log.exception(reason)
module_build.transition(config, state="failed", state_reason=reason)
session.commit()
raise
builder = module_build_service.builder.GenericBuilder.create(
module_build.owner, module_build.name, config.system, config,
tag_name=tag)
builder.buildroot_connect()
builder.buildroot_connect(groups)
# Ok, for the subset of builds that did complete successfully, check to
# see if they are in the buildroot.