Add file triggers to do ldconfig calls automatically

Since time immemorial, Red Hat/Fedora packagers have been required
to add a stanza to spec files for packages containing libraries to
update the ldconfig cache.

```
%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig
```

To say this is annoying is to put it mildly. However, there was no
standard mechanism to make this boilerplate go away. Now with RPM 4.13+,
we should change this to file triggers and make all of that go away.

In the case of the transaction file triggers that run on the regular
link library paths, the performance benefit is minimal, and being greedy
does not hurt in this case. It's still an improvement over running
ldconfig every time anyway.

With the introduction of these triggers, we can start removing the
ldconfig boilerplate from Fedora package specs, and new packages will
not need to add it.

Pirority (-P) is not strictly needed, but we want to run our ldconfig
"first" before rest of scriptlets so it would speed up them (we would
build ldconfig cache beforehand).

References: https://bugzilla.redhat.com/1380878
Originally-proposed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2018-01-29 17:07:39 +01:00
parent 6777c3ed80
commit 1f24fb0da2
No known key found for this signature in database
GPG Key ID: 695714BD1BBC5F4C

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.26.9000-1145-g21c0696cde
%define glibcversion 2.26.9000
%define glibcrelease 48%{?dist}
%define glibcrelease 49%{?dist}
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
@ -348,6 +348,16 @@ contains the most important sets of shared libraries: the standard C
library and the standard math library. Without these two libraries, a
Linux system will not function.
######################################################################
# File triggers to do ldconfig calls automatically (see rhbz#1380878)
######################################################################
# File triggers for when libraries are added or removed in standard paths
%transfiletriggerin -p /sbin/ldconfig -P 2000000 -- /lib /usr/lib /lib64 /usr/lib64
%transfiletriggerpostun -p /sbin/ldconfig -P 2000000 -- /lib /usr/lib /lib64 /usr/lib64
######################################################################
######################################################################
# libnsl subpackage
######################################################################
@ -1982,6 +1992,9 @@ fi
%endif
%changelog
* Mon Jan 29 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.26.9000-49
- Add file triggers to do ldconfig calls automatically
* Mon Jan 22 2018 Florian Weimer <fweimer@redhat.com> - 2.26.9000-48
- Auto-sync with upstream branch master,
commit 21c0696cdef617517de6e25711958c40455c554f: