# 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-CheckDeps
Summary:	Check for presence of dependencies
Version:	0.010
Release:	37.%{__distinit}%{__distvers}
License:	GPL-1.0-or-later OR Artistic-1.0-Perl
URL:		https://metacpan.org/release/Test-CheckDeps
Source0:	https://cpan.metacpan.org/modules/by-module/Test/Test-CheckDeps-%{version}.tar.gz
BuildArch:	noarch
# Build
BuildRequires:	coreutils
BuildRequires:	findutils
BuildRequires:	make
BuildRequires:	perl-generators
BuildRequires:	perl-interpreter
BuildRequires:	perl(ExtUtils::MakeMaker) >= 6.30
# Module
BuildRequires:	perl(CPAN::Meta) >= 2.120920
BuildRequires:	perl(CPAN::Meta::Check) >= 0.007
BuildRequires:	perl(Exporter) >= 5.57
BuildRequires:	perl(List::Util)
BuildRequires:	perl(Test::Builder) >= 0.82
# Test Suite
BuildRequires:	perl(blib)
BuildRequires:	perl(File::Spec)
BuildRequires:	perl(IO::Handle)
BuildRequires:	perl(IPC::Open3)
BuildRequires:	perl(Test::More) >= 0.88
# Release tests
BuildRequires:	perl(Pod::Coverage::TrustPod)
BuildRequires:	perl(Test::Pod) >= 1.41
BuildRequires:	perl(Test::Pod::Coverage) >= 1.08
# Dependencies
%if 0%{?fedora} < 38 && 0%{?rhel} < 10
Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%endif

%description
This module adds a test that assures all dependencies have been installed
properly. If requested, it can bail out all testing on error.

%prep
%setup -q -n Test-CheckDeps-%{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 RELEASE_TESTING=1

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

%changelog
* Tue May 23 2023 Paul Howarth <paul@city-fan.org> - 0.010-37
- Use SPDX-format license tag
- Use %%license unconditionally

* Tue Mar 10 2020 Paul Howarth <paul@city-fan.org> - 0.010-25
- BR: perl(blib) for t/00-compile.t

* Wed Jun  5 2019 Paul Howarth <paul@city-fan.org> - 0.010-21
- Perl 5.30 rebuild

* Wed Apr 11 2018 Paul Howarth <paul@city-fan.org> - 0.010-15
- 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
  - Drop workaround for building with Test::More < 0.88

* Thu Sep 29 2016 Paul Howarth <paul@city-fan.org> - 0.010-10
- BR: perl-generators where available
- Simplify find command using -delete

* Thu Sep 11 2014 Paul Howarth <paul@city-fan.org> - 0.010-3
- Use %%license where possible

* Wed Oct  9 2013 Paul Howarth <paul@city-fan.org> - 0.010-1
- Update to 0.010
  - Added Synopsis
  - $Test::Builder::Level increased, so failing tests appear to come from the
    .t file rather than Test/CheckDeps.pm
  - Also test 'develop' prereqs when AUTHOR_TESTING
- Update old Test::More patch

* Thu Sep 26 2013 Paul Howarth <paul@city-fan.org> - 0.008-1
- Update to 0.008
  - Switch to MakeMaker to fix bootstrapping issues
- Update old Test::More patch

* Thu Sep 19 2013 Paul Howarth <paul@city-fan.org> - 0.007-1
- Update to 0.007
  - Require CPAN::Meta::Check ≥ 0.007, for conflicts fixes
- Bump Module::Build::Tiny version requirement to 0.027
- BR: perl(IO::Handle) and perl(IPC::Open3) rather than
  perl(File::Temp) for the test suite
- Update old Test::More patch
- Drop %%defattr, redundant since rpm 4.4

* Mon Jul 22 2013 Paul Howarth <paul@city-fan.org> - 0.006-2
- Perl 5.18 rebuild

* Fri Jun 21 2013 Paul Howarth <paul@city-fan.org> - 0.006-1
- Update to 0.006
  - Require CPAN::Meta::Check ≥ 0.004
  - Explicitly require CPAN::Meta ≥ 2.120920
  - Switch to Module::Build::Tiny
- Update old Test::More patch
- Drop old ExtUtils::MakeMaker patch

* Wed May 15 2013 Paul Howarth <paul@city-fan.org> - 0.004-1
- Update to 0.004
  - Sort dependencies before displaying them
  - check_dependencies() can now optionally also test recommended and suggested
    prerequisites
  - Reinstate loading of CPAN::Meta
- Kwalitee test dropped upstream to avoid circular deps, so longer need to
  BR: perl(Test::Kwalitee)
- No longer need perl(Module::Metadata)
- Update patches
- Bump perl(Test::Builder) version requirement to 0.82 for todo_start/todo_end

* Sat Apr 27 2013 Paul Howarth <paul@city-fan.org> - 0.002-1
- Initial RPM version