Ticket #190 (reopened defect)

Opened 22 months ago

Last modified 17 months ago

Please change the packaging guidelines to make use of systemd RPM macros

Reported by: lennart Owned by: spot
Priority: major Milestone:
Component: Guideline Draft Version:
Keywords: Cc: notting, michich
Blocked By: Blocking:

Description

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.

Change History

comment:1 Changed 22 months ago by lennart

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.

comment:2 Changed 22 months ago by lennart

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.

comment:3 Changed 22 months ago by lennart

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

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

comment:4 Changed 22 months ago by lennart

And the general preset logic is also explained here:

http://freedesktop.org/wiki/Software/systemd/Preset

comment:5 Changed 22 months ago by notting

  • Cc notting added

comment:6 Changed 22 months ago by lennart

The RPM macros are now in Rawhide.

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

comment:7 Changed 22 months ago by tibbs

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.

comment:8 Changed 22 months ago by limb

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

comment:9 follow-up: ↓ 10 Changed 22 months ago by spot

  • Owner set to spot
  • Status changed from new to assigned

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.

comment:10 in reply to: ↑ 9 Changed 22 months ago by lennart

Replying to 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.

comment:11 Changed 22 months ago by lennart

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.

comment:12 Changed 22 months ago by rdieter

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.

comment:13 Changed 21 months ago by lennart

comment:14 Changed 21 months ago by lennart

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

comment:15 Changed 21 months ago by spot

  • Status changed from assigned to closed
  • Resolution set to fixed

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

comment:16 Changed 21 months ago by lennart

Awesome! Thanks a lot!

comment:17 Changed 21 months ago by michich

  • Cc michich added
  • Type changed from enhancement to defect
  • Priority changed from minor to major
  • Resolution fixed deleted
  • Status changed from closed to reopened

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.

comment:18 Changed 21 months ago by spot

  • Status changed from reopened to closed
  • Resolution set to fixed

Fixed, thanks.

comment:19 Changed 17 months ago by toshio

  • Status changed from closed to reopened
  • Resolution fixed deleted

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.

Note: See TracTickets for help on using tickets.