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..282e16b --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} diff --git a/perl-IO-Compress.spec b/perl-IO-Compress.spec index 379555c..b34e804 100644 --- a/perl-IO-Compress.spec +++ b/perl-IO-Compress.spec @@ -7,11 +7,14 @@ %bcond_with perl_IO_Compress_enables_optional_test %endif +# Dependency version if different to this package version +%global depver 2.101 + %{?perl_default_filter} Name: perl-IO-Compress -Version: 2.101 -Release: 1%{?dist} +Version: 2.102 +Release: 2%{?dist} Summary: Read and write compressed data License: GPL+ or Artistic URL: https://metacpan.org/release/IO-Compress @@ -30,8 +33,8 @@ BuildRequires: perl(File::Spec::Functions) # Module Runtime BuildRequires: perl(bytes) BuildRequires: perl(Carp) -BuildRequires: perl(Compress::Raw::Bzip2) >= %{version} -BuildRequires: perl(Compress::Raw::Zlib) >= %{version} +BuildRequires: perl(Compress::Raw::Bzip2) >= %{?depver}%{!?depver:%{version}} +BuildRequires: perl(Compress::Raw::Zlib) >= %{?depver}%{!?depver:%{version}} BuildRequires: perl(constant) BuildRequires: perl(Encode) BuildRequires: perl(Exporter) @@ -51,6 +54,9 @@ BuildRequires: perl(warnings) BuildRequires: perl(File::Path) BuildRequires: perl(lib) BuildRequires: perl(threads::shared) +%if !%{defined perl_bootstrap} +BuildRequires: perl(Test::More) +%endif %if %{with perl_IO_Compress_enables_optional_test} # Optional Tests BuildRequires: perl(bytes) @@ -60,7 +66,6 @@ BuildRequires: perl(overload) # Dual-lived module needs building early in the boot process %if !%{defined perl_bootstrap} BuildRequires: perl(Test::NoWarnings) -BuildRequires: perl(Test::Pod) >= 1.00 %endif %endif # Runtime @@ -77,6 +82,16 @@ Provides: perl-IO-Compress-Bzip2 = %{version}-%{release} Obsoletes: perl-IO-Compress-Zlib < %{version}-%{release} Provides: perl-IO-Compress-Zlib = %{version}-%{release} +# Filter modules bundled for tests +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(CompTestUtils\\) +%global __requires_exclude %{__requires_exclude}|^perl\\(.*\.pl)\s*$ +%if %{defined perl_bootstrap} +%global __requires_exclude %{__requires_exclude}|^perl\\(Test::Builder)\s*$ +%global __requires_exclude %{__requires_exclude}|^perl\\(Test::More)\s*$ +%global __requires_exclude %{__requires_exclude}|^perl\\(Test::Simple)\s*$ +%endif +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} + %description This distribution provides a Perl interface to allow reading and writing of compressed data created with the zlib and bzip2 libraries. @@ -91,6 +106,15 @@ included with the IO-Compress distribution: * IO-Compress-Bzip2 * IO-Compress-Base +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness + +%description tests +Tests from %{name}-%{version}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n IO-Compress-%{version} @@ -98,19 +122,62 @@ included with the IO-Compress distribution: chmod -c -x lib/IO/Uncompress/{Adapter/Identity,RawInflate}.pm find examples -type f -exec chmod -c -x {} \; +%if ! %{defined perl_bootstrap} +# Remove bundled Test::* modules +rm -rf t/Test +perl -i -ne 'print $_ unless m{^t/Test/}' MANIFEST +%endif + # Fix shellbangs in examples perl -MConfig -pi -e 's|^#!/usr/local/bin/perl\b|$Config{startperl}|' examples/io/anycat \ examples/io/bzip2/* examples/io/gzip/* examples/compress-zlib/* +# Help file to recognise the Perl scripts and normalize shebangs +for F in `find t -name *.t` `find t -name *.pl`; do + if head -1 "$F" | grep -q -e '^#!.*perl' ; then + perl -MConfig -pi -e 's|^#!.*perl\b|$Config{startperl}|' "$F" + else + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1' "$F" + fi + chmod +x "$F" +done + +# Remove release tests +rm t/999pod.t t/999meta-*.t +perl -i -ne 'print $_ unless m{^t/999pod\.t}' MANIFEST +perl -i -ne 'print $_ unless m{^t/999meta-.*\.t}' MANIFEST + %build perl Makefile.PL NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} %install %{make_install} INSTALLDIRS=perl + +# Install tests +mkdir -p %{buildroot}/%{_libexecdir}/%{name} +cp -a examples t %{buildroot}/%{_libexecdir}/%{name} +perl -i -pe "s{\"./bin/\"}{\"%{_bindir}\"}" %{buildroot}/%{_libexecdir}/%{name}/t/011-streamzip.t +cat > %{buildroot}/%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +set -e +# Lots of 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}/* ./ +unset PERL_CORE +prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +popd +rm -rf "$DIR" +EOF +chmod +x %{buildroot}/%{_libexecdir}/%{name}/test + %{_fixperms} -c %{buildroot} %check +unset PERL_CORE +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') # Build using "--without long_tests" to avoid very long tests # (full suite can take nearly an hour on an i7 920) make test COMPRESS_ZLIB_RUN_%{?with_long_tests:ALL}%{!?with_long_tests:MOST}=1 @@ -143,7 +210,16 @@ make test COMPRESS_ZLIB_RUN_%{?with_long_tests:ALL}%{!?with_long_tests:MOST}=1 %{_mandir}/man3/IO::Compress::*.3* %{_mandir}/man3/IO::Uncompress::*.3* +%files tests +%{_libexecdir}/%{name} + %changelog +* Mon Mar 01 2021 Jitka Plesnikova - 2.102-2 +- Package tests + +* Sun Feb 28 2021 Paul Howarth - 2.102-1 +- 2.102 bump + * Sat Feb 20 2021 Paul Howarth - 2.101-1 - 2.101 bump 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/sources b/sources index bece405..a765463 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (IO-Compress-2.101.tar.gz) = d5787ed6ecd156a0f0899849ad7bdaa5bd53944cd6acb51ed4a6b5efde86b4a80800391ce8f6fc9004d52daa8efa70b213de57f23d3acb6cc64bd3b9c3246b69 +SHA512 (IO-Compress-2.102.tar.gz) = 1dde4a9c7274106440d8cef2cba016d283472fa8de83a2f51d0acd3acbf36e2130ab1d72f238854228675abdd3653e7830db1ef59af890c3b9acd1e042cab5ea diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..74b0b1d --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-IO-Compress +require: perl-IO-Compress-tests +test: /usr/libexec/perl-IO-Compress/test