This tool adds a new context configuration to a modulemd-packager YAML file. The file defines how to build a module.
The tool loads a FILE, locates all context configurations with a plaform equivalent to the --old argument, duplicates the configurations under new context identifiers, and replaces there the platforms with a new one specified in --new argument. If a context for the new platform already exists, the file will be kept unchanged.
As the new context identifier is used the new platform value. If such context already exists, a new, unique, small decimal number (e.g. "0", "1") will be used.
This tool aims to preserve a physical representation of the YAML files. That includes white spaces, comments, and quoting styles. Also all fields of the configuration, like buildrequires, or buildopts will be preserved.
Finally, the the new content is validated and if no damage is detected, the content is saved back to the FILE. Users are advised to check the changes before commiting to them.
- --old PLATFORM
Use context configurations of this old PLATFORM as a template for addition. This option is mandatory.
- --new PLATFORM
Set this PLATFORM in the new configurations. This option is mandatory.
If specified, the files without a context configuration for the old platform and files of modulemd-v2 format will be ignored. Otherwise, an error is reported.
The edited document will be printed to a standard output instead of rewriting the FILE in place.
Print various debugging messages about parsing and editing the YAML files to an error output.
- -h, --help
Show a usage text and exit without processing any files.
Let's have a file /tmp/test.yaml:
document: modulemd-packager version: 3 data: configurations: - context: 'A' platform: f34
Adding a configuration for platform:f35 can be achieved with modulemd-add-platform --old f34 --new f35 /tmp/test.yaml command. The resulting file will be:
document: modulemd-packager version: 3 data: configurations: - context: 'A' platform: f34 - context: 'f35' platform: f35
Return a zero exit code if the FILE was successfully edited or the FILE already contained the new platform.
Return non-zero exit code if an error occurred.
If the input FILE does not contain a context for the old platform, or if the file is modulemd-v2 document, which does not use context configurations, the behaviour depends on a use of --skip option. If it isn't used, a non-zero code will be returned. Otherwise, zero code will be returned.
Bugs and feature requests can be reported at the modulemd-tools home page.
Specification of the modulemd-packager documents is available among a documentation for libmodulemd package or in yaml_spec directory at the libmodulemd home page.