summaryrefslogtreecommitdiffstats
path: root/t/data/SPECS
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2020-04-21 22:45:02 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2020-04-29 14:38:28 +0200
commit48ec7f80caf6f42bb92c8cedd490974a4546d073 (patch)
treec1cf2bba44ed569c2375de655c04fbf72c3b7426 /t/data/SPECS
parent8f71a97c4a6759ada040eea2c5cc83acb46a18c2 (diff)
downloadurpmi-48ec7f80caf6f42bb92c8cedd490974a4546d073.tar
urpmi-48ec7f80caf6f42bb92c8cedd490974a4546d073.tar.gz
urpmi-48ec7f80caf6f42bb92c8cedd490974a4546d073.tar.bz2
urpmi-48ec7f80caf6f42bb92c8cedd490974a4546d073.tar.xz
urpmi-48ec7f80caf6f42bb92c8cedd490974a4546d073.zip
cpan-testers: work without glibc-static-devel
just build a dynamic binary but exclude its deps rationale: quite a lot of CPAN testers do not have static libs installed...
Diffstat (limited to 't/data/SPECS')
-rw-r--r--t/data/SPECS/ordering-scriptlets/a_1.spec20
1 files changed, 17 insertions, 3 deletions
diff --git a/t/data/SPECS/ordering-scriptlets/a_1.spec b/t/data/SPECS/ordering-scriptlets/a_1.spec
index 4edb53df..fc34d27f 100644
--- a/t/data/SPECS/ordering-scriptlets/a_1.spec
+++ b/t/data/SPECS/ordering-scriptlets/a_1.spec
@@ -8,11 +8,13 @@ Release: 1
License: x
Provides: /bin/a
BuildRequires: gcc
+%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^libc.so|^ld
+%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^libc.so|^ld
%prep
%setup -c -T
# This is a simple static "shell" for scriptlets.
-# Thus it must be w/o deps (static):
+# Thus it must be w/o deps (static) or with self contained deps (included):
cat <<EOF > a.c
#include <stdio.h>
int main(int argc, char **argv) {
@@ -25,13 +27,25 @@ int main(int argc, char **argv) {
EOF
%build
-gcc -Wall -static -o a a.c
+# Try a static build with fallback to dynamic if no static libs/headers
+# (in which case we will pull the the wanted libs in %%install):
+gcc -Wall -static -o a a.c || gcc -Wall -o a a.c
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/bin/
cp a $RPM_BUILD_ROOT/bin/a
+%ifos linux
+%global cpio_opts --dereference
+%else
+%global cpio_opts %nil
+%endif
+# Install the wanted libs if not static:
+ldd a | sed -e 's/^[ \t]*//' -e 's/.* => //' -e 's/ .*//' > list
+grep '/' list | (cd / ; cpio -pumd %cpio_opts %buildroot)
+find %buildroot
+
%clean
rm -rf $RPM_BUILD_ROOT
@@ -40,4 +54,4 @@ x
%files
%defattr(-,root,root)
-/bin/*
+/*