# 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-WriteVariants
Version:	0.014
Release:	2.%{__distinit}%{__distvers}
Summary:	Dynamic generation of tests in nested combinations of contexts
License:	GPL-1.0-or-later OR Artistic-1.0-Perl
URL:		https://metacpan.org/dist/Test-WriteVariants
Source0:	https://cpan.metacpan.org/modules/by-module/Test/Test-WriteVariants-%{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(base)
BuildRequires:	perl(Carp)
BuildRequires:	perl(Cwd)
BuildRequires:	perl(Data::Dumper)
BuildRequires:	perl(Data::Tumbler) >= 0.002
BuildRequires:	perl(File::Basename)
BuildRequires:	perl(File::Path)
BuildRequires:	perl(File::Spec)
BuildRequires:	perl(Module::Runtime)
BuildRequires:	perl(Module::Pluggable::Object) >= 4.9
BuildRequires:	perl(strict)
BuildRequires:	perl(warnings)
# Optional Functionality
BuildRequires:	perl(File::Find::Rule) >= 0.34
%if 0%{?fedora} > 21
BuildRequires:	perl(File::Slurper) >= 0.006
%endif
# Test Suite
BuildRequires:	perl(FindBin)
BuildRequires:	perl(Module::Pluggable) >= 4.9
BuildRequires:	perl(Test::Directory) >= 0.041
BuildRequires:	perl(Test::More) >= 0.88
BuildRequires:	perl(Test::Most)
# Dependencies
%if 0%{?fedora} < 38 && 0%{?rhel} < 10
Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%endif
Requires:	perl(Data::Dumper)
Requires:	perl(File::Find::Rule) >= 0.34
%if 0%{?fedora} > 21
Requires:	perl(File::Slurper) >= 0.006
%endif

%description
Dynamic generation of tests in nested combinations of contexts.

%prep
%setup -q -n Test-WriteVariants-%{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

%files
%license ARTISTIC-1.0 GPL-1 LICENSE
%doc Changes README.md
%{perl_vendorlib}/Test/
%{_mandir}/man3/Test::WriteVariants.3*
%{_mandir}/man3/Test::WriteVariants::Context.3*

%changelog
* Sun Jun 25 2023 Paul Howarth <paul@city-fan.org> - 0.014-2
- Use SPDX-format license tag
- Switch upstream from search.cpan.org to metacpan.org
- Use %%license unconditionally

* Wed Aug  2 2017 Paul Howarth <paul@city-fan.org> - 0.014-1
- Update to 0.014
  - Ensure $ENV{} variables are modified before later used modules are
    processed
- BR: perl-generators unconditionally
- BR: perl-interpreter rather than perl

* Sun Jun 18 2017 Paul Howarth <paul@city-fan.org> - 0.013-1
- Update to 0.013
  - Improve tests
  - Add find_input_inline_tests and companion add_test_inline
- 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

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

* Mon Jun 29 2015 Paul Howarth <paul@city-fan.org> - 0.012-2
- Perl 5.22 rebuild

* Fri Mar 27 2015 Paul Howarth <paul@city-fan.org> - 0.012-1
- Update to 0.012
  - Add test-dependency for Test::Most (CPAN RT#101346)
  - Fix meta-data and copy'n'paste errors in Makefile.PL
  - Add sections in POD for Author, Copyright, Bug-Address etc.
  - Relax minimum perl to 5.6
  - Fix spelling (and stopwords in author tests)

* Wed Jan  7 2015 Paul Howarth <paul@city-fan.org> - 0.010-1
- Update to 0.010
  - Fix LICENSE text (CPAN RT#100805)
  - Use base instead of parent - because 5.6 comes with base

* Tue Dec 16 2014 Paul Howarth <paul@city-fan.org> - 0.009-1
- Update to 0.009
  - Add GPL-1 license text as it's fulfilling basic requirements
  - Fix date of 0.008 release in Changes

* Tue Dec  9 2014 Paul Howarth <paul@city-fan.org> - 0.008-1
- Update to 0.008
  - Polish up the Kwalitee of the distribution
  - Add rough description for public context methods
  - Rewrite Changes according to CPAN::Changes::Spec
  - Deploy correct license texts
- This release by REHSACK → update source URL

* Thu Apr  3 2014 Paul Howarth <paul@city-fan.org> - 0.007-1
- Update to 0.007
  - Add more documentation, including full example
- This release by TIMB -> update source URL

* Fri Mar 21 2014 Paul Howarth <paul@city-fan.org> - 0.006-1
- Initial RPM version