Reviewed in bug #1957795.
This commit is contained in:
Petr Písař 2021-05-17 17:21:09 +02:00
parent d6a20def6a
commit e6e8e04cfe
3 changed files with 118 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/Syntax-Keyword-Defer-0.05.tar.gz

View File

@ -0,0 +1,116 @@
# Perform optional tests
%bcond_without perl_Syntax_Keyword_Defer_enables_optional_test
Name: perl-Syntax-Keyword-Defer
Version: 0.05
Release: 1%{?dist}
Summary: Add defer block syntax to Perl
License: GPL+ or Artistic
URL: https://metacpan.org/release/Syntax-Keyword-Defer
Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/Syntax-Keyword-Defer-%{version}.tar.gz
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: perl-devel
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(:VERSION) >= 5.14
BuildRequires: perl(ExtUtils::CBuilder)
BuildRequires: perl(Module::Build)
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
BuildRequires: perl(XS::Parse::Keyword::Builder)
# Run-time:
BuildRequires: perl(Carp)
# lib/Syntax/Keyword/Defer.xs includes XSParseKeyword.h generated by
# XS::Parse::Keyword::Builder which loads XS::Parse::Keyword.
BuildRequires: perl(XS::Parse::Keyword)
BuildRequires: perl(XSLoader)
# Tests:
# feature since Perl 5.33.7
BuildRequires: perl(feature)
BuildRequires: perl(Test::More) >= 0.88
%if %{with perl_Syntax_Keyword_Defer_enables_optional_test}
# Optional tests:
BuildRequires: perl(Future)
BuildRequires: perl(Future::AsyncAwait) >= 0.10
BuildRequires: perl(Syntax::Keyword::Try) >= 0.18
BuildRequires: perl(Test::Pod) >= 1.00
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
# lib/Syntax/Keyword/Defer.xs includes XSParseKeyword.h generated by
# XS::Parse::Keyword::Builder which loads XS::Parse::Keyword.
Requires: perl(XS::Parse::Keyword)
# Remove underspecified dependencies
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Test::More\\)$
%description
This Perl module provides a syntax plugin that implements a block which
executes when the containing scope has finished. The "defer" blocks are
primarily intended for cases such as resource finalization tasks that may be
conditionally required.
%package tests
Summary: Tests for %{name}
BuildArch: noarch
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: perl(feature)
Requires: perl(Test::More) >= 0.88
%if %{with perl_Syntax_Keyword_Defer_enables_optional_test}
Requires: perl(Future)
Requires: perl(Future::AsyncAwait) >= 0.10
Requires: perl(Syntax::Keyword::Try) >= 0.18
%endif
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Syntax-Keyword-Defer-%{version}
%if !%{with perl_Syntax_Keyword_Defer_enables_optional_test}
for F in t/80await+defer.t t/80defer+SKT.t t/99pod.t; do
rm "$F"
perl -i -ne 'print $_ unless m{\A\Q'"$F"'\E\b}' MANIFEST
done
%endif
chmod +x t/*.t
%build
perl Build.PL --installdirs=vendor --optimize="$RPM_OPT_FLAGS"
./Build
%install
./Build install --destdir=%{buildroot} --create_packlist=0
find %{buildroot} -type f -name '*.bs' -size 0 -delete
%{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
%if %{with perl_Syntax_Keyword_Defer_enables_optional_test}
rm %{buildroot}%{_libexecdir}/%{name}/t/99pod.t
%endif
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/sh
cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
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}')
./Build test
%files
%license LICENSE
%doc Changes README
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/Syntax*
%{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog
* Thu May 06 2021 Petr Pisar <ppisar@redhat.com> 0.05-1
- Specfile autogenerated by cpanspec 1.78.

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (Syntax-Keyword-Defer-0.05.tar.gz) = 1a9a549467e5129afbadc4cb80b38afbcc37e9a7975c29fd5dc5a63105a958a1825665d8460b274dac76a56043ba22b5977efd9d8209413f72fb8700b1afb854