Sync from SUSE:SLFO:Main perl-XML-SAX revision 14d739d8fe4b8795a17a86aa453a5cc4

This commit is contained in:
Adrian Schröter 2024-05-03 19:10:35 +02:00
commit 492d27557a
6 changed files with 307 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
XML-SAX-1.02.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

30
cpanspec.yml Normal file
View File

@ -0,0 +1,30 @@
---
#description_paragraphs: 3
#description: |-
# override description from CPAN
#summary: override summary from CPAN
#no_testing: broken upstream
#sources:
# - source1
# - source2
patches:
perl-XML-SAX-0.96-utf8.diff: -p0
preamble: |-
%post
perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::PurePerl))->save_parsers()"
#post_prep: |-
# hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'`
# sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL
#post_build: |-
# rm unused.files
post_install: |-
touch %{buildroot}%{perl_vendorlib}/XML/SAX/ParserDetails.ini
echo "%ghost %{perl_vendorlib}/XML/SAX/ParserDetails.ini" >> perl-XML-SAX.files
#license: SUSE-NonFree
#skip_noarch: 1
#custom_build: |-
#./Build build flags=%{?_smp_mflags} --myflag
#custom_test: |-
#startserver && make test
#ignore_requires: Bizarre::Module

View File

@ -0,0 +1,57 @@
--- lib/XML/SAX/PurePerl/Reader/Stream.pm
+++ lib/XML/SAX/PurePerl/Reader/Stream.pm
@@ -70,6 +70,54 @@
my $self = shift;
my ($encoding) = @_;
# warn("set encoding to: $encoding\n");
+
+ # make sure that the buffer used to detect the encoding
+ # does not end in the middle of a utf8 sequence
+ if ($encoding eq 'UTF-8' &&
+ !$self->[EOF] &&
+ !utf8::is_utf8($self->[BUFFER]) && # make sure we do not do it twice
+ length($self->[BUFFER]) > 5) {
+
+ my $x = reverse(substr($self->[BUFFER], -5));
+ my $y = 0;
+
+ # skip the all the bytes at the end of buffer
+ # starting with bits 10 (continuation bytes of utf8 sequence)
+ while ($x ne "" && (ord($x) & 0xc0) == 0x80) {
+ $y--;
+ $x = substr($x, 1);
+ }
+
+ # if $x is ascii character, do nothing
+ # otherwise we must take a look how many
+ # continuation bytes we need
+ if ((ord($x) & 0xc0) == 0xc0) {
+ $x = ord($x);
+ if (($x & 0xe0) == 0xc0) { # the sequence contains one more byte
+ $y++;
+ } elsif (($x & 0xf0) == 0xe0) { # ...2 bytes
+ $y += 2;
+ } elsif (($x & 0xf8) == 0xf0) { # ...3 bytes
+ $y += 3;
+ } elsif (($x & 0xfc) == 0xf8) { # ...4 bytes
+ $y += 4;
+ } elsif (($x & 0xfe) == 0xfc) { # ...5 bytes
+ $y += 5;
+ }
+
+ # read the last sequence in the buffer completely, if needed
+ if ($y > 0) {
+ my $buf;
+ my $bytesread = read($self->[FH], $buf, $y);
+ if ($bytesread) {
+ $self->[BUFFER] .= $buf;
+ } elsif (defined($bytesread)) {
+ $self->[EOF]++;
+ }
+ }
+ }
+ }
+
XML::SAX::PurePerl::Reader::switch_encoding_stream($self->[FH], $encoding);
XML::SAX::PurePerl::Reader::switch_encoding_string($self->[BUFFER], $encoding);
$self->[ENCODING] = $encoding;

119
perl-XML-SAX.changes Normal file
View File

