mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-07-10 05:46:18 +08:00
Find compatible base modules based on the virtual streams.
Before this commit, the compatible base modules for Module Stream Expansion have been found without any limitation, just based on the stream version. It was therefore possible that `platform:lp29.0.0` was found as compatible module for `platform:f29.1.0` although those platform streams are not compatible at all. In this commit, the module can be treated as compatible only if it has the same virtual stream as the input module. The idea behind this is that both `platform:f29.0.0` and `platform:f29.1.0` should include the `virtual_streams: [f29]` in their XMD section which tells MBS that they are actually compatible. The `lp29` stream will not have the same virtual stream (most likely it won't have any virtual stream at all). The `virtual_streams` is already used for this use-case in `MMDResolver`, but it was not used to limit the inputs to `MMDResolver` which is what this commit is doing. This commit also fixes the issue in `get_last_builds_in_stream_version_lte` which was simply broken if multiple stream_versions of single base module existed and their builds had different version. In this case, only builds with single (randomly chosen) version were returned.
This commit is contained in:
@@ -126,7 +126,14 @@ def init_data(data_size=10, contexts=False, multiple_stream_versions=False, scra
|
||||
for stream in ["f28.0.0", "f29.0.0", "f29.1.0", "f29.2.0"]:
|
||||
mmd.set_name("platform")
|
||||
mmd.set_stream(stream)
|
||||
|
||||
# Set the virtual_streams based on "fXY" to mark the platform streams
|
||||
# with the same major stream_version compatible.
|
||||
xmd = glib.from_variant_dict(mmd.get_xmd())
|
||||
xmd['mbs']['virtual_streams'] = [stream[:3]]
|
||||
mmd.set_xmd(glib.dict_values(xmd))
|
||||
import_mmd(db.session, mmd)
|
||||
|
||||
# Just to possibly confuse tests by adding another base module.
|
||||
mmd.set_name("bootstrap")
|
||||
mmd.set_stream(stream)
|
||||
@@ -724,7 +731,7 @@ def reuse_shared_userspace_init_data():
|
||||
|
||||
|
||||
def make_module(nsvc, requires_list=None, build_requires_list=None, base_module=None,
|
||||
filtered_rpms=None, xmd=None, store_to_db=True):
|
||||
filtered_rpms=None, xmd=None, store_to_db=True, virtual_streams=None):
|
||||
"""
|
||||
Creates new models.ModuleBuild defined by `nsvc` string with requires
|
||||
and buildrequires set according to ``requires_list`` and ``build_requires_list``.
|
||||
@@ -742,6 +749,7 @@ def make_module(nsvc, requires_list=None, build_requires_list=None, base_module=
|
||||
default key/value pairs are added if not present.
|
||||
:param bool store_to_db: whether to store created module metadata to the
|
||||
database.
|
||||
:param list virtual_streams: List of virtual streams provided by this module.
|
||||
:return: New Module Build if set to store module metadata to database,
|
||||
otherwise the module metadata is returned.
|
||||
:rtype: ModuleBuild or Modulemd.Module
|
||||
@@ -795,6 +803,9 @@ def make_module(nsvc, requires_list=None, build_requires_list=None, base_module=
|
||||
if 'mse' not in xmd_mbs:
|
||||
xmd_mbs['mse'] = 'true'
|
||||
|
||||
if virtual_streams:
|
||||
xmd_mbs['virtual_streams'] = virtual_streams
|
||||
|
||||
mmd.set_xmd(glib.dict_values(xmd))
|
||||
|
||||
if not store_to_db:
|
||||
|
||||
Reference in New Issue
Block a user