# 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-Parse-Distname Version: 0.05 Release: 5.%{__distinit}%{__distvers} Summary: Parse a distribution name License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/dist/Parse-Distname Source0: https://cpan.metacpan.org/modules/by-module/Parse/Parse-Distname-%{version}.tar.gz BuildArch: noarch # Module Build BuildRequires: coreutils BuildRequires: findutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: perl(ExtUtils::MakeMaker::CPANfile) >= 0.08 # Module Runtime BuildRequires: perl(Carp) BuildRequires: perl(Exporter) >= 5.57 BuildRequires: perl(strict) BuildRequires: perl(warnings) # Test Suite BuildRequires: perl(JSON::PP) BuildRequires: perl(Test::Differences) BuildRequires: perl(Test::More) >= 0.88 BuildRequires: perl(Test::UseAllModules) >= 0.17 # Dependencies %if 0%{?fedora} < 38 && 0%{?rhel} < 10 Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) %endif %description Parse::Distname is yet another distribution name parser. It works almost the same as CPAN::DistnameInfo, but Parse::Distname takes a different approach. It tries to extract the version part of a distribution and treat the rest as a distribution name, contrary to CPAN::DistnameInfo which tries to define a name part and treat the rest as a version. Because of this difference, when Parse::Distname parses a weird distribution name such as "AUTHOR/v1.0.tar.gz", it says the name is empty and the version is "v1.0", while CPAN::DistnameInfo says the name is "v" and the version is "1.0". See test files in this distribution if you need more details. As of this writing, Parse::Distname returns a different result for about 200+ distributions among about 320000 BackPan distributions. %prep %setup -q -n Parse-Distname-%{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 README %{perl_vendorlib}/Parse/ %{_mandir}/man3/Parse::Distname.3* %changelog * Tue May 9 2023 Paul Howarth - 0.05-5 - Use SPDX-format license tag * Thu Apr 28 2022 Paul Howarth - 0.05-2 - Incorporate feedback from package review (#2073377) - perl(strict) is a run-time dependency, not just a test dependency - Don't package the tests as documentation * Fri Apr 8 2022 Paul Howarth - 0.05-1 - Initial RPM version