# Detect the distribution in use
%global __despace head -n 1 | tr -d '[:space:]' | sed -e 's/[(].*[)]//g'
%global __lower4 cut -c 1-4 | tr '[:upper:]' '[:lower:]'
%global __distfile %([ -f /etc/SuSE-release ] && echo /etc/SuSE-release || echo /etc/redhat-release)
%global __distinit %(sed -e 's/ release .*//' -e 's/\\([A-Za-z]\\)[^ ]*/\\1/g' %{__distfile} | %{__despace} | %{__lower4})
%global __distvers %(sed -e 's/.* release \\([^. ]*\\).*/\\1/' %{__distfile} | %{__despace})
# Identify Alma, CentOS, CentOS Stream and Rocky Linux as rhel
%if "%{__distinit}" == "a" || "%{__distinit}" == "c" || "%{__distinit}" == "cl" || "%{__distinit}" == "cs" || "%{__distinit}" == "rl"
%global __distinit rhel
%endif
# Dist tag for Fedora is still "fc"
%if "%{__distinit}" == "f"
%global __distinit fc
%endif

Name:		perl-Test-UseAllModules
Version:	0.17
Release:	25.%{__distinit}%{__distvers}
Summary:	Do use_ok() for all the MANIFESTed modules
License:	GPL-1.0-or-later OR Artistic-1.0-Perl
URL:		https://metacpan.org/release/Test-UseAllModules
Source0:	https://cpan.metacpan.org/modules/by-module/Test/Test-UseAllModules-%{version}.tar.gz
BuildArch:	noarch
# Build
BuildRequires:	coreutils
BuildRequires:	findutils
BuildRequires:	make
BuildRequires:	perl-generators
BuildRequires:	perl-interpreter
BuildRequires:	perl(ExtUtils::MakeMaker)
# Module
BuildRequires:	perl(Exporter)
BuildRequires:	perl(ExtUtils::Manifest)
BuildRequires:	perl(Test::Builder) >= 0.30
BuildRequires:	perl(Test::More) >= 0.61
# Test Suite
BuildRequires:	perl(FindBin)
BuildRequires:	perl(lib)
# Optional Tests
BuildRequires:	perl(Test::Pod) >= 1.18
BuildRequires:	perl(Test::Pod::Coverage) >= 1.04
# Dependencies
%if 0%{?fedora} < 38 && 0%{?rhel} < 10
Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%endif
Requires:	perl(Test::Builder) >= 0.30

%description
I'm sick of writing 00_load.t (or something like that) that will do use_ok()
for every module I write. I'm sicker of updating 00_load.t when I add
another file to the distribution. This module reads MANIFEST to find modules
to be tested and does use_ok() for each of them. Now all you have to do is
update MANIFEST. You don't have to modify the test any more (hopefully).

%prep
%setup -q -n Test-UseAllModules-%{version}

%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}

%install
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -delete
%{_fixperms} -c %{buildroot}

%check
make test TEST_POD=1

%files
%doc Changes README
%{perl_vendorlib}/Test/
%{_mandir}/man3/Test::UseAllModules.3*

%changelog
* Tue May 30 2023 Paul Howarth <paul@city-fan.org> - 0.17-25
- Use SPDX-format license tag
- Line endings don't need fixing

* Mon Jun  3 2019 Paul Howarth <paul@city-fan.org> - 0.17-13
- Perl 5.30 rebuild

* Thu Apr  5 2018 Paul Howarth <paul@city-fan.org> - 0.17-9
- BR: perl-generators unconditionally
- BR: perl-interpreter rather than perl
- Drop support for EOL distributions prior to F-13
  - Drop BuildRoot: and Group: tags
  - Drop explicit buildroot cleaning in %%install section
  - Drop explicit %%clean section

* Fri Oct  7 2016 Paul Howarth <paul@city-fan.org> - 0.17-5
- BR: perl-generators where available
- Simplify find command using -delete

* Thu Nov 13 2014 Paul Howarth <paul@city-fan.org> - 0.17-1
- Update to 0.17
  - Dropped cpanfile support, as it forced users of this module to update too
    many modules, especially while testing backward compatibility with older
    perls

* Mon Sep  1 2014 Paul Howarth <paul@city-fan.org> - 0.15-2
- Perl 5.20 rebuild

* Mon Jul 14 2014 Paul Howarth <paul@city-fan.org> - 0.15-1
- Update to 0.15
  - Dropped (experimental) Test::More 1.5/2.0 support
- Patch out need for ExtUtils::MakeMaker::CPANfile and use ExtUtils::MakeMaker
  instead

* Fri Aug  2 2013 Paul Howarth <paul@city-fan.org> - 0.14-4
- Import from Fedora

* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 0.14-3
- Perl 5.18 rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Aug 03 2012 Petr Pisar <ppisar@redhat.com> - 0.14-1
- 0.14 bump

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.13-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jun 08 2012 Petr Pisar <ppisar@redhat.com> - 0.13-3
- Perl 5.16 rebuild

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Sep 20 2011 Petr Pisar <ppisar@redhat.com> 0.13-1
- Specfile autogenerated by cpanspec 1.78
- Remove BuildRoot and defattr code
- Recode documentation to UNIX end-of-lines