Patch to handle empty strings with libxml2 2.9.12 (#1961070)

This commit is contained in:
Emmanuel Seyman 2021-06-14 18:14:03 +02:00
parent 268c521776
commit 13fca0f326
2 changed files with 26 additions and 9 deletions

View File

@ -0,0 +1,14 @@
diff -up ./lib/HTML/TreeBuilder/LibXML/Node.pm.orig ./lib/HTML/TreeBuilder/LibXML/Node.pm
--- ./lib/HTML/TreeBuilder/LibXML/Node.pm.orig 2021-06-14 17:00:06.781971373 +0200
+++ ./lib/HTML/TreeBuilder/LibXML/Node.pm 2021-06-14 17:02:22.456482166 +0200
@@ -74,7 +74,8 @@ sub as_HTML {
{
local $@; # protect existing $@
my $output = eval { $_[0]->{node}->toStringC14N(1) };
- return $@ ? $_[0]->{node}->toString : $output;
+ return $_[0]->{node}->toString if ($@ or $output eq '');
+ return $output;
}
}
diff -up ./t/05_empty.t.orig ./t/05_empty.t

View File

@ -1,10 +1,11 @@
Name: perl-HTML-TreeBuilder-LibXML
Version: 0.26
Release: 20%{?dist}
Release: 21%{?dist}
Summary: HTML::TreeBuilder and XPath compatible interface with libxml
License: GPL+ or Artistic
URL: https://metacpan.org/release/HTML-TreeBuilder-LibXML
Source0: https://cpan.metacpan.org/authors/id/T/TO/TOKUHIROM/HTML-TreeBuilder-LibXML-%{version}.tar.gz
Patch0: HTML-TreeBuilder-LibXML-0.26-empty-string-test.patch
BuildArch: noarch
BuildRequires: perl-generators
@ -18,13 +19,7 @@ BuildRequires: perl(Test::Exception)
BuildRequires: perl(Test::More) >= 0.98
BuildRequires: perl(XML::LibXML) >= 1.7
# perl-Web-Scraper requires HTML::TreeBuilder::LibXML so don't pull
# in this optional test requirement when bootstrapping (#982293)
%if 0%{!?perl_bootstrap:1}
BuildRequires: perl(Web::Scraper)
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl(:MODULE_COMPAT_%(eval "`/usr/bin/perl -V:version`"; echo $version))
# not picked up by rpm deptracker
Requires: perl(HTML::TreeBuilder::XPath) >= 0.14
Requires: perl(XML::LibXML) >= 1.7
@ -39,9 +34,10 @@ HTML::TreeBuilder::LibXML is drop-in-replacement for HTML::TreeBuilder::XPath.
%prep
%setup -q -n HTML-TreeBuilder-LibXML-%{version}
%patch0
%build
%{__perl} Build.PL --installdirs=vendor
/usr/bin/perl Build.PL --installdirs=vendor
./Build
%install
@ -54,10 +50,17 @@ HTML::TreeBuilder::LibXML is drop-in-replacement for HTML::TreeBuilder::XPath.
%files
%doc Changes README.md
%license LICENSE
%{perl_vendorlib}/HTML*
%{_mandir}/man3/HTML*
%changelog
* Mon Jun 14 2021 Emmanuel Seyman <emmanuel@seyman.fr> - 0.26-21
- Patch to handle empty strings with libxml2 2.9.12 (#1961070)
- Remove the build requirement on perl(Web::Scraper) for now
- Replace calls to %%{__perl} with /usr/bin/perl
- Use %%license tag
* Mon May 24 2021 Jitka Plesnikova <jplesnik@redhat.com> - 0.26-20
- Perl 5.34 re-rebuild of bootstrapped packages