Hello community,

here is the log from the commit of package perl-Log-Log4perl for 
openSUSE:Factory checked in at 2017-03-03 14:33:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Log-Log4perl (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Log-Log4perl.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Log-Log4perl"

Fri Mar  3 14:33:17 2017 rev:31 rq:460877 version:1.49

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Log-Log4perl/perl-Log-Log4perl.changes      
2016-11-20 18:17:22.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.perl-Log-Log4perl.new/perl-Log-Log4perl.changes 
2017-03-03 14:33:18.464879016 +0100
@@ -1,0 +2,10 @@
+Wed Feb 22 06:47:37 UTC 2017 - [email protected]
+
+- updated to 1.49
+   see /usr/share/doc/packages/perl-Log-Log4perl/Changes
+
+  1.49 (2017/02/20)
+     *    (ms) Adapted to perl 5.24 which balks at syswrite/utf8:
+            https://github.com/mschilli/log4perl/issues/78
+
+-------------------------------------------------------------------

Old:
----
  Log-Log4perl-1.48.tar.gz

New:
----
  Log-Log4perl-1.49.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Log-Log4perl.spec ++++++
--- /var/tmp/diff_new_pack.56fRnP/_old  2017-03-03 14:33:19.656710374 +0100
+++ /var/tmp/diff_new_pack.56fRnP/_new  2017-03-03 14:33:19.656710374 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Log-Log4perl
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 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
@@ -17,14 +17,14 @@
 
 
 Name:           perl-Log-Log4perl
-Version:        1.48
+Version:        1.49
 Release:        0
 %define cpan_name Log-Log4perl
 Summary:        Log4j implementation for Perl
 License:        GPL-1.0+ or Artistic-1.0
 Group:          Development/Libraries/Perl
 Url:            http://search.cpan.org/dist/Log-Log4perl/
-Source0:        
http://www.cpan.org/authors/id/M/MS/MSCHILLI/%{cpan_name}-%{version}.tar.gz
+Source0:        
https://cpan.metacpan.org/authors/id/M/MS/MSCHILLI/%{cpan_name}-%{version}.tar.gz
 Source1:        cpanspec.yml
 BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -95,6 +95,7 @@
 
 %files -f %{name}.files
 %defattr(-,root,root,755)
-%doc Changes LICENSE README
+%doc Changes README
+%license LICENSE
 
 %changelog

++++++ Log-Log4perl-1.48.tar.gz -> Log-Log4perl-1.49.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Log-Log4perl-1.48/Changes 
new/Log-Log4perl-1.49/Changes
--- old/Log-Log4perl-1.48/Changes       2016-11-15 05:36:58.000000000 +0100
+++ new/Log-Log4perl-1.49/Changes       2017-02-21 07:17:06.000000000 +0100
@@ -2,6 +2,10 @@
  Revision history for Log::Log4perl
 ##################################################
 
+1.49 (2017/02/20)
+   *    (ms) Adapted to perl 5.24 which balks at syswrite/utf8:
+          https://github.com/mschilli/log4perl/issues/78
+
 1.48 (2016/11/14)
    *    (ms) [rt.cpan.org #117377] Moved PatternLayout's documentation of
              DateFormat features to DateFormat.pm to avoid duplication 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Log-Log4perl-1.48/META.json 
new/Log-Log4perl-1.49/META.json
--- old/Log-Log4perl-1.48/META.json     2016-11-15 05:39:02.000000000 +0100
+++ new/Log-Log4perl-1.49/META.json     2017-02-21 07:19:12.000000000 +0100
@@ -45,5 +45,5 @@
       },
       "x_MailingList" : "mailto:[email protected]";
    },
-   "version" : "1.48"
+   "version" : "1.49"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Log-Log4perl-1.48/META.yml 
new/Log-Log4perl-1.49/META.yml
--- old/Log-Log4perl-1.48/META.yml      2016-11-15 05:39:02.000000000 +0100
+++ new/Log-Log4perl-1.49/META.yml      2017-02-21 07:19:11.000000000 +0100
@@ -24,4 +24,4 @@
 resources:
   MailingList: mailto:[email protected]
   repository: http://github.com/mschilli/log4perl