@ -0,0 +1,119 @@
-------------------------------------------------------------------
Mon Jun 17 14:46:40 UTC 2019 - Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com>
- update to 1.02
see /usr/share/doc/packages/perl-XML-SAX/Changes
1.02 14 Jun 2019 Grant McLean
- Spelling fixes (patch from Ville Skyttä)
- Add repo location to metadata (patches from Ville Skytta & Martin McGrath)
- Reorganise module files under lib/XML
- Regenerate MANIFEST using 'make manifest' to include missing test files
- Updated URL to MetaCPAN
- Rebased perl-XML-SAX-0.96-utf8.diff
-------------------------------------------------------------------
Thu Jul 19 12:07:09 UTC 2018 - coolo@suse.com
- Install a %ghost ParserDetails.ini and add pureperl to it
-------------------------------------------------------------------
Fri Feb 16 07:20:19 UTC 2018 - coolo@suse.com
- updated to 1.00
see /usr/share/doc/packages/perl-XML-SAX/Changes
1.00 15 Feb 2018 Grant McLean
- Add makefile dependency to fix order of build steps RT#62289 (patch from
Ed J)
-------------------------------------------------------------------
Mon Apr 15 10:31:20 UTC 2013 - idonmez@suse.com
- Add Source URL, see https://en.opensuse.org/SourceUrls
-------------------------------------------------------------------
Mon Sep 12 01:35:08 UTC 2011 - vcizek@suse.com
- licence correction to same as Perl
- update to 0.99
- functionally identical to 0.96
- requires XML::SAX::Base (not bundled within since 0.99)
-------------------------------------------------------------------
Wed Dec 1 06:55:47 UTC 2010 - coolo@novell.com
- switch to perl_requires macro
-------------------------------------------------------------------
Mon Nov 29 18:32:29 UTC 2010 - coolo@novell.com
- remove /var/adm/perl-modules
-------------------------------------------------------------------
Sun Jan 10 15:43:32 CET 2010 - jengelh@medozas.de
- enable parallel build
-------------------------------------------------------------------
Thu Jan 15 22:50:00 CET 2009 - anicka@suse.cz
- add patch fixing utf8 parsing (bnc#459794)
-------------------------------------------------------------------
Thu Jan 15 13:35:37 CET 2009 - anicka@suse.cz
- enable testsuite (bnc#466010)
-------------------------------------------------------------------
Wed Sep 10 17:03:21 CEST 2008 - anicka@suse.cz
- update to 0.96
* Fix handling of numeric character entities in attribute
values
* Fix for numeric character entities spanning end of buffer
* Performance fix for parsing from large strings
* Fix for UTF8 bytes in first 4096 bytes of document not being
decoded to Perl-UTF8-characters
* incorrect operator precedence breaks single quotes around
DTD entity declarations
* Fix test in ParserFactory.pm for parser module loaded
* Fix XML::SAX::PurePerl versioning
-------------------------------------------------------------------
Fri Dec 14 15:51:36 CET 2007 - anicka@suse.cz
- update to 0.16
* Applied patch for PI handling from RT#19173
* Fixed handling of entities in attribute values
* Cleaned up some benign warnings
* Fixed CDATA section parsing
* Fix Makefile.PL for VMS
* Support calling set_handler() mid-parse
* Fix for when random modules overload UNIVERSAL::AUTOLOAD()
* Fix case when ParserDetails.ini isn't being updated but
we are doing an upgrade.
* Complete re-write of XML::SAX::PurePerl for performance
* Support Encoding & XMLVersion in DocumentLocator interface
* A few conformance tweaks to match perl SAX 2.1.
-------------------------------------------------------------------
Fri Jun 1 15:49:26 CEST 2007 - coolo@suse.de
- remove libxml2-test from buildrequires
-------------------------------------------------------------------
Wed Jan 25 21:40:04 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Mon Nov 15 15:37:55 CET 2004 - ro@suse.de
- added perl-XML-NamespaceSupport to nfb and requires
-------------------------------------------------------------------
Thu Jul 29 16:17:31 CEST 2004 - ro@suse.de
- initial version 0.12

75
perl-XML-SAX.spec Normal file
View File

@ -0,0 +1,75 @@
#
# spec file for package perl-XML-SAX
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: perl-XML-SAX
Version: 1.02
Release: 0
%define cpan_name XML-SAX
Summary: Simple API for XML
License: GPL-1.0-or-later OR Artistic-1.0
Group: Development/Libraries/Perl
Url: https://metacpan.org/release/XML-SAX
Source0: https://cpan.metacpan.org/authors/id/G/GR/GRANTM/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
Patch0: perl-XML-SAX-0.96-utf8.diff
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(XML::NamespaceSupport) >= 0.03
BuildRequires: perl(XML::SAX::Base) >= 1.05
Requires: perl(XML::NamespaceSupport) >= 0.03
Requires: perl(XML::SAX::Base) >= 1.05
%{perl_requires}
%description
XML::SAX is a SAX parser access API for Perl. It includes classes and APIs
required for implementing SAX drivers, along with a factory class for
returning any SAX parser installed on the user's system.
%prep
%setup -q -n %{cpan_name}-%{version}
%patch0 -p0
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
# MANUAL
touch %{buildroot}%{perl_vendorlib}/XML/SAX/ParserDetails.ini
echo "%ghost %{perl_vendorlib}/XML/SAX/ParserDetails.ini" >> perl-XML-SAX.files
# MANUAL/
%perl_process_packlist
%perl_gen_filelist
# MANUAL BEGIN
%post
perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::PurePerl))->save_parsers()"
# MANUAL END
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README
%license LICENSE
%changelog