stratis-storage / ci

To manage CI for various project repos.
0 stars 6 forks source link

Add a subcommand to create-archive.py to output the version of a package #474

Closed mulkieran closed 8 months ago

mulkieran commented 9 months ago

This is only for Packit.

Packit has an action, get-current-version, which requires a command to get the current version. This is easy enough with stratis-cli because we can use setup.cfg and python setup --version. It's a bit harder w/ stratisd, though, so we get the version from the spec file via rpmspec. This is no problem for us, because the command works and Packit doesn't make use of it the result in anything that matters to us. We have two ways of extracting the stratisd version from Rust source; one is to read the Cargo.toml file as a TOML file and get the key, the other is to use cargo-metadata and extract the version from the resulting JSON. Both of these ways are a bit much to put in a single shell command, and so we do not use them in our Packit configuration. If we added a subcommand, it would use the facilities already in create_archive to get the version for stratisd and also for stratis-cli and we would use that create_archive.py command in the packit configuration.

mulkieran commented 8 months ago

We satisfied this need by using cargo version-util: https://github.com/stratis-storage/stratisd/pull/3484 .