From 5fe0516f556178486988e079f83cd28ca5f5f672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 9 Mar 2021 09:55:23 +0100 Subject: [PATCH] Package tests --- perl-App-cpanminus.rpmlintrc | 2 ++ perl-App-cpanminus.spec | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 perl-App-cpanminus.rpmlintrc diff --git a/perl-App-cpanminus.rpmlintrc b/perl-App-cpanminus.rpmlintrc new file mode 100644 index 0000000..3c67f8c --- /dev/null +++ b/perl-App-cpanminus.rpmlintrc @@ -0,0 +1,2 @@ +from Config import * +addFilter("-tests.noarch: W: no-documentation"); diff --git a/perl-App-cpanminus.spec b/perl-App-cpanminus.spec index ced37d4..4d4db23 100644 --- a/perl-App-cpanminus.spec +++ b/perl-App-cpanminus.spec @@ -119,6 +119,15 @@ Why? It's dependency free, requires zero configuration, and stands alone but it's maintainable and extensible with plug-ins and friendly to shell scripting. When running, it requires only 10 MB of RAM. +%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 App-cpanminus-%{version} # Unbundle fat-packed modules @@ -132,6 +141,12 @@ done %patch0 -p1 +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1' "$F" + chmod +x "$F" +done + %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} @@ -139,6 +154,14 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %install %{make_install} %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/bash +cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check make test @@ -151,9 +174,13 @@ make test %{_mandir}/man1/* %{_bindir}/cpanm +%files tests +%{_libexecdir}/%{name} + %changelog * Tue Mar 09 2021 Petr Pisar - 1.7044-12 - Correct an SHA version in a message +- Package tests * Tue Jan 26 2021 Fedora Release Engineering - 1.7044-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild