Hello community,
here is the log from the commit of package perl-Locale-Maketext-Gettext for
openSUSE:Factory checked in at 2019-09-11 10:40:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Locale-Maketext-Gettext (Old)
and /work/SRC/openSUSE:Factory/.perl-Locale-Maketext-Gettext.new.7948
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Locale-Maketext-Gettext"
Wed Sep 11 10:40:11 2019 rev:10 rq:729903 version:1.29
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Locale-Maketext-Gettext/perl-Locale-Maketext-Gettext.changes
2011-11-21 12:42:17.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Locale-Maketext-Gettext.new.7948/perl-Locale-Maketext-Gettext.changes
2019-09-11 10:40:14.667221645 +0200
@@ -1,0 +2,15 @@
+Tue Sep 10 09:13:15 UTC 2019 - <[email protected]>
+
+- updated to 1.29
+ see /usr/share/doc/packages/perl-Locale-Maketext-Gettext/Changes
+
+ 2019-09-09 version 1.29
+ Fix after 10 years.
+ 1. Gettext.pm: Added support to purge the lexicon cache and
+ reread the MO file on calling textdomain() when MO file is
+ updated automatically. This enables MO file live update with
+ persistant applications like Mojolicious or mod_perl.
+ 2. Source is now on Github. See:
+ https://github.com/imacat/Locale-Maketext-Gettext
+
+-------------------------------------------------------------------
Old:
----
Locale-Maketext-Gettext-1.28.tar.gz
New:
----
Locale-Maketext-Gettext-1.29.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Locale-Maketext-Gettext.spec ++++++
--- /var/tmp/diff_new_pack.QdX8BK/_old 2019-09-11 10:40:15.311221530 +0200
+++ /var/tmp/diff_new_pack.QdX8BK/_new 2019-09-11 10:40:15.315221529 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Locale-Maketext-Gettext
#
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# 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
@@ -12,54 +12,59 @@
# 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/
#
-# norootforbuild
-
Name: perl-Locale-Maketext-Gettext
+Version: 1.29
+Release: 0
%define cpan_name Locale-Maketext-Gettext
Summary: Joins the gettext and Maketext frameworks
-Version: 1.28
-Release: 1
-License: GPL-1.0+ or Artistic-1.0
+License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
-Url: http://search.cpan.org/dist/Locale-Maketext-Gettext/
-Source:
http://www.cpan.org/authors/id/I/IM/IMACAT/Locale-Maketext-Gettext-%{version}.tar.gz
+Url: https://metacpan.org/release/%{cpan_name}
+Source0:
https://cpan.metacpan.org/authors/id/I/IM/IMACAT/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-%{perl_requires}
BuildRequires: perl
-BuildRequires: perl(Module::Build)
BuildRequires: perl-macros
+BuildRequires: perl(Module::Build)
+%{perl_requires}
%description
Locale::Maketext::Gettext joins the GNU gettext and Maketext frameworks. It
is a subclass of Locale::Maketext(3) that follows the way GNU gettext
-works. It works seamlessly, both in the sense of GNU gettext and Maketext.
-As a result, you enjoy both their advantages, and get rid of both their
-problems, too.
+works. It works seamlessly, _both in the sense of GNU gettext and
+Maketext_. As a result, you _enjoy both their advantages, and get rid of
+both their problems, too._
+
+You start as an usual GNU gettext localization project: Work on PO files
+with the help of translators, reviewers and Emacs. Turn them into MO files
+with _msgfmt_. Copy them into the appropriate locale directory, such as
+_/usr/share/locale/de/LC_MESSAGES/myapp.mo_.
+
+Then, build your Maketext localization class, with your base class changed
+from Locale::Maketext(3) to Locale::Maketext::Gettext. That is all.
%prep
%setup -q -n %{cpan_name}-%{version}
+find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644
%build
-%{__perl} Build.PL installdirs=vendor
+perl Build.PL installdirs=vendor
./Build build flags=%{?_smp_mflags}
%check
./Build test
%install
-./Build install destdir=$RPM_BUILD_ROOT create_packlist=0
+./Build install destdir=%{buildroot} create_packlist=0
%perl_gen_filelist
-%clean
-%{__rm} -rf $RPM_BUILD_ROOT
-
%files -f %{name}.files
-%defattr(-,root,root,-)
-%doc Artistic BUGS Changes COPYING README THANKS TODO
+%defattr(-,root,root,755)
+%doc BUGS Changes README THANKS TODO
+%license Artistic COPYING
%changelog
++++++ Locale-Maketext-Gettext-1.28.tar.gz ->
Locale-Maketext-Gettext-1.29.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/Build.PL
new/Locale-Maketext-Gettext-1.29/Build.PL
--- old/Locale-Maketext-Gettext-1.28/Build.PL 2009-06-27 03:17:41.000000000
+0200
+++ new/Locale-Maketext-Gettext-1.29/Build.PL 2019-09-09 16:06:33.000000000
+0200
@@ -4,7 +4,7 @@
my $build = Module::Build->new(
dist_name => "Locale-Maketext-Gettext",
- dist_version => "1.28",
+ dist_version => "1.29",
dist_abstract => "Joins gettext and Maketext frameworks",
dist_author => "imacat <imacat\@mail.imacat.idv.tw>",
license => "perl",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/Changes
new/Locale-Maketext-Gettext-1.29/Changes
--- old/Locale-Maketext-Gettext-1.28/Changes 2009-06-27 03:17:11.000000000
+0200
+++ new/Locale-Maketext-Gettext-1.29/Changes 2019-09-09 16:11:21.000000000
+0200
@@ -1,5 +1,14 @@
Locale-Maketext-Gettext change log
+2019-09-09 version 1.29
+ Fix after 10 years.
+ 1. Gettext.pm: Added support to purge the lexicon cache and
+ reread the MO file on calling textdomain() when MO file is
+ updated automatically. This enables MO file live update with
+ persistant applications like Mojolicious or mod_perl.
+ 2. Source is now on Github. See:
+ https://github.com/imacat/Locale-Maketext-Gettext
+
2009-06-27 version 1.28
Build script fix. No code changes.
1. Build.PL: Removed the build_requires, as they are not
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/INSTALL
new/Locale-Maketext-Gettext-1.29/INSTALL
--- old/Locale-Maketext-Gettext-1.28/INSTALL 2008-11-10 18:02:29.000000000
+0100
+++ new/Locale-Maketext-Gettext-1.29/INSTALL 2019-09-09 16:12:45.000000000
+0200
@@ -34,8 +34,8 @@
** Install with ExtUtils::MakeMaker
- arclog uses standard Perl installation with ExtUtils::MakeMaker.
-Follow these steps:
+ Locale-Maketext-Gettext uses standard Perl installation with
+ExtUtils::MakeMaker. Follow these steps:
% perl Makefile.PL
% make
@@ -141,6 +141,6 @@
imacat
-2008-11-11
+2008/11/11, updated 2019/9/9
[email protected]
http://www.imacat.idv.tw/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/MANIFEST
new/Locale-Maketext-Gettext-1.29/MANIFEST
--- old/Locale-Maketext-Gettext-1.28/MANIFEST 2008-04-21 21:10:10.000000000
+0200
+++ new/Locale-Maketext-Gettext-1.29/MANIFEST 2019-09-09 16:04:17.000000000
+0200
@@ -24,6 +24,7 @@
t/09-f-encodings.t
t/10-f-switching.t
t/11-command-line.t
+t/12-cache.t
t/99-pod.t
t/locale/C/LC_MESSAGES/test.mo
t/locale/en/LC_MESSAGES/bad.mo
@@ -41,3 +42,4 @@
t/T_L10N.pm
THANKS
TODO
+META.json
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/META.json
new/Locale-Maketext-Gettext-1.29/META.json
--- old/Locale-Maketext-Gettext-1.28/META.json 1970-01-01 01:00:00.000000000
+0100
+++ new/Locale-Maketext-Gettext-1.29/META.json 2019-09-09 16:38:45.000000000
+0200
@@ -0,0 +1,40 @@
+{
+ "abstract" : "Joins gettext and Maketext frameworks",
+ "author" : [
+ "imacat <[email protected]>"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "ExtUtils::MakeMaker version 7.1002, CPAN::Meta::Converter
version 2.150005",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Locale-Maketext-Gettext",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "runtime" : {
+ "requires" : {}
+ }
+ },
+ "release_status" : "stable",
+ "version" : "1.29",
+ "x_serialization_backend" : "JSON::PP version 2.27300_01"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/META.yml
new/Locale-Maketext-Gettext-1.29/META.yml
--- old/Locale-Maketext-Gettext-1.28/META.yml 2009-06-27 03:20:03.000000000
+0200
+++ new/Locale-Maketext-Gettext-1.29/META.yml 2019-09-09 16:38:45.000000000
+0200
@@ -1,21 +1,22 @@
---- #YAML:1.0
-name: Locale-Maketext-Gettext
-version: 1.28
-abstract: Joins gettext and Maketext frameworks
+---
+abstract: 'Joins gettext and Maketext frameworks'
author:
- - imacat <[email protected]>
-license: perl
-distribution_type: module
-configure_requires:
- ExtUtils::MakeMaker: 0
+ - 'imacat <[email protected]>'
build_requires:
- ExtUtils::MakeMaker: 0
-requires: {}
-no_index:
- directory:
- - t
- - inc
-generated_by: ExtUtils::MakeMaker version 6.52
+ ExtUtils::MakeMaker: '0'
+configure_requires:
+ ExtUtils::MakeMaker: '0'
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 7.1002, CPAN::Meta::Converter
version 2.150005'
+license: perl
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: '1.4'
+name: Locale-Maketext-Gettext
+no_index:
+ directory:
+ - t
+ - inc
+requires: {}
+version: '1.29'
+x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/Makefile.PL
new/Locale-Maketext-Gettext-1.29/Makefile.PL
--- old/Locale-Maketext-Gettext-1.28/Makefile.PL 2009-06-27
03:17:45.000000000 +0200
+++ new/Locale-Maketext-Gettext-1.29/Makefile.PL 2019-09-09
16:07:07.000000000 +0200
@@ -12,7 +12,7 @@
WriteMakefile(
NAME => "Locale-Maketext-Gettext",
- VERSION => "1.28",
+ VERSION => "1.29",
ABSTRACT => "Joins gettext and Maketext frameworks",
AUTHOR => "imacat <imacat\@mail.imacat.idv.tw>",
%license,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/README
new/Locale-Maketext-Gettext-1.29/README
--- old/Locale-Maketext-Gettext-1.28/README 2008-04-21 11:15:31.000000000
+0200
+++ new/Locale-Maketext-Gettext-1.29/README 2019-09-09 16:13:58.000000000
+0200
@@ -38,17 +38,23 @@
* Installation
- Read INSTALL for instructions on how to install
+Read INSTALL for instructions on how to install
Locale::Maketext::Gettext.
+* Source
+
+Source is now on Github. See
+https://github.com/imacat/Locale-Maketext-Gettext
+
+
* News, Changes and Updates
- Refer to the Changes for changes, bug fixes, updates, new functions, etc.
+Refer to the Changes for changes, bug fixes, updates, new functions, etc.
* Copyright
-Copyright (c) 2003-2007 imacat. All rights reserved. This program is free
+Copyright (c) 2003-2019 imacat. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms
as Perl itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/SIGNATURE
new/Locale-Maketext-Gettext-1.29/SIGNATURE
--- old/Locale-Maketext-Gettext-1.28/SIGNATURE 2009-06-27 03:20:05.000000000
+0200
+++ new/Locale-Maketext-Gettext-1.29/SIGNATURE 2019-09-09 16:38:45.000000000
+0200
@@ -1,5 +1,5 @@
This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.55.
+signed via the Module::Signature module, version 0.81.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
@@ -16,20 +16,21 @@
SHA1 be0627fff2e8aef3d2a14d5d7486babc8a4873ba Artistic
SHA1 f044bfe71c57b6f25c659bc0a6067aa854bc8343 BUGS
-SHA1 7d6278e57e33472b167335a5435081f307f0dc70 Build.PL
+SHA1 b90670f4f18c5fc6f31a54cfc70cc1768f78231c Build.PL
SHA1 8624bcdae55baeef00cd11d5dfcfa60f68710a02 COPYING
-SHA1 5863e86e8a20bbb63b3fd295520b861fa87db0c7 Changes
-SHA1 e9345adfeb32db567cd1be52f3f27307943a36bc INSTALL
-SHA1 c7d9c9b334b816e6f06473647cd9a054152a44c9 MANIFEST
-SHA1 39589ded15e1d09a79c41391392d249de3708f4a META.yml
-SHA1 ec92e11b76afaa05f67d83a6e32056505a45c99e Makefile.PL
-SHA1 b699f73f5fa33123b2f4f1b210665e295900c74d README
+SHA1 52e62d6d9ecb0a0bcf6415b47dac732d08bef2b7 Changes
+SHA1 db0a35525a84c33ed78ab4f59df93b20fa31c8cf INSTALL
+SHA1 c3d0ffec086f8f4b993ca18d13e245cd8bd0897e MANIFEST
+SHA1 4efce660d3417ad6537c1f1793f370655ae3aaa8 META.json
+SHA1 f5e07e40c92161c34ae803a35932fadc64ea1795 META.yml
+SHA1 9f6cc97aaa34f3e33968fd6c0a5c470d1b43b8e9 Makefile.PL
+SHA1 d9b790a6c16c3ed5be90396ec345fc18b6964e3a README
SHA1 3db402b52e04cf5a6e60291c23aac8c16f2db810 THANKS
SHA1 85dd5ac895cc0a5b95827060999578d8ce8d41dd TODO
-SHA1 f9deac7b12cc6a3cb18b7f5282f9e6a1e1a624b9 lib/Locale/Maketext/Gettext.pm
+SHA1 45c670256cc3918914ef5007f066a8c91f471190 lib/Locale/Maketext/Gettext.pm
SHA1 b88b6bad1e8cb0ba825594c233c006c1b297646f
lib/Locale/Maketext/Gettext/Functions.pm
SHA1 f89afd70fdcbaeeab44fada7ed3087d5c7f6f018 script/maketext
-SHA1 525f414c7a0aadc61240a4b0959ca2cda7514c75 t/00-signature.t
+SHA1 983e35d916266240ac038431217066232a9f9144 t/00-signature.t
SHA1 7bc2bf2d3ef2befd48a457fb3d90c7c7bdcc4854 t/01-basic.t
SHA1 73ce1e3ba168373318655b3f4fbca1847e49fd75 t/02-big-endian.t
SHA1 4b07656e4c35bfce793c96b59bb9ae2917be335e t/03-errors.t
@@ -41,6 +42,7 @@
SHA1 8fb7ecbce36daaf81ac9c197dab6834b25233cc5 t/09-f-encodings.t
SHA1 2c1641cc6fff792fb83826486050acab23a1db51 t/10-f-switching.t
SHA1 4afe4980e7ed4d326009b8257e01320abfb33d14 t/11-command-line.t
+SHA1 a79a59f283d0f4cbac868443a34aa132c38a357d t/12-cache.t
SHA1 b85626024d610808bd0909989dcfb9fb20a40485 t/99-pod.t
SHA1 97dad77dee7f751d09efdb6900b077d68c853d46 t/T_L10N.pm
SHA1 676b87d7a8edc735ba676d2901827eb52532b418 t/locale/C/LC_MESSAGES/test.mo
@@ -57,9 +59,8 @@
SHA1 20f810c6229d0bd4064b27f9b3d86b61a20f0821
t/locale/zh_TW/LC_MESSAGES/test_be.mo
SHA1 eb13887b005e3c3e9fab774dfea22de5c01ad1ef
t/locale/zh_TW/LC_MESSAGES/test_utf8.mo
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.9 (GNU/Linux)
-iEYEARECAAYFAkpFc8MACgkQi9gubzC5S1w3kQCfY4bdMI9M6+sTT+y//sHibPDP
-LUUAnRvtrXrg1Tov/anLHx0Xur3TmAQQ
-=Au1F
+iF0EARECAB0WIQSBin4eTeP7OclnnAOL2C5vMLlLXAUCXXZj9QAKCRCL2C5vMLlL
+XMIvAJ0e84fycRhESVJ55ChKWv7zKMqVCwCgg+7Hu4Kz4pzLHjbSGkzgcP6TH+w=
+=3Dk5
-----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Locale-Maketext-Gettext-1.28/lib/Locale/Maketext/Gettext.pm
new/Locale-Maketext-Gettext-1.29/lib/Locale/Maketext/Gettext.pm
--- old/Locale-Maketext-Gettext-1.28/lib/Locale/Maketext/Gettext.pm
2009-06-27 03:18:04.000000000 +0200
+++ new/Locale-Maketext-Gettext-1.29/lib/Locale/Maketext/Gettext.pm
2019-09-09 16:14:39.000000000 +0200
@@ -1,6 +1,6 @@
# Locale::Maketext::Gettext - Joins the gettext and Maketext frameworks
-# Copyright (c) 2003-2009 imacat. All rights reserved. This program is free
+# Copyright (c) 2003-2019 imacat. All rights reserved. This program is free
# software; you can redistribute it and/or modify it under the same terms
# as Perl itself.
# First written: 2003-04-23
@@ -11,7 +11,7 @@
use warnings;
use base qw(Locale::Maketext Exporter);
use vars qw($VERSION @ISA %Lexicon @EXPORT @EXPORT_OK);
-$VERSION = 1.28;
+$VERSION = 1.29;
@EXPORT = qw(read_mo);
@EXPORT_OK = @EXPORT;
# Prototype declaration
@@ -21,9 +21,10 @@
use File::Spec::Functions qw(catfile);
no strict qw(refs);
-use vars qw(%Lexicons %ENCODINGS $REREAD_MO $MOFILE);
+use vars qw(%CACHE $REREAD_MO $MO_FILE);
+%CACHE = qw();
$REREAD_MO = 0;
-$MOFILE = "";
+$MO_FILE = "";
use vars qw(@SYSTEM_LOCALEDIRS);
@SYSTEM_LOCALEDIRS = qw(/usr/share/locale /usr/lib/locale
/usr/local/share/locale /usr/local/lib/locale);
@@ -102,9 +103,9 @@
$self->SUPER::fail_with($self->can("failure_handler_auto"));
# Initialize the ENCODE_FAILURE setting
$self->{"ENCODE_FAILURE"} = FB_DEFAULT;
- # Initialize the MOFILE value of this instance
- $self->{"MOFILE"} = "";
- ${"$class\::MOFILE"} = "" if !defined ${"$class\::MOFILE"};
+ # Initialize the MO_FILE value of this instance
+ $self->{"MO_FILE"} = "";
+ ${"$class\::MO_FILE"} = "" if !defined ${"$class\::MO_FILE"};
# Find the locale name, for this subclass
$self->{"LOCALE"} = $class;
$self->{"LOCALE"} =~ s/^.*:://;
@@ -141,7 +142,7 @@
# textdomain: Set the current text domain
sub textdomain : method {
local ($_, %_);
- my ($self, $class, $DOMAIN, $LOCALEDIR, $MOfile);
+ my ($self, $class, $DOMAIN, $LOCALEDIR, $mo_file);
($self, $DOMAIN) = @_;
# This is not a static method
@@ -160,41 +161,41 @@
# Clear it
$self->{"Lexicon"} = {};
%{"$class\::Lexicon"} = qw();
- $self->{"MOFILE"} = "";
- ${"$class\::MOFILE"} = "";
+ $self->{"MO_FILE"} = "";
+ ${"$class\::MO_FILE"} = "";
# The format is "{LOCALEDIR}/{LOCALE}/{CATEGORY}/{DOMAIN}.mo"
# Search the system locale directories if the domain was not
# registered yet
if (!exists ${$self->{"LOCALEDIRS"}}{$DOMAIN}) {
- undef $MOfile;
+ undef $mo_file;
foreach $LOCALEDIR (@SYSTEM_LOCALEDIRS) {
$_ = catfile($LOCALEDIR, $self->{"LOCALE"},
$self->{"CATEGORY"}, "$DOMAIN.mo");
if (-f $_ && -r $_) {
- $MOfile = $_;
+ $mo_file = $_;
last;
}
}
# Not found at last
- return $DOMAIN if !defined $MOfile;
+ return $DOMAIN if !defined $mo_file;
# This domain was registered
} else {
- $MOfile = catfile(${$self->{"LOCALEDIRS"}}{$DOMAIN},
+ $mo_file = catfile(${$self->{"LOCALEDIRS"}}{$DOMAIN},
$self->{"LOCALE"}, $self->{"CATEGORY"}, "$DOMAIN.mo");
}
# Record it
- ${"$class\::MOFILE"} = $MOfile;
- $self->{"MOFILE"} = $MOfile;
+ ${"$class\::MO_FILE"} = $mo_file;
+ $self->{"MO_FILE"} = $mo_file;
# Read the MO file
# Cached
- if (!exists $ENCODINGS{$MOfile} || !exists $Lexicons{$MOfile}) {
- my $enc;
+ if (!$self->_is_using_cache($mo_file)) {
+ my ($enc, @stats, $mtime, $size);
# Read it
- %_ = read_mo($MOfile);
+ %_ = read_mo($mo_file);
# Successfully read
if (scalar(keys %_) > 0) {
@@ -211,13 +212,23 @@
}
# Cache them
- $Lexicons{$MOfile} = \%_;
- $ENCODINGS{$MOfile} = $enc;
+ @stats = stat $mo_file;
+ if (@stats > 0) {
+ ($mtime, $size) = @stats[9,7];
+ } else {
+ ($mtime, $size) = (undef, undef);
+ }
+ $CACHE{$mo_file} = {
+ "Lexicon" => {%_},
+ "encoding" => $enc,
+ "mtime" => $mtime,
+ "size" => $size,
+ };
}
# Respect the existing output encoding
- if (defined $ENCODINGS{$MOfile}) {
- $self->{"MO_ENCODING"} = $ENCODINGS{$MOfile};
+ if (defined $CACHE{$mo_file}->{"encoding"}) {
+ $self->{"MO_ENCODING"} = $CACHE{$mo_file}->{"encoding"};
} else {
delete $self->{"MO_ENCODING"};
}
@@ -229,13 +240,38 @@
delete $self->{"ENCODING"};
}
}
- $self->{"Lexicon"} = $Lexicons{$MOfile};
- %{"$class\::Lexicon"} = %{$Lexicons{$MOfile}};
+ $self->{"Lexicon"} = $CACHE{$mo_file}->{"Lexicon"};
+ %{"$class\::Lexicon"} = %{$CACHE{$mo_file}->{"Lexicon"}};
$self->clear_isa_scan;
return $DOMAIN;
}
+# _is_using_cache: Return whether we are using our cache.
+sub _is_using_cache : method {
+ local ($_, %_);
+ my ($self, $mo_file, @stats, $mtime, $size);
+ ($self, $mo_file) = @_;
+
+ # NO if we do not have such a cache.
+ return undef unless exists $CACHE{$mo_file};
+
+ @stats = stat $mo_file;
+ # The MO file does not exist previously.
+ if (!defined $CACHE{$mo_file}->{"mtime"}
+ || !defined $CACHE{$mo_file}->{"size"}) {
+ # Use the cache if the MO file still does not exist.
+ return (@stats == 0);
+
+ # The MO file exists previously.
+ } else {
+ # Use the cache if the MO file did not change.
+ ($mtime, $size) = @stats[9,7];
+ return $mtime == $CACHE{$mo_file}->{"mtime"}
+ && $size == $CACHE{$mo_file}->{"size"};
+ }
+}
+
# maketext: Encode after maketext
sub maketext : method {
local ($_, %_);
@@ -260,8 +296,8 @@
# single localization subclass whenever possible.
# Maketext uses class lexicon in order to track the inheritance.
# It is hard to change it.
- if (${"$class\::MOFILE"} ne $self->{"MOFILE"}) {
- ${"$class\::MOFILE"} = $self->{"MOFILE"};
+ if (${"$class\::MO_FILE"} ne $self->{"MO_FILE"}) {
+ ${"$class\::MO_FILE"} = $self->{"MO_FILE"};
%{"$class\::Lexicon"} = %{$self->{"Lexicon"}};
}
@@ -299,14 +335,14 @@
# Refer to gettext documentation section 8.3
sub read_mo($) {
local ($_, %_);
- my ($MOfile, $len, $FH, $content, $tmpl);
- $MOfile = $_[0];
+ my ($mo_file, $len, $FH, $content, $tmpl);
+ $mo_file = $_[0];
# Avild being stupid
- return unless -f $MOfile && -r $MOfile;
+ return unless -f $mo_file && -r $mo_file;
# Read the MO file
- $len = (stat $MOfile)[7];
- open $FH, $MOfile or return; # GNU gettext never fails!
+ $len = (stat $mo_file)[7];
+ open $FH, $mo_file or return; # GNU gettext never fails!
binmode $FH;
defined($_ = read $FH, $content, $len)
or return;
@@ -366,8 +402,7 @@
local ($_, %_);
# Purge the text cache
- %Lexicons = qw();
- %ENCODINGS = qw();
+ %CACHE = qw();
$REREAD_MO = time;
return;
@@ -535,7 +570,7 @@
Use Locale::Maketext::Gettext to read and parse the MO file:
use Locale::Maketext::Gettext;
- %Lexicon = read_mo($MOfile);
+ %Lexicon = read_mo($mo_file);
=head1 DESCRIPTION
@@ -653,7 +688,7 @@
=over
-=item %Lexicon = read_mo($MOfile);
+=item %Lexicon = read_mo($mo_file);
Read and parse the MO file. Returns the read %Lexicon. The returned
lexicon is in its original encoding.
@@ -807,7 +842,7 @@
=head1 COPYRIGHT
-Copyright (c) 2003-2008 imacat. All rights reserved. This program is free
+Copyright (c) 2003-2019 imacat. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms
as Perl itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/t/00-signature.t
new/Locale-Maketext-Gettext-1.29/t/00-signature.t
--- old/Locale-Maketext-Gettext-1.28/t/00-signature.t 2005-04-23
21:35:24.000000000 +0200
+++ new/Locale-Maketext-Gettext-1.29/t/00-signature.t 2019-09-09
16:33:48.000000000 +0200
@@ -1,17 +1,24 @@
#!/usr/bin/perl
+
use strict;
print "1..1\n";
-if (!-s 'SIGNATURE') {
+$ENV{TEST_SIGNATURE} = 1;
+if (!$ENV{TEST_SIGNATURE}) {
+ print "ok 1 # skip Set the environment variable",
+ " TEST_SIGNATURE to enable this test\n";
+}
+elsif (!-s 'SIGNATURE') {
print "ok 1 # skip No signature file found\n";
}
elsif (!eval { require Module::Signature; 1 }) {
print "ok 1 # skip ",
- "Next time around, consider install Module::Signature, ",
- "so you can verify the integrity of this distribution.\n";
+ "Next time around, consider install Module::Signature, ",
+ "so you can verify the integrity of this distribution.\n";
}
-elsif (!eval { require Socket; Socket::inet_aton('pgp.mit.edu') }) {
- print "ok 1 # skip Cannot connect to the keyserver\n";
+elsif (!eval { require Socket; Socket::inet_aton('pool.sks-keyservers.net') })
{
+ print "ok 1 # skip ",
+ "Cannot connect to the keyserver\n";
}
else {
(Module::Signature::verify() == Module::Signature::SIGNATURE_OK())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Locale-Maketext-Gettext-1.28/t/12-cache.t
new/Locale-Maketext-Gettext-1.29/t/12-cache.t
--- old/Locale-Maketext-Gettext-1.28/t/12-cache.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Locale-Maketext-Gettext-1.29/t/12-cache.t 2019-09-09
16:01:53.000000000 +0200
@@ -0,0 +1,71 @@
+#! /usr/bin/perl -w
+# Basic test suite
+# Copyright (c) 2019 imacat. All rights reserved. This program is free
+# software; you can redistribute it and/or modify it under the same terms
+# as Perl itself.
+
+use 5.008;
+use strict;
+use warnings;
+use Test;
+
+BEGIN { plan tests => 4 }
+
+use FindBin;
+use File::Spec::Functions qw(catdir catfile);
+use lib $FindBin::Bin;
+use vars qw($LOCALEDIR $r);
+$LOCALEDIR = catdir($FindBin::Bin, "locale");
+
+# bindtextdomain
+$r = eval {
+ my ($mo_file0, $mo_file1, $size, $atime, $mtime0, $mtime1);
+ my ($FH, $content);
+
+ $mo_file0 = catfile($LOCALEDIR, "en", "LC_MESSAGES", "test.mo");
+ $mo_file1 = catfile($LOCALEDIR, "en", "LC_MESSAGES", "test-cache.mo");
+ ($atime, $mtime0, $size) = (stat $mo_file0)[8,9,7];
+ open $FH, $mo_file0 or die "$mo_file0: $!";
+ read $FH, $content, $size or die "$mo_file0: $!";
+ close $FH or die "$mo_file0: $!";
+ open $FH, ">$mo_file1" or die "$mo_file1: $!";
+ print $FH $content or die "$mo_file1: $!";
+ close $FH or die "$mo_file1: $!";
+ utime $atime, $mtime0, $mo_file1 or die "$mo_file1: $!";
+
+ require T_L10N;
+ @_ = qw();
+ $_ = T_L10N->get_handle("en");
+ $_->bindtextdomain("test-cache", $LOCALEDIR);
+ $_->textdomain("test-cache");
+ $_[0] = $_->maketext("Hello, world!");
+
+ # Update the file but keep the size and mtime
+ open $FH, "+<$mo_file1" or die "$mo_file1: $!";
+ read $FH, $content, $size or die "$mo_file1: $!";
+ $content =~ s/Hiya/HiYa/;
+ seek $FH, 0, 0 or die "$mo_file1: $!";
+ print $FH $content or die "$mo_file1: $!";
+ close $FH or die "$mo_file1: $!";
+ ($mtime1, $size) = (stat $mo_file1)[9,7];
+ utime $atime, $mtime0, $mo_file1 or die "$mo_file1: $!";
+ $_->textdomain("test-cache");
+ $_[1] = $_->maketext("Hello, world!");
+
+ # Update the mtime
+ utime $atime, $mtime1, $mo_file1 or die "$mo_file1: $!";
+ $_->textdomain("test-cache");
+ $_[2] = $_->maketext("Hello, world!");
+
+ # Remove the file
+ unlink $mo_file1 or die "$mo_file1: $!";
+ return 1;
+};
+# 1
+ok($r, 1);
+# 2
+ok($_[0], "Hiya :)");
+# 3 - cache not updated
+ok($_[1], "Hiya :)");
+# 4 - cache updated
+ok($_[2], "HiYa :)");