cat-in-136 / cargo-generate-rpm

Cargo helper command to generate a binary RPM package
MIT License
92 stars 19 forks source link

The `--set-metadata` option does not overwrite/set metadata anymore #118

Closed FritsHoogland closed 4 months ago

FritsHoogland commented 4 months ago

cargo generate-rpm version 0.15.1

Cargo.toml:

[package.metadata.generate-rpm]
assets = [
    { source = "target/release/procstat", dest = "/usr/local/bin/procstat", mode = "0755" },
]
release = "1.el8"

command:

cargo generate-rpm --set-metadata='release = '1.el9'"

Results :

target/generate-rpm/procstat-0.1.33-1.el8.aarch64.rpm

This works with version 0.14.1.

cat-in-136 commented 4 months ago

I have successfully reproduced.

FritsHoogland commented 4 months ago

I am using the version that gets installed with cargo install cargo-generate-rpm, which I assume is the release build. That version does not return an error when --set-metadata is used, but it doesn't apply the setting, so that in the example above, the setting of '1.el9' is discarded and the setting in the Cargo.toml file ('1.el8') is used. That is the error that I spotted, and tried raising here.

cat-in-136 commented 4 months ago

@FritsHoogland Thank you very much for clarification.

I have checked with various combinations. I found that --set-metadata (or -s) are not referenced when run as a cargo subcommand like cargo generate-rpm instead of cargo-generate-rpm. In addition, the debug build does not work at all in this condition. Anyway, both should be fixed and probably have the same cause.

build Cargo.toml release --set-metadata subcommand? Actual result Note
debug PASS Release=1
debug generate-rpm FAIL(panicked) "metadata_overwrite" is not an id of an argument or a group.
debug 1.el9 PASS Release=1.el9
debug 1.el9 generate-rpm FAIL(panicked) "metadata_overwrite" is not an id of an argument or a group.
debug 1.el8 PASS Release=1.el8
debug 1.el8 generate-rpm FAIL(panicked) "metadata_overwrite" is not an id of an argument or a group.
debug 1.el8 1.el9 PASS Release=1.el9
debug 1.el8 1.el9 generate-rpm FAIL(panicked) "metadata_overwrite" is not an id of an argument or a group.
release PASS Release=1
release generate-rpm PASS Release=1
release 1.el9 PASS Release=1.el9
release 1.el9 generate-rpm FAIL Release=1
release 1.el8 PASS Release=1.el8
release 1.el8 generate-rpm PASS Release=1.el8
release 1.el8 1.el9 PASS Release=1.el9
release 1.el8 1.el9 generate-rpm FAIL Release=1.el8
FritsHoogland commented 4 months ago

Currently, I have set cargo generate-rpm back to installing version 0.14.1 in my build pipelines, and that works okay.