perl-Syntax-Operator-Divides/perl-Syntax-Operator-Divides.spec
Petr Písař 6c75c2f82a Import
Reviewed in bug #2017689.
2021-11-11 15:51:58 +01:00

119 lines
3.6 KiB
RPMSpec

# Perform optional tests
%bcond_without perl_Syntax_Operator_Divides_enables_optional_test
# Bootstrap until perl-Syntax-Keyword-Match is packaged
%define perl_bootstrap 1
# A build cycle: perl-Syntax-Operator-Divides → perl-Syntax-Keyword-Match.spec
%if %{with perl_Syntax_Operator_Divides_enables_optional_test} && !%{defined perl_bootstrap}
%global optional_tests 1
%else
%global optional_tests 0
%endif
Name: perl-Syntax-Operator-Divides
Version: 0.01
Release: 1%{?dist}
Summary: Infix operator for division test
License: GPL+ or Artistic
URL: https://metacpan.org/release/Syntax-Operator-Divides
Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/Syntax-Operator-Divides-%{version}.tar.gz
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: perl-devel
BuildRequires: perl-generators
BuildRequires: perl-interpreter
# Version from Build.PL for pad_alloc() used in Divides.xs
BuildRequires: perl(:VERSION) >= 5.16
BuildRequires: perl(ExtUtils::CBuilder)
BuildRequires: perl(Module::Build)
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
BuildRequires: perl(XS::Parse::Infix::Builder)
# Run-time:
BuildRequires: perl(Carp)
BuildRequires: perl(XSLoader)
# Tests:
BuildRequires: perl(Test::More) >= 0.88
%if %{optional_tests}
# Optional tests:
BuildRequires: perl(Syntax::Keyword::Match) >= 0.08
BuildRequires: perl(Test::Pod) >= 1.00
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%if %{defined perl_XS_Parse_Infix_ABI}
# XS::Parse::Infix ABI checked in XSParseInfix.h generated by
# XS::Parse::Infix::Builder.
Requires: %{perl_XS_Parse_Infix_ABI}
%endif
# Filter under-specified dependencies
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Test::More\\)$
%description
This module provides an infix operator that implements an integer divides
test which returns true if the lefthand operand is a whole multiple of the
righthand.
%package tests
Summary: Tests for %{name}
BuildArch: noarch
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: perl(Test::More) >= 0.88
%if %{optional_tests}
Requires: perl(Syntax::Keyword::Match) >= 0.08
%endif
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Syntax-Operator-Divides-%{version}
%if !%{optional_tests}
for T in t/80match-divides.t t/99pod.t; do
rm "$T"
perl -i -ne 'print $_ unless m{^\Q'"$T"'\E}' 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 %{optional_tests}
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
* Wed Oct 27 2021 Petr Pisar <ppisar@redhat.com> 0.01-1
- Specfile autogenerated by cpanspec 1.78.