diff --git a/cpanspec.yml b/cpanspec.yml index 29bf039..fbabb91 100644 --- a/cpanspec.yml +++ b/cpanspec.yml @@ -4,8 +4,8 @@ #sources: # - source1 # - source2 -#patches: -# foo.patch: -p1 +patches: + fix-05_empty.patch: -p1 PATCH-FIX-UPSTREAM fix 05_empty.t https://github.com/tokuhirom/HTML-TreeBuilder-LibXML/pull/17 # bar.patch: #preamble: |- # BuildRequires: gcc-c++ diff --git a/fix-05_empty.patch b/fix-05_empty.patch new file mode 100644 index 0000000..23c289a --- /dev/null +++ b/fix-05_empty.patch @@ -0,0 +1,24 @@ +From d74d1f186b2e2c6334a78b895b0ea811a16617a4 Mon Sep 17 00:00:00 2001 +From: Emmanuel Seyman +Date: Mon, 14 Jun 2021 21:12:07 +0200 +Subject: [PATCH] fallback to toString() when toStringC14N(1) gives an empty + string + +--- + lib/HTML/TreeBuilder/LibXML/Node.pm | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/HTML/TreeBuilder/LibXML/Node.pm b/lib/HTML/TreeBuilder/LibXML/Node.pm +index f3b4e81..b710dda 100644 +--- a/lib/HTML/TreeBuilder/LibXML/Node.pm ++++ b/lib/HTML/TreeBuilder/LibXML/Node.pm +@@ -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 --git a/perl-HTML-TreeBuilder-LibXML.changes b/perl-HTML-TreeBuilder-LibXML.changes index 7a4d235..68c6bbb 100644 --- a/perl-HTML-TreeBuilder-LibXML.changes +++ b/perl-HTML-TreeBuilder-LibXML.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 9 12:49:16 UTC 2023 - Tina Müller + +- Add fix-05_empty.patch, see + https://github.com/tokuhirom/HTML-TreeBuilder-LibXML/pull/17 + ------------------------------------------------------------------- Fri Oct 21 05:33:57 UTC 2016 - coolo@suse.com diff --git a/perl-HTML-TreeBuilder-LibXML.spec b/perl-HTML-TreeBuilder-LibXML.spec index 70ac7cd..9e424b9 100644 --- a/perl-HTML-TreeBuilder-LibXML.spec +++ b/perl-HTML-TreeBuilder-LibXML.spec @@ -1,7 +1,7 @@ # # spec file for package perl-HTML-TreeBuilder-LibXML # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,22 +12,22 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # +%define cpan_name HTML-TreeBuilder-LibXML Name: perl-HTML-TreeBuilder-LibXML Version: 0.26 Release: 0 -%define cpan_name HTML-TreeBuilder-LibXML +License: Artistic-1.0 OR GPL-1.0-or-later Summary: HTML::TreeBuilder and XPath compatible interface with libxml -License: Artistic-1.0 or GPL-1.0+ -Group: Development/Libraries/Perl -Url: http://search.cpan.org/dist/HTML-TreeBuilder-LibXML/ -Source0: http://www.cpan.org/authors/id/T/TO/TOKUHIROM/%{cpan_name}-%{version}.tar.gz +URL: https://metacpan.org/release/%{cpan_name} +Source0: https://cpan.metacpan.org/authors/id/T/TO/TOKUHIROM/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml +# PATCH-FIX-UPSTREAM fix 05_empty.t https://github.com/tokuhirom/HTML-TreeBuilder-LibXML/pull/17 +Patch0: fix-05_empty.patch BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(HTML::TreeBuilder::XPath) >= 0.14 @@ -54,10 +54,10 @@ This module doesn't implement all of HTML::TreeBuilder and HTML::Element APIs, but enough methods are defined so modules like Web::Scraper work. %prep -%setup -q -n %{cpan_name}-%{version} +%autosetup -n %{cpan_name}-%{version} -p1 %build -%{__perl} Build.PL --installdirs=vendor +perl Build.PL --installdirs=vendor ./Build build --flags=%{?_smp_mflags} %check @@ -68,7 +68,7 @@ APIs, but enough methods are defined so modules like Web::Scraper work. %perl_gen_filelist %files -f %{name}.files -%defattr(-,root,root,755) -%doc Changes LICENSE README.md +%doc Changes README.md +%license LICENSE %changelog