cat-in-136/cargo-generate-rpm

Feature Request: allow not replacing config files

Closed this issue · 5 comments

would be cool if there was a way to specify %config(noreplace) so that configuration files will not be automatically be replaced (and renamed .rpmsave) during updates by default.

mark rpm-crate-issue because %config(noreplace) feature is missing in the current rpm-rs.

it looks like https://github.com/Richterrettich/rpm-rs was abandoned and the project is now continued here: https://github.com/rpm-rs/rpm

this commit implements the %config(noreplace) if i interpret this correctly:
rpm-rs/rpm@66bffe0

@fraxinas thank you for finding out the parameter in rpm-rs!

It has been a long time, today I checked the rpm crate implementation.

To my surprise, %config(missingok) has not introduced to rpm::FileOptionsBuilder. Since %config(noreplace) and %config(missingok) have been treated as two contrasting options in the context of writing rpm spec, I would like to support both of them in same PR.

corresponding rpm spec cargo-generate-rpm rpm flags
%config config = true rpm::FileFlags::CONFIG
%config(missingok) n/a (config = "missingok" ?) rpm::FileFlags::MISSINGOK
%config(noreplace) n/a (config = "noreplace" ?) rpm::FileFlags::NOREPLACE

The specification needs to take three variation %config (no additional flag), %config(noreplace), and %config(missingok) into account.
config(missingok) is currently not configurable with rpm::FileOptionsBuilder, so I've filed rpm-rs/rpm#219.