Are RPM configuration files supported? #41

Open
opened 2026-01-29 16:27:55 +00:00 by claunia · 3 comments
Owner

Originally created by @daniel-sherwood on GitHub (Sep 6, 2018).

I notice that config files are always replaced when installing a new package version even in Update is used instead of Include. Looking at the code I can see that RPMFILE_CONFIG and RPMFILE_NOREPLACE are defined in IndexTag but don't appear to be used anywhere.

I'd be interested in implementing this if you could give me a pointer.

Originally created by @daniel-sherwood on GitHub (Sep 6, 2018). I notice that config files are always replaced when installing a new package version even in Update is used instead of Include. Looking at the code I can see that RPMFILE_CONFIG and RPMFILE_NOREPLACE are defined in IndexTag but don't appear to be used anywhere. I'd be interested in implementing this if you could give me a pointer.
Author
Owner

@qmfrederik commented on GitHub (Sep 6, 2018):

You are right, at the moment there's a fairly straightforward system which marks all files in /usr/share/doc as RPMFILE_DOC, and everything else as None.

Like you suggest, we can classify files as RPMFILE_NOREPLACE to avoid configuration files being overwritten in upgrades. https://docs.fedoraproject.org/ro/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s05s03.html describes it in a bit more detail.

There are a couple of things we need to figure out:

  1. Is this a RPM-only feature or is it something other package formats support as well? For example, it looks like Debian has support for configuration files as well
  2. How do we want users to communicate that files should be marked with RPMFILE_NOREPLACE? @clemensv did something similar in #64 for documentation files (see cfc1ea5a9c). We could do something along the the lines of:
<Content Include="cliscd.machine.config" CopyToPublishDirectory="PreserveNewest">
  <LinuxPath>/etc/quamotion/cliscd.machine.config</LinuxPath>
  <Configuration>true</Configuration>
</Content>

So one way to go at this would be

  1. Update the ArchiveBuilder to configure the ArchiveEntry.Type to Configuration
  2. Update the Rpm/FileAnalyzer.cs to return the correct RpmFileFlags
  3. Update the Deb/DebPackageCreator.cs to include a WriteControlEntry command for conffiles

I would really appreciate it if we can also get unit tests for this. Something along the lines of updating the Dockerfile for the various Linux distro's so that we do an install, change the config file, then upgrade and make sure the changes in the config file have been preserved.

Makes sense?

@qmfrederik commented on GitHub (Sep 6, 2018): You are right, at the moment there's a fairly straightforward system which marks all files in `/usr/share/doc` as `RPMFILE_DOC`, and everything else as `None`. Like you suggest, we can classify files as `RPMFILE_NOREPLACE` to avoid configuration files being overwritten in upgrades. https://docs.fedoraproject.org/ro/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s05s03.html describes it in a bit more detail. There are a couple of things we need to figure out: 1. Is this a RPM-only feature or is it something other package formats support as well? For example, it looks like [Debian has support for configuration files as well](https://www.debian.org/doc/debian-policy/ap-pkg-conffiles.html) 1. How do we want users to communicate that files should be marked with RPMFILE_NOREPLACE? @clemensv did something similar in #64 for documentation files (see https://github.com/qmfrederik/dotnet-packaging/pull/64/commits/cfc1ea5a9c3e5da33906787d0c68af1d354b0a43). We could do something along the the lines of: ```xml <Content Include="cliscd.machine.config" CopyToPublishDirectory="PreserveNewest"> <LinuxPath>/etc/quamotion/cliscd.machine.config</LinuxPath> <Configuration>true</Configuration> </Content> ``` So one way to go at this would be 1. Update the `ArchiveBuilder` to configure the `ArchiveEntry.Type` to `Configuration` 2. Update the `Rpm/FileAnalyzer.cs` to return the correct `RpmFileFlags` 3. Update the `Deb/DebPackageCreator.cs` to include a `WriteControlEntry` command for `conffiles` I would really appreciate it if we can also get unit tests for this. Something along the lines of updating the Dockerfile for the various Linux distro's so that we do an install, change the config file, then upgrade and make sure the changes in the config file have been preserved. Makes sense?
Author
Owner

@yamaritta commented on GitHub (Jan 31, 2020):

@daniel-sherwood How did you dealt with it?

@yamaritta commented on GitHub (Jan 31, 2020): @daniel-sherwood How did you dealt with it?
Author
Owner

@DustyRah commented on GitHub (Feb 18, 2025):

Was the tag implemented? I am trying to avoid the configuration file (appsettings.json) from getting overwritten.

@DustyRah commented on GitHub (Feb 18, 2025): Was the <Configuration> tag implemented? I am trying to avoid the configuration file (appsettings.json) from getting overwritten.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dotnet-packaging#41