mirror of
https://github.com/openRuyi-Project/openRuyi.git
synced 2026-09-01 02:44:51 +00:00
@@ -0,0 +1,39 @@
|
||||
From 4cf9c5b90fe8bba7fca48d51ef3885bd411b08ef Mon Sep 17 00:00:00 2001
|
||||
From: Philip Taron <philip.taron@gmail.com>
|
||||
Date: Sat, 21 Mar 2026 10:14:26 -0700
|
||||
Subject: [PATCH] Fix msginit compatibility with gettext >= 1.0.
|
||||
|
||||
gettext 1.0 changed msginit behavior: when the output PO file already
|
||||
exists, msginit now merges into it like msgmerge instead of failing
|
||||
with an error. This breaks po4a because it passes an empty PO file as
|
||||
the output target; msginit merges into the empty file and produces a PO
|
||||
with stripped headers and corrupted content.
|
||||
|
||||
Remove the output file before calling msginit when it exists and is
|
||||
empty, so that msginit always creates a fresh PO file with proper
|
||||
headers.
|
||||
|
||||
* po4a: Before calling msginit, unlink the output file if it exists
|
||||
and is empty.
|
||||
|
||||
See: https://github.com/mquinson/po4a/issues/636
|
||||
See: https://savannah.gnu.org/news/?id=10853
|
||||
---
|
||||
po4a | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/po4a b/po4a
|
||||
index 09edb9a13..c55b74b70 100755
|
||||
--- a/po4a
|
||||
+++ b/po4a
|
||||
@@ -1875,6 +1875,10 @@ if ( not $po4a_opts{"no-update"} ) {
|
||||
}
|
||||
|
||||
my $read_pot_filename = find_input_file($pot_filename);
|
||||
+ # Remove the output file if it exists (e.g. as an empty file),
|
||||
+ # because gettext >= 1.0's msginit merges into existing files
|
||||
+ # instead of overwriting, producing broken PO headers.
|
||||
+ unlink $outfile if ( -e $outfile && -z $outfile );
|
||||
my $cmd =
|
||||
"msginit$Config{_exe} -i \"$read_pot_filename\" --locale $lang -o \"$outfile\" --no-translator >$devnull";
|
||||
run_cmd($cmd);
|
||||
@@ -0,0 +1,67 @@
|
||||
# SPDX-FileCopyrightText: (C) 2026 Institute of Software, Chinese Academy of Sciences (ISCAS)
|
||||
# SPDX-FileCopyrightText: (C) 2026 openRuyi Project Contributors
|
||||
# SPDX-FileContributor: Suyun <ziyu.oerv@isrc.iscas.ac.cn>
|
||||
# SPDX-FileContributor: misaka00251 <liuxin@iscas.ac.cn>
|
||||
#
|
||||
# SPDX-License-Identifier: MulanPSL-2.0
|
||||
|
||||
Name: po4a
|
||||
Version: 0.74
|
||||
Release: %autorelease
|
||||
Summary: Tools for helping translation of documentation
|
||||
License: GPL-2.0-or-later
|
||||
URL: https://po4a.org/
|
||||
VCS: git:https://github.com/mquinson/po4a.git
|
||||
#!RemoteAsset: sha256:25fc323f2ba37bbd48c3af0ebf49952644b0e468261f98633e91219a838fe7c2
|
||||
Source0: https://github.com/mquinson/po4a/releases/download/v%{version}/po4a-%{version}.tar.gz
|
||||
BuildArch: noarch
|
||||
BuildSystem: perlbuild
|
||||
|
||||
# https://github.com/mquinson/po4a/issues/636
|
||||
Patch0: 0001-Fix-msginit-compatibility-with-gettext-1.0.patch
|
||||
|
||||
BuildOption(build): --installdirs=vendor
|
||||
BuildOption(install): --destdir=%{buildroot} --create_packlist=0
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: perl-macros
|
||||
BuildRequires: perl-rpm-macros
|
||||
BuildRequires: perl-rpm-packaging
|
||||
BuildRequires: perl >= 5.8.1
|
||||
BuildRequires: perl(Locale::gettext) >= 1.01
|
||||
BuildRequires: perl(Module::Build) >= 0.42
|
||||
BuildRequires: perl(Pod::Parser)
|
||||
BuildRequires: perl(SGMLS)
|
||||
BuildRequires: perl(Term::ReadKey)
|
||||
BuildRequires: perl(Text::WrapI18N)
|
||||
BuildRequires: perl(Unicode::GCString)
|
||||
BuildRequires: perl(Unicode::LineBreak)
|
||||
BuildRequires: perl(YAML::Tiny)
|
||||
BuildRequires: docbook-xsl
|
||||
BuildRequires: libxslt
|
||||
# For tests
|
||||
BuildRequires: perl(Syntax::Keyword::Try)
|
||||
BuildRequires: opensp
|
||||
BuildRequires: docbook-dtds
|
||||
# We need kpsewhich
|
||||
BuildRequires: texlive-latex
|
||||
|
||||
%description
|
||||
po4a (PO for anything) eases the translation of documentation and other
|
||||
textual content. It converts documentation to PO files for translation,
|
||||
and then back to the original format from translated PO files.
|
||||
|
||||
%build -p
|
||||
# Replace online docbook.xsl URL with local path for offline build
|
||||
sed -i 's|http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl|file://%{_datadir}/sgml/docbook/xsl-stylesheets-1.79.2/manpages/docbook.xsl|' Po4aBuilder.pm
|
||||
|
||||
%files -f %{name}.files
|
||||
%doc README* TODO changelog
|
||||
%{_mandir}/*/man1/po4a*.1*
|
||||
%{_mandir}/*/man1/msguntypot.1*
|
||||
%{_mandir}/*/man3/Locale::Po4a::*.3*
|
||||
%{_mandir}/*/man7/po4a.7*
|
||||
%{_datadir}/locale/
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
Reference in New Issue
Block a user