cat-in-136 / cargo-generate-rpm

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

Error raised on workspace inheritance of `package.edition` #47

Closed cat-in-136 closed 1 year ago

cat-in-136 commented 1 year ago

"value from workspace hasn't been set" error raised when workspace inheritance is used and its toml has package.edition.

https://github.com/cat-in-136/cargo-generate-rpm/issues/44#issuecomment-1350813869

@cat-in-136 Did some testing. When I use the workspace for the version / license it works fine. But adding the edition, will result in the above error. First gut feeling is that somethings is going wrong in the toml_edit lib, as the generate-rpm code is not using the edition field. That would suggest things go wrong on line 73: manifest.inherit_workspace(&workspace_manifest, p.as_ref())?;, some context to the errors would help.

It is caused by the cargo_toml bug https://gitlab.com/crates.rs/cargo_toml/-/issues/20

cat-in-136 commented 1 year ago

@Christiaan676 I wrote a workaround code referring to https://github.com/bnjbvr/cargo-machete/commit/096df04ce62330512598820994b9ab7148efd312 :

https://github.com/cat-in-136/cargo-generate-rpm/tree/cargo_toml_20_hack

Could you please confirm my cargo_toml_20_hack branch? If it is sufficient for your project, I would like to merge this change.

Christiaan676 commented 1 year ago

@cat-in-136 The fix works for me. Thanks for applying the workaround!