-version: '1.48'
+version: '1.49'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Log-Log4perl-1.48/README new/Log-Log4perl-1.49/README
--- old/Log-Log4perl-1.48/README        2016-11-15 05:39:02.000000000 +0100
+++ new/Log-Log4perl-1.49/README        2017-02-21 07:19:11.000000000 +0100
@@ -1,5 +1,5 @@
 ######################################################################
-    Log::Log4perl 1.48
+    Log::Log4perl 1.49
 ######################################################################
 
 NAME
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Log-Log4perl-1.48/lib/Log/Log4perl/Appender/File.pm 
new/Log-Log4perl-1.49/lib/Log/Log4perl/Appender/File.pm
--- old/Log-Log4perl-1.48/lib/Log/Log4perl/Appender/File.pm     2016-11-15 
05:36:58.000000000 +0100
+++ new/Log-Log4perl-1.49/lib/Log/Log4perl/Appender/File.pm     2017-02-21 
07:17:06.000000000 +0100
@@ -11,6 +11,7 @@
 use File::Path;
 use File::Spec::Functions qw(splitpath);
 use constant _INTERNAL_DEBUG => 0;
+use constant SYSWRITE_UTF8_OK => ( $] < 5.024 );
 
 ##################################################
 sub new {
@@ -26,7 +27,7 @@
         syswrite  => 0,
         mode      => "append",
         binmode   => undef,
-        utf8      => undef,
+        utf8      => 0,
         recreate  => 0,
         recreate_check_interval => 30,
         recreate_check_signal   => undef,
@@ -62,6 +63,12 @@
         close FILE;
     }
 
+    print "Calling syswrite_encoder\n" if _INTERNAL_DEBUG;
+
+    $self->{syswrite_encoder} = $self->syswrite_encoder();
+
+    print "syswrite_encoder returned\n" if _INTERNAL_DEBUG;
+
         # This will die() if it fails
     $self->file_open() unless $self->{create_at_logtime};
 
@@ -69,6 +76,26 @@
 }
 
 ##################################################
+sub syswrite_encoder {
+##################################################
+    my($self) = @_;
+
+    if( !SYSWRITE_UTF8_OK and $self->{syswrite} and $self->{utf8} ) {
+        print "Requiring Encode\n" if _INTERNAL_DEBUG;
+        eval { require Encode };
+        print "Requiring Encode returned: $@\n" if _INTERNAL_DEBUG;
+
+        if( $@ ) {
+            die "syswrite and utf8 requires Encode.pm";
+        } else {
+            return sub { Encode::encode_utf8($_[0]) };
+        }
+    }
+
+    return undef;
+}
+
+##################################################
 sub filename {
 ##################################################
     my($self) = @_;
@@ -163,8 +190,11 @@
         binmode $self->{fh}, $self->{binmode};
     }
 
