#190 Please change the packaging guidelines to make use of systemd RPM macros
Closed: Fixed None Opened 11 years ago by lennart.

I have commited to systemd git a set of RPM macros that shall unify the systemd service installation/deinstallation scriptlets used by the various distributions. I'd like to ask the FPC to change the packaging guidelines to recommend usage of these macros.

Here are the macros:

http://cgit.freedesktop.org/systemd/systemd/tree/src/core/macros.systemd.in

These are basically 1:1 copies of the snippets currently suggested on:

https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd

However, there is one major change: this code makes use of systemd "presets", as documented here:

https://fedoraproject.org/wiki/Features/PackagePresets

The macro code does not exist in Rawhide yet, only in systemd git. Ideally I'd like the FPC to have a look at it first, before I push this out into Rawhide.

I wrote a bit of (generic) documentation for these new macros in the daemon(7) man page:

http://www.freedesktop.org/software/systemd/man/daemon.html

Scroll down to "Installing Systemd Service Files" in the man page!

Note that I avoided creating a macro for the sysv conversion snippets. My main objective was to standardize the common bits between distros, but since the sysv conversion bits is so drastically different I didn't cover those. This means the packaging guidelines have to retain the original %trigger snippets for the conversion.


Oh, and one more thing: currently we don't install any preset file in Fedora. That means "systemctl preset" is equivalent with "systemctl enable" which hence means that all services installed are automatically enabled. This is of course the opposite of the normal Fedora policy. Hence, when I upload this to Rawhide I will make sure to include a preset file containing "disable *" to enforce the Fedora rule of disabling evertyhing by default.

Hmm, yet another thing: in the longer run this list:

https://fedoraproject.org/wiki/Starting_services_by_default

should be converted into a .preset file we ship by default, and removed from the packages themselves. That way, admins can override this implicit policy, and the various spins can make spin-specific changes to it, for example to enable or disable specific services for their desktops and so on. But this is just the second step, initially I'd just like to see the macros OK'ed and included in the spec.

BTW, there is now documentation available regarding the preset policy files:

http://www.freedesktop.org/software/systemd/man/systemd.preset.html

The RPM macros are now in Rawhide.

Guys, and chance this request will be processed one day?

Of course it will be processed one day, just as soon as we have a meeting. No meeting last week due to a conference. No meeting this week due to the American independence day holiday.

What is the proposed change to the guidelines around this? Is there a draft?

All macros except for the Requires macro approved for inclusion in FPC guidelines, assuming that the proper presets are put in place (+1:6, 0:0, -1:0).

Rationale for not using Requires macro:
1) We have not permitted use of macros that evaluate to Requires in the past, as this obfuscates what would otherwise be clear Explicit Requires.
2) This specific macro adds Requires on "systemd", not "systemd-units", which is what we currently require.

We will hold on amending the guidelines to reflect this change on FESCo feature approval.

Replying to [comment:9 spot]:

All macros except for the Requires macro approved for inclusion in FPC guidelines, assuming that the proper presets are put in place (+1:6, 0:0, -1:0).

Is it OK if I leave the macro in the the file, but that the guideliness simply don't suggest making use of it? As we ship the macro upstream it would be good if other distros could still make use of the macro.

Rationale for not using Requires macro:
1) We have not permitted use of macros that evaluate to Requires in the past, as this obfuscates what would otherwise be clear Explicit Requires.
2) This specific macro adds Requires on "systemd", not "systemd-units", which is what we currently require.

Hmm, Oh, well, on Rawhide systemd-units got merged back into systemd, so the scriptlet suggestions should probably be updated in this regard.

We will hold on amending the guidelines to reflect this change on FESCo feature approval.

Heh, we have a deadlock there. The preset feature was proposed for F17 and denied on the grounds that this really should be something for FPC to decide on (which I guess makes sense). But if FPC now wants FESCO to take action first we have a classic deadlock ;-)

I mean, I am happy with submitting the preset feature again for f18, but this kinda requires that FPC before/at the same time agrees on the policy.

BTW systemd in Rawhide ships as preset file this:

http://pkgs.fedoraproject.org/gitweb/?p=systemd.git;a=blob_plain;f=99-default.preset;hb=HEAD

which enforces the "disable by default" policy of Fedora. That preset file should probably move to fedora-release.rpm or so eventually.

I wouldn't consider this a deadlock. the fpc approved it, it's just waiting on publishing updated guidelines for something not yet ratified by fesco.

The FESCO feature has been accepted btw. What's the next step to get the macros into the guidelines?

Announce Text:

The systemd scriptlet guidelines have been updated for Fedora 18. In Fedora 18, the systemd package now provides helper macros to simplify %post, %preun, and %postun invocations in packages with systemd unit files. Additionally, these macros enable support for systemd "profiles", a Fedora 18 Feature.

https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd

Awesome! Thanks a lot!

There appeared a problem with the current guidelines. See https://bugzilla.redhat.com/show_bug.cgi?id=847405

According to http://www.rpm.org/wiki/PackagerDocs/Macros#UsingaMacro , the way a parametrized macro is used makes an important difference:
This should work:
%systemd_post foo.service
This breaks:
%{systemd_post} foo.service

(Only the first form treats the following text on the line as macro arguments.)

The guidelines should therefore use the first form.

Viking-Ice tells me that people have been actively recommending the use of the %systemd_requires macro in review requests (He mentioned this bug as one example: https://bugzilla.redhat.com/show_bug.cgi?id=869301#c2 ).

So it seems that we need to remove the macro otherwise people will find it via rpm --showrc and assume it should be used.

Even though that systemd_requires macro is still there in current rawhide. I don't see anything that the committee can do here except to add a note that the macro should not be used, which I have done. I guess I'll file a systemd bug.

Metadata Update from @lennart:
- Issue assigned to spot

7 years ago

Login to comment on this ticket.

Metadata