diff --git a/perl-constant.spec b/perl-constant.spec index 52d2021..4943b56 100644 --- a/perl-constant.spec +++ b/perl-constant.spec @@ -9,7 +9,7 @@ Name: perl-constant Version: 1.33 -Release: 491%{?dist} +Release: 492%{?dist} Summary: Perl pragma to declare constants License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/release/constant @@ -17,10 +17,12 @@ Source0: https://cpan.metacpan.org/authors/id/S/SA/SAPER/constant-%{cpan_ # Update to 1.33 Patch0: constant-1.33-update.patch BuildArch: noarch -BuildRequires: make -BuildRequires: perl-interpreter +BuildRequires: coreutils +BuildRequires: make BuildRequires: perl-generators -BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: perl-interpreter +BuildRequires: perl(Config) +BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 BuildRequires: perl(strict) # Run-time: BuildRequires: perl(Carp) @@ -54,28 +56,61 @@ value at compile time, and may then optimize the expression further. In particular, any code in an "if (CONSTANT)" block will be optimized away if the constant is false. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n constant-%{cpan_version} -%patch0 -p1 +%patch -P0 -p1 + +# 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 -make %{?_smp_mflags} +perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 +%{make_build} %install -make pure_install DESTDIR=$RPM_BUILD_ROOT -find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; -%{_fixperms} $RPM_BUILD_ROOT/* +%{make_install} +%{_fixperms} %{buildroot}/* + +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +# Remove author tests +rm %{buildroot}%{_libexecdir}/%{name}/t/more* +rm %{buildroot}%{_libexecdir}/%{name}/t/pod* +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 make test %files %doc Changes eg README -%{perl_vendorlib}/* -%{_mandir}/man3/* +%{perl_vendorlib}/constant* +%{_mandir}/man3/constant* + +%files tests +%{_libexecdir}/%{name} %changelog +* Mon May 22 2023 Jitka Plesnikova - 1.33-492 +- Modernize spec +- Package tests + * Fri Jan 20 2023 Fedora Release Engineering - 1.33-491 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild