MODULEMD-ADD-PLATFORM(1)

πŸ“¦ version 0.16, in epel 10, fedora 43, fedora 44

πŸ’– MODULEMD-ADD-PLATFORM πŸ’–

okay bestie, so this is a User Command, section 1 of the manual, and it's literally called modulemd-add-platform. It's a lil tool from the modulemd-tools fam and it's here to help you ✨manifest✨ a whole new platform into your module build config. Let's get into it 🫢


✨ NAME ✨

modulemd-add-platform β€” adds a context for a new platform to a modulemd-packager document. yes queen, that's the whole job πŸ’…


🌸 SYNOPSIS 🌸

modulemd-add-platform [--debug] --old PLATFORM --new PLATFORM [--stdout]
                      [--skip] FILE
modulemd-add-platform {-h|--help}

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: this tool adds a new context configuration to a modulemd-packager YAML file. And that file? It's the one that defines how to build a module. main character document energy, no cap πŸ‘‘

What it actually does, step by step, fr fr:

  • It loads a FILE.
  • It hunts down all the context configurations whose platform is equivalent to whatever you passed to --old.
  • It duplicates those configurations under new context identifiers.
  • Then it swaps the platforms in them out for the new one you gave it in --new.

And if a context for the new platform is already sitting there? The file stays exactly as it was. untouched. we're not touching it. πŸ™ˆ

About that new context identifier β€” the tool uses the new platform value as the identifier. But if a context with that name already exists, it'll go with a new, unique, small decimal number instead, like "0", "1". cute, tiny, numbered. iconic honestly πŸŽ€

Now, the part that's lowkey the most thoughtful: this tool aims to preserve a physical representation of the YAML files. That means:

  • white spaces 🫧
  • comments πŸ’¬
  • quoting styles ✨

all preserved. And not just the vibes β€” all fields of the configuration get preserved too, like buildrequires, or buildopts. nothing gets dropped, periodt.

Finally, the new content gets validated, and if no damage is detected, the content is saved back to the FILE.

⚠️ Bestie, please β€” users are advised to check the changes before committing to them. Read your diff. It's giving responsible. πŸ’–

πŸ’… OPTIONS πŸ’…

  • --old PLATFORM β€” Use the context configurations of this old PLATFORM as a template for the addition. This one is mandatory, so no skipping it, babe.
  • --new PLATFORM β€” Set this PLATFORM in the new configurations. Also mandatory. Two mandatory options, we love a firm boundary.
  • --skip β€” If you specify this, then files without a context configuration for the old platform, and files in the modulemd-v2 format, will just be ignored. If you don't use it, you get an error reported instead. choose your fighter πŸ₯Š
  • --stdout β€” The edited document gets printed to standard output instead of rewriting the FILE in place. for the girlies who like to preview before they commit 😌
  • --debug β€” Prints various debugging messages about parsing and editing the YAML files to an error output. yap mode: activated πŸ”₯
  • -h, --help β€” Shows a usage text and exits without processing any files. the classic escape hatch 🧚

🌈 EXAMPLE 🌈

Let's say you have a file at /tmp/test.yaml that looks like this:

document: modulemd-packager
version: 3
data:
    configurations:
    - context: 'A'
      platform: f34

Now you wanna add a configuration for platform:f35. You do it with this command:

modulemd-add-platform --old f34 --new f35 /tmp/test.yaml

And boom, the resulting file will be:

document: modulemd-packager
version: 3
data:
    configurations:
    - context: 'A'
      platform: f34
    - context: 'f35'
      platform: f35

look at that. a whole new context. we ate and left no crumbs πŸ“


⭐ EXIT CODE ⭐

  • Returns a zero exit code if the FILE was successfully edited, or if the FILE already contained the new platform. slay βœ…
  • Returns a non-zero exit code if an error occurred. πŸ’€

And here's the spicy bit: if the input FILE does not contain a context for the old platform, or if the file is a modulemd-v2 document (which doesn't use context configurations at all), then the behaviour depends on whether you used the --skip option.

  • If --skip isn't used β†’ a non-zero code will be returned.
  • If --skip is used β†’ zero code will be returned.
so basically --skip is your "it's fine, we move on" button 🫢

πŸ› REPORTING BUGS πŸ›

Found a bug? Got a feature request? Don't suffer in silence, bestie β€” bugs and feature requests can be reported at the modulemd-tools home page. they want to hear from you fr fr πŸ’œ


πŸ‘€ SEE ALSO πŸ‘€

The specification of the modulemd-packager documents is available among the documentation for the libmodulemd package, or in the yaml_spec directory at the libmodulemd home page. go read it, iykyk πŸ“šβœ¨


okay that's the whole page!! mwah πŸ’– this came from modulemd-tools, and yeah, it's the MODULEMD-ADD-PLATFORM(1) manual page β€” you're welcome, go add some platforms and stay hydrated πŸ§šβ€β™€οΈπŸŒΈ

πŸ“¦ where this page comes from