From 12ace9bdb9bb61dbe1dbf4f250eee7c5913fb5c9 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Thu, 25 Jan 2018 20:26:12 +0100 Subject: [PATCH] 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 --- brp-ldconfig | 10 ++++++++++ macros | 2 ++ redhat-rpm-config.spec | 11 ++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 brp-ldconfig diff --git a/brp-ldconfig b/brp-ldconfig new file mode 100644 index 0000000..90d0f13 --- /dev/null +++ b/brp-ldconfig @@ -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. diff --git a/macros b/macros index c997d28..9e5c15b 100644 --- a/macros +++ b/macros @@ -100,6 +100,7 @@ # Build root policy macros. Standard naming: # 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_strip /usr/lib/rpm/brp-strip %{__strip} %__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 %__os_install_post \ + %{?__brp_ldconfig} \ %{?__brp_compress} \ %{!?__debug_package:\ %{?__brp_strip} \ diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index c878317..7211e29 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 87 +Version: 88 Release: 1%{?dist} # No version specified. License: GPL+ @@ -64,6 +64,9 @@ Source600: kmod.attr Source601: kmod.prov Source602: libsymlink.attr +# BRPs +Source700: brp-ldconfig + # Documentation Source900: buildflags.md @@ -123,6 +126,8 @@ install -p -m 755 -t %{buildroot}%{rrcdir} find-* mkdir -p %{buildroot}%{rrcdir}/find-provides.d 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 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}/find-provides %{rrcdir}/find-requires +%{rrcdir}/brp-ldconfig %{_fileattrsdir}/*.attr %{_rpmconfigdir}/kmod.prov %{_rpmconfigdir}/macros.d/macros.*-srpm @@ -160,6 +166,9 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Thu Jan 29 2018 Igor Gnatenko - 88-1 +- Create DSO symlinks automatically + * Mon Jan 29 2018 Florian Weimer - 87-1 - Build flags: Disable -z defs again (#1535422)