# 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-XML-Rules Summary: Parse XML and specify what and how to keep/process for individual tags Version: 1.16 Release: 30.%{__distinit}%{__distvers} License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/dist/XML-Rules Source0: https://cpan.metacpan.org/modules/by-module/XML/XML-Rules-%{version}.tar.gz Patch0: XML-Rules-1.15-shellbang.patch BuildArch: noarch # Module Build BuildRequires: coreutils BuildRequires: findutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: perl(Module::Build) BuildRequires: sed # Module Runtime BuildRequires: perl(Carp) BuildRequires: perl(constant) BuildRequires: perl(Data::Dumper) BuildRequires: perl(Exporter) BuildRequires: perl(Scalar::Util) BuildRequires: perl(strict) BuildRequires: perl(warnings) BuildRequires: perl(XML::Parser) >= 2.00 BuildRequires: perl(XML::Parser::Expat) >= 2.00 # Test Suite BuildRequires: perl(Encode) BuildRequires: perl(File::Spec) BuildRequires: perl(Test::More) BuildRequires: perl(utf8) # Optional Tests BuildRequires: perl(Test::Pod) >= 1.14 BuildRequires: perl(Test::Pod::Coverage) >= 1.04 # Optional test dependency XML::DTDParser not wanted for Perl 5.18+ as the associated test fails %if 0%{?fedora} < 20 && 0%{?rhel} < 8 BuildRequires: perl(XML::DTDParser) >= 2.00 %endif # Dependencies %if 0%{?fedora} < 38 && 0%{?rhel} < 10 Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) %endif %description This is yet another XML module built on top of XML::Parser:Expat. It allows you to specify "rules", subroutines to be run once a tag is fully parsed and either process the data from the tag itself and its children or specify what parts of the data and how to add to the data structure being built for the parent tag. You may look at this either as a XML::Simple on steroids, a way to build a more customized data structure out of your XML or as yet another event-based XML parser that differs from the rest in that it handles building the structure(s) containing the needed data for you, simplifying the callbacks. %prep %setup -q -n XML-Rules-%{version} # Add shellbangs to scripts %patch -P 0 # Fix line endings sed -i -e 's/\r$//' bin/{dtd,xml}2XMLRules.pl Changes README LICENSE %build perl Build.PL --installdirs=vendor ./Build %install ./Build install --destdir=%{buildroot} --create_packlist=0 %{_fixperms} -c %{buildroot} %check ./Build test %files %license LICENSE %doc Changes README %{_bindir}/dtd2XMLRules.pl %{_bindir}/xml2XMLRules.pl %{perl_vendorlib}/XML/ %{_mandir}/man3/XML::Rules.3* %changelog * Thu Jun 22 2023 Paul Howarth - 1.16-30 - Use SPDX-format license tag - Switch upstream from search.cpan.org to metacpan.org - Avoid use of deprecated patch syntax - Use %%license unconditionally * Thu Mar 29 2018 Paul Howarth - 1.16-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 * Mon Oct 17 2016 Paul Howarth - 1.16-11 - Fix FTBFS when perl is not in the minimal buildroot - Classify buildreqs by usage * Mon Sep 1 2014 Paul Howarth - 1.16-6 - Drop %%defattr, redundant since rpm 4.4 - Use %%license where possible * Thu Jul 25 2013 Paul Howarth - 1.16-2 - Drop optional test dependency XML::DTDParser for Perl 5.18+ as the associated test (t/12-infer_from_DTD.t) fails * Fri Dec 14 2012 Paul Howarth - 1.16-1 - Update to 1.16 - Added default method name to use statement handling - InferRulesFromXxx now sort tags alphabetically, necessary for the tests to work across Perl versions * Wed Dec 12 2012 Paul Howarth - 1.15-1 - Update to 1.15 - Added imports and ability to call methods as class methods to get a subroutine reference - Added inferRules as a use statement parameter - Update shellbang patch * Sun Oct 21 2012 Paul Howarth - 1.14-1 - Update to 1.14 - Removed forgotten debug print and Data::Dump dependency in a test - Drop BR: perl(Data::Dump) * Thu Oct 11 2012 Paul Howarth - 1.13-1 - Update to 1.13 - Fixed dependency on XML::DTDParser in tests * Wed Oct 10 2012 Paul Howarth - 1.12-1 - Update to 1.12 - Added support for chunk processing - Added remove() and only() attribute filters - BR: perl(Data::Dump) and perl(XML::DTDParser) * Sat Jun 30 2012 Paul Howarth - 1.10-8 - BR: perl(Data::Dumper), perl(Encode) and perl(File::Spec) - Drop support for old distributions prior to FC-3: - Don't need to define %%{perl_vendorlib} - Don't need to run test suite with LC_ALL=C * Tue Feb 14 2012 Paul Howarth - 1.10-1 - Initial RPM version