From 44340a4ccc1d0054b5272200c13be18028d9cd59 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Thu, 18 Jul 2024 14:09:30 +0200 Subject: [PATCH] Package tests and add gating.yaml --- .fmf/version | 1 + gating.yaml | 7 ++++ perl-Module-Build.spec | 73 +++++++++++++++++++++++++++++++++++++++- plans/sanity.fmf | 5 +++ tests/upstream-tests.fmf | 12 +++++++ 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/sanity.fmf create mode 100644 tests/upstream-tests.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..1608530 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +# RHEL +--- !Policy +product_versions: + - rhel-* +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/perl-Module-Build.spec b/perl-Module-Build.spec index 3f3220b..d81c5e6 100644 --- a/perl-Module-Build.spec +++ b/perl-Module-Build.spec @@ -12,7 +12,7 @@ Name: perl-Module-Build Epoch: 2 Version: %{cpan_version_major}%{?cpan_version_minor:.%cpan_version_minor} -Release: 5%{?dist} +Release: 6%{?dist} Summary: Build and install Perl modules License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/release/Module-Build @@ -121,6 +121,14 @@ Requires: perl(Pod::Text) %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\((ExtUtils::Install|File::Spec|Module::Build|Module::Metadata|Perl::OSType)\\)$ %global __requires_exclude %__requires_exclude|^perl\\(CPAN::Meta::YAML\\) >= 0.002$ +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} +%global __requires_exclude %{__requires_exclude}|^perl\\(DistGen\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(MBTest\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(Simple\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(Software::License.*\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(Tie::CPHash\\) + %description Module::Build is a system for building, testing, and installing Perl modules. It is meant to be an alternative to ExtUtils::MakeMaker. @@ -132,9 +140,36 @@ so even platforms like MacOS (traditional) can use it fairly easily. Its only prerequisites are modules that are included with perl 5.6.0, and it works fine on perl 5.005 if you can install a few additional modules. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +# Optional tests: +%if !%{defined perl_bootstrap} +%if %{with perl_Module_Build_enables_optional_test} +Requires: perl(Archive::Zip) +Requires: perl(File::ShareDir) >= 1.00 +Requires: perl(PAR::Dist) +%endif +%endif +Requires: perl(TAP::Harness) +Requires: perl(TAP::Harness::Env) +Requires: perl(Text::ParseWords) +Requires: perl(version) >= 0.87 + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %autosetup -p1 -n Module-Build-%{cpan_version} +# Help generators to recognize Perl scripts +for F in `find t -name *.t -o -name *.pl`; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done + %build perl Build.PL --installdirs=vendor ./Build @@ -143,6 +178,36 @@ perl Build.PL --installdirs=vendor ./Build install --destdir=%{buildroot} --create_packlist=0 %{_fixperms} -c %{buildroot} +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t _build %{buildroot}%{_libexecdir}/%{name} +perl -pi -e 's#%{buildroot}##' %{buildroot}%{_libexecdir}/%{name}/_build/runtime_params +rm %{buildroot}%{_libexecdir}/%{name}/_build/magicnum +mkdir -p %{buildroot}%{_libexecdir}/%{name}/bin +ln -s %{_bindir}/config_data %{buildroot}%{_libexecdir}/%{name}/bin +# Requires copy of modules in test directory +rm %{buildroot}%{_libexecdir}/%{name}/t/00-compile.t +# Remove using of blib +for F in `find %{buildroot}%{_libexecdir}/%{name}/t -name *.t -o -name *.pm`; do + perl -pi -e "s/^\s*blib_load\('([^']+)'\);/use \1;/" $F + perl -pi -e "s/^blib_load '([^']+)';/use \1;/" $F +done +perl -pi -e "s{'-Mblib', }{'-I'.\\N{U+0024}tmp.'/Simple/blib/lib', '-I'.\\N{U+0024}tmp.'/Simple/blib/arch', }x" \ + %{buildroot}%{_libexecdir}/%{name}/t/xs.t +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/bash +set -e +# Some tests write into temporary files/directories. The easiest solution +# is to 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 rm t/signature.t LANG=C TEST_SIGNATURE=1 MB_TEST_EXPERIMENTAL=1 ./Build test @@ -155,7 +220,13 @@ LANG=C TEST_SIGNATURE=1 MB_TEST_EXPERIMENTAL=1 ./Build test %{_mandir}/man1/config_data.1* %{_mandir}/man3/Module::Build*.3* +%files tests +%{_libexecdir}/%{name} + %changelog +* Thu Jul 18 2024 Jitka Plesnikova - 2:0.42.34-6 +- Package tests + * Mon Jun 24 2024 Troy Dawson - 2:0.42.34-5 - Bump release for June 2024 mass rebuild diff --git a/plans/sanity.fmf b/plans/sanity.fmf new file mode 100644 index 0000000..a72ded4 --- /dev/null +++ b/plans/sanity.fmf @@ -0,0 +1,5 @@ +summary: Sanity tests +discover: + how: fmf +execute: + how: tmt diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..b5125b0 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,12 @@ +summary: Upstream tests +contact: Jitka Plesnikova +component: perl-Module-Build +require: perl-Module-Build-tests +test: /usr/libexec/perl-Module-Build/test +enabled: true +tag: + - rhel-buildroot +adjust: + - enabled: false + when: distro < rhel-10 or distro < centos-stream-10 + continue: false