# 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-Archive-Any
Version:	0.0946
Release:	13.%{__distinit}%{__distvers}
Summary:	Single interface to deal with file archives
License:	GPL-1.0-or-later OR Artistic-1.0-Perl
URL:		https://metacpan.org/release/Archive-Any
Source0:	https://cpan.metacpan.org/modules/by-module/Archive/Archive-Any-%{version}.tar.gz
BuildArch:	noarch
# Module Build
BuildRequires:	coreutils
BuildRequires:	findutils
BuildRequires:	make
BuildRequires:	perl-generators
BuildRequires:	perl-interpreter
BuildRequires:	perl(ExtUtils::MakeMaker)
# Module Runtime
BuildRequires:	perl(Archive::Tar)
BuildRequires:	perl(Archive::Zip)
BuildRequires:	perl(base)
BuildRequires:	perl(Cwd)
BuildRequires:	perl(File::MMagic)
BuildRequires:	perl(File::Spec::Functions)
BuildRequires:	perl(MIME::Types)
BuildRequires:	perl(Module::Find)
BuildRequires:	perl(strict)
BuildRequires:	perl(warnings)
# Test Suite
BuildRequires:	perl(File::Spec)
BuildRequires:	perl(Test::More)
BuildRequires:	perl(Test::Warn)
# Optional Tests
BuildRequires:	perl(CPAN::Meta) >= 2.120900
# Runtime
%if 0%{?fedora} < 38 && 0%{?rhel} < 10
Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%endif

%description
This module is a single interface for manipulating different archive
formats. Tarballs, zip files, etc.

%prep
%setup -q -n Archive-Any-%{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 LICENSE
%doc Changes CONTRIBUTORS README.md
%{perl_vendorlib}/Archive/
%{_mandir}/man3/Archive::Any.3*
%{_mandir}/man3/Archive::Any::Plugin.3*
%{_mandir}/man3/Archive::Any::Plugin::Tar.3*
%{_mandir}/man3/Archive::Any::Plugin::Zip.3*
%{_mandir}/man3/Archive::Any::Tar.3*
%{_mandir}/man3/Archive::Any::Zip.3*

%changelog
* Tue Mar  7 2023 Paul Howarth <paul@city-fan.org> - 0.0946-13
- Use SPDX-format license tag
- Use %%license unconditionally

* Sun Jun  9 2019 Paul Howarth <paul@city-fan.org> - 0.0946-2
- Perl 5.30 rebuild

* Sat Apr  6 2019 Paul Howarth <paul@city-fan.org> - 0.0946-1
- Update to 0.0946
  - Added copyright holder/year meta to dist.ini (GH#6)
  - Auto generate META.yml using the plugin [MetaYAML] (GH#8)
- 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
- BR: perl-generators unconditionally
- BR: perl-interpreter rather than perl
- Switch upstream from search.cpan.org to metacpan.org
- Upstream renamed README as README.md

* Thu Aug  4 2016 Paul Howarth <paul@city-fan.org> - 0.0945-2
- BR: perl-generators where available

* Tue May  3 2016 Paul Howarth <paul@city-fan.org> - 0.0945-1
- Update to 0.0945
  - Use 'base' rather than @ISA in Zip.pm

* Sat Apr  2 2016 Paul Howarth <paul@city-fan.org> - 0.0944-1
- Update to 0.0944
  - Use 'base' rather than @ISA
  - Use warnings in more modules
- Simplify find command using -delete

* Thu Jan 29 2015 Paul Howarth <paul@city-fan.org> - 0.0942-1
- Update to 0.0942
  - Replace contents of archives in test folder with random noise in order to
    avoid any licensing issues
- Classify buildreqs by usage

* Wed Sep 10 2014 Paul Howarth <paul@city-fan.org> - 0.0941-3
- Drop patches supporting building with old distributions prior to FC-5
- Drop %%defattr, redundant since rpm 4.4
- Use %%license where possible

* Thu Nov  7 2013 Paul Howarth <paul@city-fan.org> - 0.0941-1
- Update to 0.0941
  - Fixes version number in lib/Archive/Any.pm
  - Previous release had broken permissions

* Fri Oct 18 2013 Paul Howarth <paul@city-fan.org> - 0.0940-1
- Update to 0.0940
  - Adds x-bzip2 (CPAN RT#67738)
  - Migrated to Dist::Zilla
- Package new CONTRIBUTORS and LICENSE files
- This release by OALDERS -> update source URL
- Add patch to fix module version number
- Add patch to support building with ExtUtils::MakeMaker < 6.30
- Update old Makefile patch
- Drop now-redundant build requirements

* Mon Jul  9 2012 Paul Howarth <paul@city-fan.org> - 0.0932-10
- BR: perl(base)
- Don't need to remove empty directories from the buildroot
- Drop support for old distributions prior to FC-3:
  - Don't need to define %%{perl_vendorlib}
  - Use DESTDIR rather than PERL_INSTALL_ROOT

* Tue Jun 21 2011 Paul Howarth <paul@city-fan.org> - 0.0932-8
- Rebuild for perl 5.14.1 in Rawhide
- Nobody else likes macros for commands
- Fix dist tag for CentOS 6 and Scientific Linux

* Tue Mar 15 2011 Paul Howarth <paul@city-fan.org> - 0.0932-7
- Import from Fedora

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0932-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Dec 15 2010 Marcela Maslanova <mmaslano@redhat.com> - 0.0932-5
- Rebuild to fix problems with vendorarch/lib (#661697)

* Thu Apr 29 2010 Marcela Maslanova <mmaslano@redhat.com> - 0.0932-4
- Mass rebuild with perl-5.12.0

* Mon Dec  7 2009 Stepan Kasal <skasal@redhat.com> - 0.0932-3
- Rebuild against perl 5.10.1

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0932-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sun Jun 07 2009 Chris Weyl <cweyl@alumni.drew.edu> 0.0932-1
- Auto-update to 0.0932 (by cpan-spec-update 0.01)
- Altered br on perl(Test::More) (0 => 0.4)

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.093-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Fri Feb 08 2008 Tom "spot" Callaway <tcallawa@redhat.com> 0.093-3
- Rebuild for new perl

* Wed May 09 2007 Chris Weyl <cweyl@alumni.drew.edu> 0.093-2
- Bump

* Sat May 05 2007 Chris Weyl <cweyl@alumni.drew.edu> 0.093-1
- Specfile autogenerated by cpanspec 1.71