Accepting request 244840 from home:weberho:BACKPORTS:webserver

- Updated to version 1.04
  * add --use-xs option to command-line script
  * fix -v alias for --version option
  * add support for loading/using XS implementation layer
  * repackage using dzil
- Dropped patch from jw@novell.com as those were rejected upstream

OBS-URL: https://build.opensuse.org/request/show/244840
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Encoding-FixLatin?expand=0&rev=3
This commit is contained in:
Darin Perusich
2014-08-22 12:52:11 +00:00
committed by Git OBS Bridge
parent e066381296
commit f5577ecc0a
5 changed files with 44 additions and 148 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b3761d9c4f47cce5e3f86a753eceb68435aeb1fa9b8bee5eeb1aebcd6a13380b
size 26102

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:da072e5b1c5f66567a2d106bb9c80a166c054527c32350e149a09a5d3f4e8b78
size 16445

View File

@@ -1,117 +0,0 @@
--- Encoding-FixLatin-1.02/lib/Encoding/FixLatin.pm.orig 2010-05-01 04:04:05.000000000 +0200
+++ Encoding-FixLatin-1.02/lib/Encoding/FixLatin.pm 2010-11-30 23:04:57.000000000 +0100
@@ -5,7 +5,7 @@ use strict;
require 5.008;
-our $VERSION = '1.02';
+our $VERSION = '1.021';
use Carp qw(croak);
use Exporter qw(import);
@@ -17,6 +17,8 @@ our @EXPORT_OK = qw(fix_latin);
my $byte_map;
my $ascii_str = qr{\A([\x00-\x7F]+)(.*)\z}s;
+my $ascii_str_nonnull = qr{\A([\x01-\x7F]+)(.*)\z}s;
+my $ascii_str_print = qr{\A([\t\r\n\x20-\x7E]+)(.*)\z}s;
my $cont_byte = '[\x80-\xBF]';
my $utf8_2 = qr{\A([\xC0-\xDF])($cont_byte)(.*)\z}s;
@@ -24,7 +26,7 @@ my $utf8_3 = qr{\A([\xE0-\xEF])($cont
my $utf8_4 = qr{\A([\xF0-\xF7])($cont_byte)($cont_byte)($cont_byte)(.*)\z}s;
my $utf8_5 = qr{\A([\xF8-\xFB])($cont_byte)($cont_byte)($cont_byte)($cont_byte)(.*)\z}s;
-my %known_opt = map { $_ => 1 } qw(bytes_only ascii_hex overlong_fatal);
+my %known_opt = map { $_ => 1 } qw(bytes_only ascii_hex overlong_fatal filter_nonprint filter_null);
my %non_1252 = (
"\x81" => '%81',
@@ -40,6 +42,8 @@ sub fix_latin {
ascii_hex => 1,
bytes_only => 0,
overlong_fatal => 0,
+ filter_nonprint => 0,
+ filter_null => 0,
@_
);
@@ -49,6 +53,9 @@ sub fix_latin {
return unless defined($input);
_init_byte_map(\%opt) unless $byte_map;
+ $byte_map->{pack('C', 0)} = '' if $opt{filter_null};
+ $ascii_str = $ascii_str_nonnull if $opt{filter_null};
+ $ascii_str = $ascii_str_print if $opt{filter_nonprint};
if(is_utf8($input)) { # input string already has utf8 flag set
if($opt{bytes_only}) {
@@ -305,6 +312,15 @@ use eval to trap and handle this scenari
There is a strong argument that overlong sequences are only ever encountered
in malicious input and therefore they should always be rejected.
+=item filter_null => 1/0
+
+This option removes any occurance of the binary NUL character ("\0") from the file.
+This helps making files readable that use a fixed width 16-bit encoding like UCS-2.
+Default is 0, which retains NUL characters.
+
+Please note, that data corruption is to be expected, if an UCS-2 encoded input
+actually uses codepoints above decimal 255, regardless how this option is set.
+
=back
=head1 LIMITATIONS OF THIS MODULE
--- Encoding-FixLatin-1.02/script/fix_latin.orig 2010-04-30 12:22:53.000000000 +0200
+++ Encoding-FixLatin-1.02/script/fix_latin 2010-11-30 22:55:53.000000000 +0100
@@ -24,14 +24,15 @@ use Encoding::FixLatin qw(fix_latin);
my %opt;
-if(!GetOptions(\%opt, 'help|?')) {
+if(!GetOptions(\%opt, 'help|?', 'filter_null|0')) {
pod2usage(-exitval => 1, -verbose => 0);
}
+my $always = defined($opt{filter_null});
pod2usage(-exitstatus => 0, -verbose => 2) if($opt{'help'});
while(<>) {
- $_ = fix_latin($_, bytes_only => 1) if /[^\x00-\x7f]/;
+ $_ = fix_latin($_, bytes_only => 1, %opt) if $always or /[^\x00-\x7f]/;
print;
}
@@ -52,6 +53,8 @@ latin (ie: non-ASCII 8 bit) characters
-? detailed help message
+ -0 strip NUL bytes
+
=head1 DESCRIPTION
The script acts as a filter, taking source data which may contain a mix of
@@ -62,7 +65,7 @@ Multi-byte UTF8 characters will be passe
UTF8 byte sequences will be converted to the shortest normal form). Single
byte characters will be converted as follows:
- 0x00 - 0x7F ASCII - passed through unchanged
+ 0x00 - 0x7F ASCII - passed through unchanged (0x01-0x7F under option -0)
0x80 - 0x9F Converted to UTF8 using CP1252 mappings
0xA0 - 0xFF Converted to UTF8 using Latin-1 mappings
@@ -74,6 +77,14 @@ byte characters will be converted as fol
Display this documentation.
+=item B<-0>
+
+=item B<--filter-null>
+
+Strip binary NUL characters ('\0') from the file. This helps making UCS-2 files readable.
+Note that with or without -0, data corruption is to be expected if your UCS-2
+file uses codepoints above 255.
+
=back
=head1 EXAMPLES

View File

@@ -1,3 +1,16 @@
-------------------------------------------------------------------
Fri Aug 15 12:49:33 UTC 2014 - jweberhofer@weberhofer.at
- Updated to version 1.04
* add --use-xs option to command-line script
* fix -v alias for --version option
* add support for loading/using XS implementation layer
* repackage using dzil
- Dropped patch from jw@novell.com as those were rejected
upstream
-------------------------------------------------------------------
Wed Dec 1 16:36:58 UTC 2010 - jw@novell.com

View File

@@ -1,33 +1,38 @@
#
# spec file for package perl-perl-Encoding-FixLatin (Version 1.02)
# spec file for package perl-Encoding-FixLatin
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
# Copyright (c) 2014 SUSE LINUX Products 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 http://bugs.opensuse.org/
#
# norootforbuild
Name: perl-Encoding-FixLatin
Version: 1.02
Release: 0%{?dist}
License: GPLv2+ or Artistic
Group: Development/Libraries/Perl
Summary: Takes mixed encoding input and produces UTF-8 output
Source: http://search.cpan.org/CPAN/authors/id/G/GR/GRANTM/Encoding-FixLatin-%{version}.tar.gz
Patch1: fixlatin_nonnull.patch
Url: http://search.cpan.org/dist/Encoding-FixLatin
BuildRequires: perl perl-macros
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Name: perl-Encoding-FixLatin
Version: 1.04
Release: 0%{?dist}
Summary: Takes mixed encoding input and produces UTF-8 output
License: GPL-2.0+ or Artistic-1.0
Group: Development/Libraries/Perl
Source: http://search.cpan.org/CPAN/authors/id/G/GR/GRANTM/Encoding-FixLatin-%{version}.tar.gz
Url: http://search.cpan.org/dist/Encoding-FixLatin
BuildRequires: perl
BuildRequires: perl-macros
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%perl_requires
BuildArch: noarch
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.56
BuildRequires: perl(Test::More) >= 0.45
BuildArch: noarch
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.56
BuildRequires: perl(Test::More) >= 0.45
%description
Most encoding conversion tools take input in one encoding and produce
@@ -39,7 +44,6 @@ them all to UTF-8 output.
%prep
%setup -q -n Encoding-FixLatin-%{version}
%patch1 -p1
%build
if [ -f Build.PL ]; then
@@ -59,7 +63,7 @@ if [ -f Build.PL ]; then
else
%{__make} pure_install PERL_INSTALL_ROOT=%{buildroot}
fi
find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null ';'
@@ -73,7 +77,7 @@ find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null ';'
else
%{__make} test
fi
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && %{__rm} -rf $RPM_BUILD_ROOT
@@ -82,7 +86,3 @@ fi
%doc README Changes
%changelog
* Fri Aug 13 2010 %{packager}
- initial SUSE packaging
- generated with cpan2dist (CPANPLUS::Dist::SUSE version 0.0.8)