In Fedora 21, I created a set of packaging guidelines for per-product default configuration. This approach was flawed - it relied on esoteric internal details about how the yum depsolver worked and also caused issues on post-install systems with being unable to install other yum environment groups.
In Fedora 22, I've now worked out a much more robust and less fragile approach to per-product configuration. I've produced a draft of replacement rules here: https://fedoraproject.org/wiki/User:Sgallagh/Per-Product_Configuration_Packaging_Draft
In the new approach, we rely on recently-added behavior of the fedora-release package, where we will now provide a VARIANT field to /etc/os-release during package installation. Packages that need per-product configuration should check for this value in their {{{%posttrans}}} phase and use that to determine which configuration to use.
The firewalld package has already been converted to use this approach, but I would like to get the draft updated so that other packages can take advantage of this where sensible.
As discussed at the meeting, I've submitted a patch for redhat-rpm-config to include a {{{%{_variant}}}} macro.
See https://bugzilla.redhat.com/show_bug.cgi?id=1208689
I discussed this some more today with tibbs and we realized that a macro isn't the right approach because those get resolved at build-time, not script-execution time. Jason observed that /etc/os-release is importable into Bourne-compatible shells (like RPM uses), so I changed the draft to do {{{ . /etc/os-release }}} rather than use the ugly awk syntax.
I also updated the draft to include the missing mentions of the {{{%ghost}}} config files and removed the unnecessary escaping of the ! operator (after testing that it was unneeded).
See the changes [https://fedoraproject.org/w/index.php?title=User%3ASgallagh%2FPer-Product_Configuration_Packaging_Draft&diff=410319&oldid=408840 here]. I believe that this should be the final revision.
We discussed this at this weeks meeting (http://meetbot.fedoraproject.org/fedora-meeting-1/2015-04-23/fpc.2015-04-23-16.00.txt):
Written up. Announcement text:
The guidelines for providing per-product configuration defaults have been rewritten to be much more robust. * https://fedoraproject.org/wiki/Packaging:Per-Product_Configuration * https://fedoraproject.org/w/index.php?title=Packaging%3APer-Product_Configuration&diff=410805&oldid=384093 * https://fedorahosted.org/fpc/ticket/520
Just a heads-up: we're going to need one more minor [https://fedoraproject.org/w/index.php?title=User%3ASgallagh%2FPer-Product_Configuration_Packaging_Draft&diff=411881&oldid=410792 change]:
The systemd upstream project has accepted VARIANT as a cross-distribution feature, but with a minor [http://lists.freedesktop.org/archives/systemd-devel/2015-April/031346.html change] from our original approach: they wanted a human-presentable VARIANT and a separate lower-case-only VARIANT_ID value. This patch implements this in Fedora to keep us aligned with [http://cgit.freedesktop.org/systemd/systemd/commit/?id=be7d0048ddda1e994f651e2825f96266d537d10d systemd upstream].
Sorry for the churn on this. Fortunately, we only have one package depending on this at the moment in Fedora, which I can keep updated. I think it makes sense to get this in for Fedora 22 Final so we aren't maintaining different approaches in Fedora 21, 22 and 23.
I've submitted a [https://lists.fedoraproject.org/pipermail/rel-eng/2015-May/019982.html patch] to rel-eng to make this change for F22 and F23.
Should be a trivial bunch of +1's.
I suggest this is a "just do it" thing, and I'm going to just do it.
And.. I've just done it. I think this bears an announcement, so:
Slightly modified the per-product configuration guidelines to account for changes in the os-release file. * https://fedoraproject.org/wiki/Packaging:Per-Product_Configuration * https://fedoraproject.org/w/index.php?title=Packaging%3APer-Product_Configuration&diff=411980&oldid=410805 * https://fedorahosted.org/fpc/ticket/520#comment:7
Also, there was a question on one of the mailing lists recently about what to do if you have a daemon that keeps its configuration files in a folder and reads everything ending in .conf, or reads everything in there. Not sure it's worth accommodating those cases in the guidelines when the options seem relatively obvious but would depend pretty heavily on the exact behavior of the daemon in question.
Turns out that question wasn't raised in a mailing list discussion; someone actually posted to the talk page on the wiki. Why with all of our usual methods of communication someone would think that a good way to communicate, I don't know.
Anyway, the question was posted here: https://fedoraproject.org/wiki/Packaging_talk:Per-Product_Configuration
OK, so I think the short answer is that the guideline can probably have an exception case for configuration involving drop directories. If one or more files in a drop-dir need variant-specific configuration, the {{{foo-variant.conf}}} should live outside the drop-dir. Then everything else should behave the same as above.
Seem reasonable?
Oops, this was sitting around in announce even after I announced it.
To be honest, I don't really think this needs much of anything. It's kind of obvious that you need to move things outside of the dropin directory in some cases, and packagers should be trusted to do the smart thing in the very rare case that a package actually needs to follow this guideline and doesn't work like the provided examples. People will always find some way to lawyer the rules but at some point we have to know we can't document everything.
I think I'm just going to close this, but if does turn out to be a problem and someone really does want to write up a little draft or something they should feel free to reopen.
Metadata Update from @tibbs: - Issue assigned to james
Log in to comment on this ticket.