-    if (defined $self->{utf8}) {
-        binmode $self->{fh}, ":utf8";
+    if ($self->{utf8}) {
+          # older perls can handle syswrite+utf8 just fine
+        if(SYSWRITE_UTF8_OK or !$self->{syswrite}) {
+            binmode $self->{fh}, ":utf8";
+        }
     }
 
     if(defined $self->{header_text}) {
@@ -269,8 +299,15 @@
     my $fh = $self->{fh};
 
     if($self->{syswrite}) {
-       defined (syswrite $fh, $params{message}) or
-           die "Cannot syswrite to '$self->{filename}': $!";
+         my $rc = 
+           syswrite( $fh, 
+               $self->{ syswrite_encoder } ?
+                 $self->{ syswrite_encoder }->($params{message}) :
+                 $params{message} );
+
+         if(!$rc) {
+             die "Cannot syswrite to '$self->{filename}': $!";
+         }
     } else {
         print $fh $params{message} or
             die "Cannot write to '$self->{filename}': $!";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Log-Log4perl-1.48/lib/Log/Log4perl/Appender.pm 
new/Log-Log4perl-1.49/lib/Log/Log4perl/Appender.pm
--- old/Log-Log4perl-1.48/lib/Log/Log4perl/Appender.pm  2016-11-15 
05:36:58.000000000 +0100
+++ new/Log-Log4perl-1.49/lib/Log/Log4perl/Appender.pm  2017-02-21 
07:17:06.000000000 +0100
@@ -61,6 +61,7 @@
     };
 
     $@ and die "ERROR: can't load appenderclass '$appenderclass'\n$@";
+    print "Appender class $appenderclass loaded OK ($@)\n" if _INTERNAL_DEBUG;
 
     $params{name} = unique_name() unless exists $params{name};
 
@@ -72,6 +73,8 @@
         $params{mode} = 'append';
     }
 
+    print "Calling $appenderclass new\n" if _INTERNAL_DEBUG;
+
     my $appender = $appenderclass->new(
             # Set min_level to the lowest setting. *we* are 
             # controlling this now, the appender should just
@@ -81,6 +84,8 @@
         map { $_ => $params{$_} } keys %params,
     );
 
+    print "Calling $appenderclass new returned OK\n" if _INTERNAL_DEBUG;
+
     my $self = {
                  appender  => $appender,
                  name      => $params{name},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Log-Log4perl-1.48/lib/Log/Log4perl.pm 
new/Log-Log4perl-1.49/lib/Log/Log4perl.pm
--- old/Log-Log4perl-1.48/lib/Log/Log4perl.pm   2016-11-15 05:36:58.000000000 
+0100
+++ new/Log-Log4perl-1.49/lib/Log/Log4perl.pm   2017-02-21 07:17:06.000000000 
+0100
@@ -16,7 +16,7 @@
 use Log::Log4perl::Config;
 use Log::Log4perl::Appender;
 
-our $VERSION = '1.48';
+our $VERSION = '1.49';
 
    # set this to '1' if you're using a wrapper
    # around Log::Log4perl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Log-Log4perl-1.48/t/052Utf8.t 
new/Log-Log4perl-1.49/t/052Utf8.t
--- old/Log-Log4perl-1.48/t/052Utf8.t   2016-11-15 05:36:58.000000000 +0100
+++ new/Log-Log4perl-1.49/t/052Utf8.t   2017-02-21 07:17:06.000000000 +0100
@@ -22,7 +22,7 @@
     if($] < 5.008) {
         plan skip_all => "utf-8 tests with perl >= 5.8 only";
     } else {
-        plan tests => 6;
+        plan tests => 7;
     }
 }
 
@@ -128,3 +128,26 @@
 ok defined $app, "app found";
 my $buf = $app->buffer();
 is $buf, "blech\n", "utf8 named appender";
+
+###########
+# utf8 + syswrite
+###########
+my $conf = <<EOT;
+    log4perl.logger = DEBUG, A1
+    log4perl.appender.A1=Log::Log4perl::Appender::File
+    log4perl.appender.A1.filename=$TMP_FILE
+    log4perl.appender.A1.mode=write
+    log4perl.appender.A1.syswrite=1
+    log4perl.appender.A1.utf8=1
+    log4perl.appender.A1.layout=PatternLayout
+    log4perl.appender.A1.layout.ConversionPattern=%d-%c %m%n
+EOT
+$DB::single = 1;
+Log::Log4perl->reset();
+Log::Log4perl->init(\$conf);
+
+DEBUG "quack \x{A4}";
+open FILE, "<:utf8", $TMP_FILE or die "Cannot open $TMP_FILE";
+my $data = join '', <FILE>;
+close FILE;
+like($data, qr/\x{A4}/, "conf: utf8-1");


Reply via email to