From efbb3a8eb3802d92c035456ce032f34bb03d6252 Mon Sep 17 00:00:00 2001 From: yuanhui Date: Fri, 14 Apr 2023 09:48:52 +0800 Subject: [PATCH] Optimize the spec file Signed-off-by: yuanhui --- perl-HTML-Parser.spec | 109 ++++++++++++------------------------------ 1 file changed, 31 insertions(+), 78 deletions(-) diff --git a/perl-HTML-Parser.spec b/perl-HTML-Parser.spec index da19730..8769f14 100644 --- a/perl-HTML-Parser.spec +++ b/perl-HTML-Parser.spec @@ -1,58 +1,38 @@ -%define anolis_release 2 +%define anolis_release 3 + +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(HTML::Tagset\\)$ + Name: perl-HTML-Parser -Summary: Perl module for parsing HTML Version: 3.81 Release: %{anolis_release}%{?dist} License: GPL-1.0-or-later OR Artistic-1.0-Perl -Source0: https://cpan.metacpan.org/authors/id/O/OA/OALDERS/HTML-Parser-%{version}.tar.gz +Summary: Perl module for parsing HTML URL: https://metacpan.org/release/HTML-Parser -BuildRequires: coreutils -BuildRequires: findutils -BuildRequires: gcc -BuildRequires: glibc-common -BuildRequires: make -BuildRequires: perl-devel -BuildRequires: perl-generators -BuildRequires: perl-interpreter -BuildRequires: perl(Config) -BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 -BuildRequires: perl(strict) -BuildRequires: perl(warnings) -# Run-time -BuildRequires: perl(Carp) -BuildRequires: perl(Exporter) -BuildRequires: perl(HTML::Tagset) >= 3 -BuildRequires: perl(HTTP::Headers) -BuildRequires: perl(IO::File) -BuildRequires: perl(URI) -BuildRequires: perl(XSLoader) +Source0: https://cpan.metacpan.org/authors/id/O/OA/OALDERS/HTML-Parser-%{version}.tar.gz + +BuildRequires: make coreutils findutils gcc glibc-common +BuildRequires: perl-devel perl-generators perl-interpreter +BuildRequires: perl(URI) perl(Carp) perl(XSLoader) perl(IO::File) +BuildRequires: perl(HTTP::Headers) perl(HTML::Tagset) >= 3 perl(Exporter) +BuildRequires: perl(Config) perl(strict) perl(warnings) perl(ExtUtils::MakeMaker) >= 6.76 # Tests -BuildRequires: perl(File::Spec) -BuildRequires: perl(FileHandle) -BuildRequires: perl(SelectSaver) -BuildRequires: perl(Test::More) -BuildRequires: perl(threads) -Requires: perl(HTML::Tagset) >= 3 -Requires: perl(HTTP::Headers) -Requires: perl(IO::File) -Requires: perl(URI) +BuildRequires: perl(SelectSaver) perl(Test::More) perl(threads) perl(File::Spec) perl(FileHandle) + +Requires: perl(IO::File) perl(HTTP::Headers) perl(HTML::Tagset) >= 3 perl(URI) +Obsoletes: %{name}-tests < %{EVR} %{?perl_default_filter} -%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(HTML::Tagset\\)$ %description -The HTML-Parser module for perl to parse and extract information from -HTML documents, including the HTML::Entities, HTML::HeadParser, -HTML::LinkExtor, HTML::PullParser, and HTML::TokeParser modules. +Objects of the HTML::Parser class will recognize markup and separate it from plain +text (alias data content) in HTML documents. As different kinds of markup and text +are recognized, the corresponding event handlers are invoked. -%package tests -Summary: Tests for %{name} -Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} -Requires: perl-Test-Harness - -%description tests -Tests from %{name}. Execute them -with "%{_libexecdir}/%{name}/test". +HTML::Parser is not a generic SGML parser. We have tried to make it able to deal with +the HTML that is actually "out there", and it normally parses as closely as possible +to the way the popular web browsers do it instead of strictly following one of the +many HTML specifications from W3C. Where there is disagreement, there is often an option +that you can enable to get the official behaviour. %package doc Summary: Documentation files for %{name} @@ -63,63 +43,36 @@ BuildArch: noarch The %{name}-doc package contains documentation files for %{name}. %prep -%setup -q -n HTML-Parser-%{version} +%autosetup -n HTML-Parser-%{version} -p1 chmod -c a-x eg/* -# Help file to recognise the Perl scripts and normalize shebangs -for F in t/*.t; do - perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" - chmod +x "$F" -done - %build perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1 NO_PERLLOCAL=1 %{make_build} %install %{make_install} -file=%{buildroot}%{_mandir}/man3/HTML::Entities.3pm -iconv -f iso-8859-1 -t utf-8 <"$file" > "${file}_" && \ - touch -r ${file} ${file}_ && \ - mv -f "${file}_" "$file" find %{buildroot} -type f -name '*.bs' -empty -delete %{_fixperms} %{buildroot}/* -# Install tests -mkdir -p %{buildroot}/%{_libexecdir}/%{name} -cp -a t %{buildroot}/%{_libexecdir}/%{name} -cat > %{buildroot}/%{_libexecdir}/%{name}/test << 'EOF' -#!/bin/bash -set -e -# Some tests write into temporary files/directories. The easiest solution -# is to copy the tests into a writable directory and execute them from there. -DIR=$(mktemp -d) -pushd "$DIR" -cp -a %{_libexecdir}/%{name}/* ./ -prove -I . -j "$(getconf _NPROCESSORS_ONLN)" -popd -rm -rf "$DIR" -EOF -chmod +x %{buildroot}/%{_libexecdir}/%{name}/test - %check export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files %license LICENSE -%doc eg/ -%{perl_vendorarch}/HTML/ %{perl_vendorarch}/auto/HTML/ +%{perl_vendorarch}/HTML/ %{_mandir}/man3/*.3pm* -%files tests -%{_libexecdir}/%{name} - %files doc -%doc Changes README TODO +%doc eg/ +%doc README Changes TODO %changelog +* Fri Apr 14 2023 yuanhui - 3.81-3 +- Optimize the spec file + * Wed Feb 08 2023 mgb01105731 - 3.81-2 - remove versioned MODULE_COMPAT_ requires -- Gitee