Create DSO symlinks automatically

If there are unpackaged symlinks, build will fail with unpackaged files.
People can %undefine __brp_ldconfig if they need to and they should make
sure that they call ldconfig themselves.

Right now, script doesn't guide packagers what to do, but it's not
prerequisite.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2018-01-25 20:26:12 +01:00
parent 8d6c6d0761
commit 12ace9bdb9
3 changed files with 22 additions and 1 deletions

10
brp-ldconfig Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh -efu
# Force creating of DSO symlinks.
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
/sbin/ldconfig -N -r "$RPM_BUILD_ROOT"
# TODO: warn if it created new symlinks and guide people.

2
macros
View File

@ -100,6 +100,7 @@
# Build root policy macros. Standard naming: # Build root policy macros. Standard naming:
# convert all '-' in basename to '_', add two leading underscores. # convert all '-' in basename to '_', add two leading underscores.
%__brp_ldconfig /usr/lib/rpm/redhat/brp-ldconfig
%__brp_compress /usr/lib/rpm/brp-compress %__brp_compress /usr/lib/rpm/brp-compress
%__brp_strip /usr/lib/rpm/brp-strip %{__strip} %__brp_strip /usr/lib/rpm/brp-strip %{__strip}
%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} %__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
@ -108,6 +109,7 @@
%__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink %__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink
%__os_install_post \ %__os_install_post \
%{?__brp_ldconfig} \
%{?__brp_compress} \ %{?__brp_compress} \
%{!?__debug_package:\ %{!?__debug_package:\
%{?__brp_strip} \ %{?__brp_strip} \

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config Name: redhat-rpm-config
Version: 87 Version: 88
Release: 1%{?dist} Release: 1%{?dist}
# No version specified. # No version specified.
License: GPL+ License: GPL+
@ -64,6 +64,9 @@ Source600: kmod.attr
Source601: kmod.prov Source601: kmod.prov
Source602: libsymlink.attr Source602: libsymlink.attr
# BRPs
Source700: brp-ldconfig
# Documentation # Documentation
Source900: buildflags.md Source900: buildflags.md
@ -123,6 +126,8 @@ install -p -m 755 -t %{buildroot}%{rrcdir} find-*
mkdir -p %{buildroot}%{rrcdir}/find-provides.d mkdir -p %{buildroot}%{rrcdir}/find-provides.d
install -p -m 644 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov install -p -m 644 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov
install -p -m 755 -t %{buildroot}%{rrcdir} brp-*
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d
install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.* install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.*
@ -140,6 +145,7 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
%{rrcdir}/config.* %{rrcdir}/config.*
%{rrcdir}/find-provides %{rrcdir}/find-provides
%{rrcdir}/find-requires %{rrcdir}/find-requires
%{rrcdir}/brp-ldconfig
%{_fileattrsdir}/*.attr %{_fileattrsdir}/*.attr
%{_rpmconfigdir}/kmod.prov %{_rpmconfigdir}/kmod.prov
%{_rpmconfigdir}/macros.d/macros.*-srpm %{_rpmconfigdir}/macros.d/macros.*-srpm
@ -160,6 +166,9 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
%{_rpmconfigdir}/macros.d/macros.kmp %{_rpmconfigdir}/macros.d/macros.kmp
%changelog %changelog
* Thu Jan 29 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 88-1
- Create DSO symlinks automatically
* Mon Jan 29 2018 Florian Weimer <fweimer@redhat.com> - 87-1 * Mon Jan 29 2018 Florian Weimer <fweimer@redhat.com> - 87-1
- Build flags: Disable -z defs again (#1535422) - Build flags: Disable -z defs again (#1535422)