Fixed scratch build suffix bug

When building a scratch build of a module with static context
the scratch suffix was added twice.

Signed-off-by: Martin Curlej <mcurlej@redhat.com>
This commit is contained in:
Martin Curlej
2021-06-04 15:04:37 +02:00
committed by Mike McLean
parent 5cdb2127fe
commit 71a44bdfb6
2 changed files with 90 additions and 7 deletions

View File

@@ -707,11 +707,13 @@ def submit_module_build(db_session, username, stream_or_packager, params, module
module.build_context, module.runtime_context, module.context, \
module.build_context_no_bms = module.contexts_from_mmd(module.modulemd)
xmd = mmd.get_xmd()
if xmd["mbs"].get("static_context"):
if static_context:
# if the static_context is True we use the context from defined in the mmd
# and discard the computed one.
module.context = mmd.get_context()
module.context += context_suffix
else:
# if the context is defined by MSE, we need to add a context_suffix if it exists.
module.context += context_suffix
if not conf.allow_dashes_in_svc:
if '-' in module.stream:
@@ -786,10 +788,15 @@ def process_module_context_configuration(stream_or_packager):
return streams, static_context
else:
xmd = stream_or_packager.get_xmd()
# check if we are handling rebuild of a static context module
# check if the static format is defined through `static_context` field
if stream_or_packager.is_static_context():
static_context = True
return [stream_or_packager], static_context
# check if we are handling rebuild of a static context module defined in xmd
if "mbs" in xmd:
# check if it is a static context
if "static_context" in xmd["mbs"] or stream_or_packager.is_static_context():
if "static_context" in xmd["mbs"]:
static_context = True
return [stream_or_packager], static_context