From 48ec7f80caf6f42bb92c8cedd490974a4546d073 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 21 Apr 2020 22:45:02 +0200 Subject: 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... --- NEWS | 1 + t/data/SPECS/ordering-scriptlets/a_1.spec | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index b5320a65..424ca34d 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ o fix test with rpm < 4.13 on CentOS7 o perform some file conflict tests only on Mageia o try harder to find genhdlist2 in uninstalled CPAN modules + o work without glibc-static-devel - testsuite: o describe it more o disable fsync/fdatasync while running tests 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 < a.c #include 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/* +/* -- cgit v1.2.1