handle default_ref recursively for module components

This commit is contained in:
Mike McLean
2022-11-21 15:17:30 -05:00
parent 9287297943
commit a014f20f15

View File

@@ -247,7 +247,7 @@ def _scm_get_latest(data):
return {"pkg_name": data.rpm_component.get_name(), "pkg_ref": pkgref, "error": None}
def format_mmd(mmd, scmurl, module=None, db_session=None, srpm_overrides=None):
def format_mmd(mmd, scmurl, module=None, db_session=None, srpm_overrides=None, default_ref=None):
"""
Prepares the modulemd for the MBS. This does things such as replacing the
branches of components with commit hashes and adding metadata in the xmd
@@ -281,7 +281,8 @@ def format_mmd(mmd, scmurl, module=None, db_session=None, srpm_overrides=None):
xmd["mbs"]["commit"] = full_scm_hash
default_ref = xmd["mbs"].get("branch") or conf.default_branch
if default_ref is None:
default_ref = xmd["mbs"].get("branch") or conf.default_branch
if mmd.get_rpm_component_names() or mmd.get_module_component_names():
if "rpms" not in xmd["mbs"]:
@@ -510,6 +511,8 @@ def record_component_builds(
# planned for batch 2 and following.
batch = initial_batch
default_ref = mmd.get_xmd()["mbs"].get("branch")
for component in all_components:
# Increment the batch number when buildorder increases.
if previous_buildorder != component.get_buildorder():
@@ -525,7 +528,7 @@ def record_component_builds(
# It is OK to whitelist all URLs here, because the validity
# of every URL have been already checked in format_mmd(...).
included_mmd = fetch_mmd(full_url, whitelist_url=True)[0]
format_mmd(included_mmd, module.scmurl, module, db_session, srpm_overrides)
format_mmd(included_mmd, module.scmurl, module, db_session, srpm_overrides, default_ref)
batch = record_component_builds(
included_mmd, module, batch, previous_buildorder, main_mmd)
continue