#566 RPM file triggers
Closed: Fixed None Opened 7 years ago by tibbs.

RPM (in rawhide) now supports the concept of File triggers: http://www.rpm.org/wiki/FileTriggers

This allows a package to define a directory (really a pathname prefix) and something to run when files are placed in that directory.

This means that, say, glibc can tell rpm to automatically run ldconfig when any package installs something into /usr/lib64. The triggers can be run after a package installs files in the dirs, or at the end of a transaction when a package installs files.

This is huge, and enables us to completely remove a whole lot of scriptlets. Pretty much all of the standard ones can theoretically disappear completely once the work is done to get all of the packages which own various directories updated to supply the triggers.

Just filing this ticket to track the issue; I'll try to work up a draft later but it's still pretty early. At least one package already has this set up, though (gdk-pixbuf2, http://pkgs.fedoraproject.org/cgit/gdk-pixbuf2.git/commit/?id=22656f0763c56bf856bc2faf7339cdb708f08c76 ).

Note that it appears that F23 will get this as well. Which means we might as well try to move forward with it. I think that for the guidelines, all this really means is that we can note that the various scriptlets are optional for F23 and newer. We should only do this, however, when we can verify that the necessary package has set up the trigger. glibc would be an obvious choice of package that should change as soon as is feasible, I'd think, but that's not really our deal. (Current rawhide glibc doesn't have these macros.)

We discussed this at this weeks meeting (http://meetbot.fedoraproject.org/fedora-meeting-1/2015-09-10/fpc.2015-09-10-16.00.txt):

FYI current rawhide shows uptake of this, esp. in desktop land:

./desktop-file-utils/desktop-file-utils.spec:%transfiletriggerin -- %{_datadir}/applications
./desktop-file-utils/desktop-file-utils.spec:%transfiletriggerpostun -- %{_datadir}/applications
./fontconfig/fontconfig.spec:%transfiletriggerin -- /usr/share/fonts /usr/share/X11/fonts/Type1 /usr/share/X11/fonts/TTF /usr/local/share/fonts
./fontconfig/fontconfig.spec:%transfiletriggerpostun -- /usr/share/fonts /usr/share/X11/fonts/Type1 /usr/share/X11/fonts/TTF /usr/local/share/fonts
./gdk-pixbuf2/gdk-pixbuf2.spec:%transfiletriggerin -- %{_libdir}/gdk-pixbuf-2.0/2.10.0/loaders
./gdk-pixbuf2/gdk-pixbuf2.spec:%transfiletriggerpostun -- %{_libdir}/gdk-pixbuf-2.0/2.10.0/loaders
./glib2/glib2.spec:%transfiletriggerin -- %{_libdir}/gio/modules
./glib2/glib2.spec:%transfiletriggerpostun -- %{_libdir}/gio/modules
./glib2/glib2.spec:%transfiletriggerin -- %{_datadir}/glib-2.0/schemas
./glib2/glib2.spec:%transfiletriggerpostun -- %{_datadir}/glib-2.0/schemas
./gtk3/gtk3.spec:%transfiletriggerin -- %{_libdir}/gtk-3.0/3.0.0/immodules
./gtk3/gtk3.spec:%transfiletriggerpostun -- %{_libdir}/gtk-3.0/3.0.0/immodules
./man-db/man-db.spec:%transfiletriggerin -- %{_mandir}
./man-db/man-db.spec:%transfiletriggerpostun -- %{_mandir}
./shared-mime-info/shared-mime-info.spec:%transfiletriggerin -- %{_datadir}/mime
./shared-mime-info/shared-mime-info.spec:%transfiletriggerpostun -- %{_datadir}/mime

Interesting; we don't have scriptlets for manpages so I guess with this they're able to get rid of the cron job.

These would be on my "hit list" of things which would help the most if they grew scriptlets:

  • glibc - gets rid of all ldconfig scriptlets
  • texlive - That's a few thousand scriptlets gone in a flash. Would probably speed up my installs quite a bit.
  • info - a bunch of random things have info pages.

It also occurs to me that we can do a bunch of other cool things. Like have /etc/shells.d and a trigger somewhere to update the shells file. Or do the same for any other monolithic config file.

FYI: https://bugzilla.redhat.com/show_bug.cgi?id=1282115 "rpm %transfiletriggerun is called twice per transaction".

We discussed this at this weeks meeting (http://meetbot.fedoraproject.org/fedora-meeting-1/2016-01-14/fpc.2016-01-14-17.01.txt):

So systemd is now using triggers, but it doesn't make much difference to packagers because annoyingly you still have to keep the scriptlets in place.

Yes, there was no plan to remove the scriptlets. The only change is that 'systemctl daemon-reload' does not have to be called once per package containing systemd units, and only a fixed number of times per transaction (currently two).

Will we be seeing glibc adopt file triggers as well? It'd be nice to not have to include the %post(un) -p /sbin/ldconfig calls anymore in specs. Mageia already does this, and it does make things simpler and more readable. Adding it for info pages would be cool too.

Assigning this to me so that I can remember to keep the Snippets page updated with the packages that implement triggers.

I think all of those have been fixed to indicate that they're F23 only or F23-F24 only. If there are others, please open a new ticket.

Metadata Update from @tibbs:
- Issue assigned to tibbs

5 years ago

Login to comment on this ticket.