From 2e437f6194c80a87e5eae93b046f6ce5f34a7a18 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Wed, 8 Nov 2023 16:27:11 +0300 Subject: [PATCH] import perl-Devel-CheckLib-1.14-9.el9 --- SPECS/perl-Devel-CheckLib.spec | 57 +++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/SPECS/perl-Devel-CheckLib.spec b/SPECS/perl-Devel-CheckLib.spec index 9645a77..6b9b531 100644 --- a/SPECS/perl-Devel-CheckLib.spec +++ b/SPECS/perl-Devel-CheckLib.spec @@ -7,7 +7,7 @@ Name: perl-Devel-CheckLib Version: 1.14 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Check that a library is available License: GPL+ or Artistic @@ -16,9 +16,11 @@ Source0: https://cpan.metacpan.org/modules/by-module/Devel/Devel-CheckLib BuildArch: noarch +BuildRequires: coreutils BuildRequires: make BuildRequires: perl-interpreter BuildRequires: perl-generators +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) # Run-time: BuildRequires: perl(Exporter) @@ -26,6 +28,8 @@ BuildRequires: perl(File::Spec) BuildRequires: perl(File::Temp) >= 0.16 BuildRequires: perl(Text::ParseWords) # Tests: +BuildRequires: gcc +BuildRequires: perl(blib) BuildRequires: perl(Cwd) BuildRequires: perl(File::Spec::Functions) BuildRequires: perl(IO::File) @@ -36,16 +40,41 @@ BuildRequires: perl(Test::More) >= 0.88 %if %{with perl_Devel_CheckLib_enables_optional_test} BuildRequires: perl(Mock::Config) %endif +# perl inherits the compiler flags it was built with, hence we need this on hardened systems +Requires: redhat-rpm-config Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} + %description Devel::CheckLib is a perl module that checks whether a particular C library and its headers are available. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: gcc +# Optional tests +%if %{with perl_Devel_CheckLib_enables_optional_test} +Requires: perl(Mock::Config) +%endif + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n Devel-CheckLib-%{version} +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done + %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 make %{?_smp_mflags} @@ -54,7 +83,26 @@ make %{?_smp_mflags} make pure_install DESTDIR=$RPM_BUILD_ROOT %{_fixperms} $RPM_BUILD_ROOT/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +perl -i -ne 'print $_ unless m{\Q'-Mblib'\E}' %{buildroot}%{_libexecdir}/%{name}/t/cmdline-LIBS-INC.t +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/bash +set -e +# Some tests need to write into temporary files/directories. +# Copy the tests into a writable directory and execute them from there. +DIR=$(mktemp -d) +pushd "$DIR" +cp -a %{_libexecdir}/%{name}/* ./ +prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +popd +rm -rf "$DIR" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test + %check +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files @@ -64,8 +112,15 @@ make test %{_mandir}/man1/*.1* %{_mandir}/man3/*.3* +%files tests +%{_libexecdir}/%{name} %changelog +* Wed Jun 21 2023 Jitka Plesnikova - 1.14-9 +- Add test BR gcc and perl(blib) to not skip the tests +- Package tests +- Resolves: rhbz#2216280 + * Mon Aug 09 2021 Mohan Boddu - 1.14-8 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688