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-Archive-Zip.spec b/perl-Archive-Zip.spec index 53b1a60..5050b8a 100644 --- a/perl-Archive-Zip.spec +++ b/perl-Archive-Zip.spec @@ -1,6 +1,6 @@ Name: perl-Archive-Zip Version: 1.68 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Perl library for accessing Zip archives # lib/Archive/Zip/Member.pm: (GPL-1.0-or-later OR Artistic-1.0-Perl) and Info-ZIP # (The _mapPermissionsToUnix() comments are @@ -14,8 +14,8 @@ BuildRequires: coreutils # For a Git binary patch BuildRequires: git-core BuildRequires: make -BuildRequires: perl-interpreter BuildRequires: perl-generators +BuildRequires: perl-interpreter BuildRequires: perl(:VERSION) >= 5.4 BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 @@ -54,6 +54,9 @@ Requires: perl(File::Spec) >= 0.80 # Remove under-specified dependencies %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(File::Spec\\)$ +# Filter modules bundled for tests +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir} +%global __requires_exclude %{__requires_exclude}|^perl\\(common\\) %description The Archive::Zip module allows a Perl program to create, manipulate, @@ -66,6 +69,17 @@ or other attributes queried or modified. Their data can be compressed or uncompressed as needed. Members can be created from members in existing Zip files, or from existing directories, files, or strings. +%package tests +Summary: Tests for %{name} +License: GPL-1.0-or-later OR Artistic-1.0-Perl +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: unzip +Requires: zip + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". %prep %autosetup -S git -n Archive-Zip-%{version} @@ -73,15 +87,38 @@ for F in examples/*.pl; do perl -MExtUtils::MakeMaker -e "ExtUtils::MM_Unix->fixin(q{$F})" done +# 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 NO_PERLLOCAL=1 %{make_build} %install %{make_install} -%{_fixperms} $RPM_BUILD_ROOT/* +%{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t examples %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/bash +set -e +# Some tests write into temporary files/directories. The 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 +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files @@ -90,8 +127,13 @@ make test %{perl_vendorlib}/Archive/ %{_mandir}/man3/Archive*.3* +%files tests +%{_libexecdir}/%{name} %changelog +* Wed Mar 08 2023 Jitka Plesnikova - 1.68-11 +- Package tests + * Thu Jan 19 2023 Fedora Release Engineering - 1.68-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_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..1b77aab --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,5 @@ +summary: Upstream tests +component: perl-Archive-Zip +require: perl-Archive-Zip-tests +test: /usr/libexec/perl-Archive-Zip/test +