Add conflicts in module-build-macros for NEVRAs found in handle_collisions_with_base_module_rpms

PR #1331 made the assumption that the Ursa Major ursine RPMs were at
xmd["mbs"]["ursine_rpms"], but they are actually at
xmd["mbs"]["buildrequires"]["platform"]["ursine_rpms"]. This commit
handles the ursine RPMs generated by handle_collisions_with_base_module_rpms
separately since the base module the RPMs came from are not tracked in
that function.
This commit is contained in:
mprahl
2019-09-18 16:14:40 -04:00
parent e2939c80a1
commit 749f186524
5 changed files with 26 additions and 19 deletions

View File

@@ -359,6 +359,18 @@ class KojiModuleBuilder(GenericBuilder):
)
)
# These are generated from handle_collisions_with_base_module_rpms and are different than
# the stream collision modules
ursine_rpms = mmd.get_xmd()["mbs"].get("ursine_rpms")
if ursine_rpms:
log.debug("Adding %d ursine RPM(s) to the conflicts", len(ursine_rpms))
filter_conflicts.append(
"\n# Filter out base module RPMs that overlap with the RPMs in the buildrequired "
"modules"
)
for ursine_rpm in ursine_rpms:
filter_conflicts.append(KojiModuleBuilder.format_conflicts_line(ursine_rpm))
spec_content = textwrap.dedent("""
%global dist {disttag}
%global modularitylabel {module_name}:{module_stream}:{module_version}:{module_context}

View File

@@ -264,14 +264,9 @@ def handle_collisions_with_base_module_rpms(mmd, arches):
if rpm_name in name_to_nevras:
conflicts = conflicts | name_to_nevras[rpm_name]
if not conflicts:
return
# Append the conflicting NEVRAs to `ursine_rpms`, so the Conflicts are later generated for them
# Add the conflicting NEVRAs to `ursine_rpms` so the Conflicts are later generated for them
# in the KojiModuleBuilder.
if not xmd["mbs"].get("ursine_rpms"):
xmd["mbs"]["ursine_rpms"] = []
xmd["mbs"]["ursine_rpms"] = list(set(xmd["mbs"]["ursine_rpms"]).union(conflicts))
xmd["mbs"]["ursine_rpms"] = list(conflicts)
mmd.set_xmd(xmd)

View File

@@ -187,9 +187,9 @@ def init(config, db_session, msg):
if conf.system in ["koji", "test"] and not defaults_added:
handle_stream_collision_modules(db_session, mmd)
# Extends the xmd["mbs"]["ursine_rpms"] with RPMs from base module which conflict
# with the RPMs from module. We need to prefer modular RPMs over base module RPMs
# even if their NVR is lower.
# Sets xmd["mbs"]["ursine_rpms"] with RPMs from the buildrequired base modules which
# conflict with the RPMs from other buildrequired modules. This is done to prefer modular
# RPMs over base module RPMs even if their NVR is lower.
handle_collisions_with_base_module_rpms(mmd, arches)
mmd = record_filtered_rpms(db_session, mmd)