Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support multi-module modules.yaml #288

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions build_stage_repository
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,21 @@ def create_modulemd(collection, version, stage_dir):
output = check_output(cmd, universal_newlines=True)

with open(modulemd_yaml(collection, version), 'r') as file:
modules = yaml.safe_load(file)
modules = list(yaml.safe_load_all(file))

module_version = generate_modulemd_version(version)
module_context = generate_modulemd_context(collection, version)

for module in modules:
module['data']['version'] = module_version
module['data']['context'] = module_context
if module['data']['name'] == collection:
module['data']['artifacts'] = {'rpms': output.splitlines()}
Comment on lines +108 to +111
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to set the version and context for all modules in the file, but artifacts only for the one that is actually our "main" module


modules['data']['artifacts'] = {'rpms': output.splitlines()}
modules['data']['version'] = generate_modulemd_version(version)
modules['data']['context'] = generate_modulemd_context(collection, version)
modules_yaml = os.path.join(stage_dir, 'repodata', 'modules.yaml')

with open(modules_yaml, 'w') as modules_file:
yaml.dump(modules, modules_file, default_flow_style=False, explicit_start=True, explicit_end=True)
yaml.dump_all(modules, modules_file, default_flow_style=False, explicit_start=True, explicit_end=True)

check_output(['modifyrepo_c', '--mdtype=modules', modules_yaml, f"{stage_dir}/repodata"])

Expand Down