Compare commits

...

No commits in common. "c8" and "c10s" have entirely different histories.
c8 ... c10s

22 changed files with 520 additions and 11 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

5
.gitignore vendored
View File

@ -1 +1,4 @@
SOURCES/intltool-0.51.0.tar.gz
intltool-0.41.1.tar.gz
/intltool-0.50.0.tar.gz
/intltool-0.50.2.tar.gz
/intltool-0.51.0.tar.gz

View File

@ -1 +0,0 @@
a0c3bcb99d1bcfc5db70f8d848232a47c47da090 SOURCES/intltool-0.51.0.tar.gz

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -0,0 +1,20 @@
--- intltool-0.35.5/intltool-merge.in.in.dont-duplicate-msgid 2007-03-21 13:10:28.000000000 -0400
+++ intltool-0.35.5/intltool-merge.in.in 2007-03-21 13:13:43.000000000 -0400
@@ -428,7 +428,7 @@
if (/^msgid "((\\.|[^\\]+)*)"/ )
{
- $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr;
+ $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr && $msgid ne $msgstr;
$msgid = "";
$msgstr = "";
@@ -455,7 +455,7 @@
$msgstr .= unescape_po_string($1) if $inmsgstr;
}
}
- $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr;
+ $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr && $msgstr ne $msgid;
}
}

View File

@ -0,0 +1,25 @@
--- trunk/intltool-update.in.in 2007/02/14 04:12:19 671
+++ trunk/intltool-update.in.in 2007/03/02 16:43:19 674
@@ -563,13 +563,21 @@
exit 1;
}
+sub isIntltoolExtractInPath
+{
+ my ($file) = @_;
+ # If either a file exists, or when run it returns 0 exit status
+ return 1 if ((-x $file) or (system("$file >/dev/null") == 0));
+ return 0;
+}
+
sub GenerateHeaders
{
my $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} || "intltool-extract";
## Generate the .h header files, so we can allow glade and
## xml translation support
- if (! -x "$EXTRACT")
+ if (! isIntltoolExtractInPath("$EXTRACT"))
{
print STDERR "\n *** The intltool-extract script wasn't found!"
."\n *** Without it, intltool-update can not generate files.\n";

View File

@ -0,0 +1,32 @@
diff -up intltool-0.35.5/intltool.m4.polkit intltool-0.35.5/intltool.m4
--- intltool-0.35.5/intltool.m4.polkit 2007-07-31 17:23:52.000000000 -0400
+++ intltool-0.35.5/intltool.m4 2007-07-31 17:24:20.000000000 -0400
@@ -65,6 +65,7 @@ INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.
INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
AC_SUBST(INTLTOOL_DESKTOP_RULE)
AC_SUBST(INTLTOOL_DIRECTORY_RULE)
@@ -84,6 +85,7 @@ AC_SUBST(INTLTOOL_CAVES_RULE)
AC_SUBST(INTLTOOL_SCHEMAS_RULE)
AC_SUBST(INTLTOOL_THEME_RULE)
AC_SUBST(INTLTOOL_SERVICE_RULE)
+AC_SUBST(INTLTOOL_POLICY_RULE)
# Use the tools built into the package, not the ones that are installed.
AC_SUBST(INTLTOOL_EXTRACT, '$(top_builddir)/intltool-extract')
diff -up intltool-0.35.5/intltool-update.in.in.polkit intltool-0.35.5/intltool-update.in.in
--- intltool-0.35.5/intltool-update.in.in.polkit 2007-07-31 17:10:52.000000000 -0400
+++ intltool-0.35.5/intltool-update.in.in 2007-07-31 17:21:45.000000000 -0400
@@ -71,7 +71,8 @@ my $xml_support =
"sheet(?:\\.in)+|". # ?
"schemas(?:\\.in)+|". # GConf specific
"pong(?:\\.in)+|". # DEPRECATED: PONG is not used [by GNOME] any longer.
-"kbd(?:\\.in)+"; # GOK specific.
+"kbd(?:\\.in)+|". # GOK specific.
+"policy(?:\\.in)+"; # PolicyKit files
my $ini_support =
"icon(?:\\.in)+|". # http://www.freedesktop.org/Standards/icon-theme-spec

View File

@ -1,11 +1,10 @@
Name: intltool
Summary: Utility for internationalizing various kinds of data files
Version: 0.51.0
Release: 11%{?dist}
License: GPLv2 with exceptions
Group: Development/Tools
Release: 29%{?dist}
License: GPL-2.0-or-later WITH Autoconf-exception-generic
#VCS: bzr:https://code.edge.launchpad.net/~intltool/intltool/trunk
Source: http://edge.launchpad.net/intltool/trunk/%{version}/+download/intltool-%{version}.tar.gz
Source: https://edge.launchpad.net/intltool/trunk/%{version}/+download/intltool-%{version}.tar.gz
URL: https://launchpad.net/intltool
BuildArch: noarch
Requires: patch
@ -18,6 +17,7 @@ BuildRequires: perl-generators
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(XML::Parser)
BuildRequires: gettext
BuildRequires: make
# http://bugzilla.gnome.org/show_bug.cgi?id=568845
# Dropping this patch per the last comment on that thread:
# Martin Pitt: As the reporter of the bug I close this, as the new API du jour is gsettings,
@ -46,10 +46,10 @@ them in the po files.
%build
%configure
make %{?_smp_mflags}
%make_build
%install
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
%make_install
%check
if ! make check; then
@ -69,6 +69,61 @@ fi
%{_mandir}/man8/intltool*.8*
%changelog
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 0.51.0-29
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Tue Aug 6 2024 Manish Tiwari <matiwari@redhat.com> - 0.51.0-28
- CI gating tests migration to tmt
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 0.51.0-27
- Bump release for June 2024 mass rebuild
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Sep 21 2023 Jens Petersen <petersen@redhat.com> - 0.51.0-24
- SPDX migration of license tag
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Jun 29 2018 Jitka Plesnikova <jplesnik@redhat.com> - 0.51.0-12
- Perl 5.28 rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.51.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

5
plans/basic.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

153
schemas-merge.patch Normal file
View File

@ -0,0 +1,153 @@
diff -up intltool-0.40.6/intltool-merge.in.schemas intltool-0.40.6/intltool-merge.in
--- intltool-0.40.6/intltool-merge.in.schemas 2009-02-14 17:12:28.000000000 -0500
+++ intltool-0.40.6/intltool-merge.in 2009-04-27 01:41:11.099450891 -0400
@@ -38,8 +38,9 @@ my $PACKAGE = "@PACKAGE@";
my $VERSION = "@VERSION@";
## Loaded modules
-use strict;
+use strict;
use Getopt::Long;
+use Cwd;
use Text::Wrap;
use File::Basename;
use Encode;
@@ -68,6 +69,9 @@ my $PASS_THROUGH_ARG = 0;
my $UTF8_ARG = 0;
my $MULTIPLE_OUTPUT = 0;
my $cache_file;
+my $GETTEXT_PACKAGE = "";
+my %varhash = ();
+my $SRCDIR = $ENV{"srcdir"} || ".";
## Handle options
GetOptions
@@ -87,7 +91,8 @@ GetOptions
"pass-through|p" => \$PASS_THROUGH_ARG,
"utf8|u" => \$UTF8_ARG,
"multiple-output|m" => \$MULTIPLE_OUTPUT,
- "cache|c=s" => \$cache_file
+ "cache|c=s" => \$cache_file,
+ "gettext-package|g=s" => \$GETTEXT_PACKAGE
) or &error;
my $PO_DIR;
@@ -103,6 +108,8 @@ my $w = "[-A-Za-z0-9._:]";
# XML quoted string contents
my $q = "[^\\\"]*";
+my $MODULE = $GETTEXT_PACKAGE || FindPackageName() || "unknown";
+
## Check for options.
if ($VERSION_ARG)
@@ -216,6 +223,8 @@ Other options:
a single file containing all localized elements
-c, --cache=FILE specify cache file name
(usually \$top_builddir/po/.intltool-merge-cache)
+ -g, --gettext-package=NAME
+ specify gettext domain, needed for --schemas-style
-q, --quiet suppress most messages
--help display this help and exit
--version output version information and exit
@@ -241,6 +250,25 @@ sub print_message
}
+sub FindPackageName
+{
+ my $name = "";
+
+ my $conf_source; {
+ local (*IN);
+ open (IN, "<Makefile") || return $name;
+ seek (IN, 0, 0);
+ local $/; # slurp mode
+ $conf_source = <IN>;
+ close IN;
+ }
+
+ $name = $1 if $conf_source =~ /^GETTEXT_PACKAGE = \[?([^\n\]]+)/m;
+
+ return $name if $name;
+}
+
+
sub preparation
{
$PO_DIR = $ARGV[0];
@@ -1246,50 +1274,41 @@ sub schemas_merge_translations
my $short_string = $9 ? $9 : '';
my $long_string = $12 ? $12 : '';
- print OUTPUT "$locale_start_spaces$c_default_block";
-
$default_string =~ s/\s+/ /g;
- $default_string = entity_decode($default_string);
$short_string =~ s/\s+/ /g;
- $short_string = entity_decode($short_string);
$long_string =~ s/\s+/ /g;
- $long_string = entity_decode($long_string);
- for my $lang (sort keys %po_files_by_lang)
- {
- my $default_translation = $translations{$lang, $default_string};
- my $short_translation = $translations{$lang, $short_string};
- my $long_translation = $translations{$lang, $long_string};
-
- next if (!$default_translation && !$short_translation &&
- !$long_translation);
-
- print OUTPUT "\n$locale_start_spaces<locale name=\"$lang\">";
+ print OUTPUT "$locale_start_spaces<gettext_domain>$MODULE</gettext_domain>";
+ print OUTPUT "$locale_start_spaces<locale name=\"C\">";
print OUTPUT "$default_spaces";
-
- if ($default_translation)
- {
- $default_translation = entity_encode($default_translation);
- print OUTPUT "<default>$default_translation</default>";
+ if ($default_string) {
+ print OUTPUT "<default>$default_string</default>";
}
+ print OUTPUT "$short_spaces";
+ if ($short_string) {
+ print OUTPUT "<short>$short_string</short>";
+ }
+ print OUTPUT "$long_spaces";
+ if ($long_string) {
+ print OUTPUT "<long>$long_string</long>";
+ }
+ print OUTPUT "$locale_end_spaces</locale>";
- print OUTPUT "$short_spaces";
+ $default_string = entity_decode($default_string);
+ $short_string = entity_decode($short_string);
+ $long_string = entity_decode($long_string);
- if ($short_translation)
- {
- $short_translation = entity_encode($short_translation);
- print OUTPUT "<short>$short_translation</short>";
- }
+ for my $lang (sort keys %po_files_by_lang)
+ {
+ my $default_translation = $translations{$lang, $default_string};
- print OUTPUT "$long_spaces";
+ next if (!$default_translation || ($default_translation eq $default_string));
- if ($long_translation)
- {
- $long_translation = entity_encode($long_translation);
- print OUTPUT "<long>$long_translation</long>";
- }
+ $default_translation = entity_encode($default_translation);
+ print OUTPUT "\n$locale_start_spaces<locale name=\"$lang\">";
+ print OUTPUT "$default_spaces<default>$default_translation</default>";
print OUTPUT "$locale_end_spaces</locale>";
}
}
diff -up intltool-0.40.6/tests/results/test.schemas intltool-0.40.6/tests/results/test

1
sources Normal file
View File

@ -0,0 +1 @@
12e517cac2b57a0121cda351570f1e63 intltool-0.51.0.tar.gz

19
tests/cases/context.xml Normal file
View File

@ -0,0 +1,19 @@
<test>
<entry>
<_name>Foo</_name>
</entry>
<entry>
<!-- This is the comment on the first Bar -->
<_name msgctxt="1">
Bar</_name>
</entry>
<entry>
<!-- This is the comment on the second Bar -->
<_name msgctxt="2">
Bar</_name>
</entry>
<entry>
<!-- This is the comment on Baz -->
<_name>Baz</_name>
</entry>
</test>

View File

@ -0,0 +1,17 @@
<test>
<entry>
<_name>Foo</_name>
</entry>
<entry>
<!-- This is the comment on the first Bar -->
<_name msgctxt="1">Bar</_name>
</entry>
<entry>
<!-- This is the comment on the second Bar -->
<_name msgctxt="2">Bar</_name>
</entry>
<entry>
<!-- This is the comment on Baz -->
<_name>Baz</_name>
</entry>
</test>

View File

@ -0,0 +1,7 @@
char *s = N_("Foo");
/* This is the comment on the first Bar */
char *s = C_("1", "Bar");
/* This is the comment on the second Bar */
char *s = C_("2", "Bar");
/* This is the comment on Baz */
char *s = N_("Baz");

109
tests/intltool_tests.py Normal file
View File

@ -0,0 +1,109 @@
#!/usr/bin/python3
import logging
import subprocess
from difflib import Differ
logging.basicConfig(level=logging.INFO)
COMMANDS = [
"intltool-extract",
"intltool-merge"
]
INPUT_FILE = "cases/context.xml.in"
def test_intltool_installation(cmd: str):
"""
Check if intltool is installed correctly
"""
try:
intltool_cmd = subprocess.Popen([cmd], stdout=subprocess.PIPE)
intltool_cmd_execution_response = intltool_cmd.communicate()
assert "Usage" in str(intltool_cmd_execution_response)
except FileNotFoundError:
logging.error(f"Either {cmd} is not installed or not accessible.")
except OSError:
logging.error(f"Some OSError occurred while executing {cmd}")
except AssertionError:
logging.error(f"[CMD] output does not include text: Usage.")
else:
logging.info(f"Execution of {cmd} succeed. Test Passed.")
def test_intltool_extract(cmd, input_file):
"""
Check intltool extract behavior
"""
try:
intltool_extract = subprocess.Popen(
[cmd, "--type=gettext/xml", input_file, "--update"],
stdout=subprocess.PIPE)
intltool_extract_execution_response = intltool_extract.communicate()
assert "Wrote" in str(intltool_extract_execution_response)
except AssertionError:
logging.error(f"Writing output file for {input_file} file failed.")
except Exception as e:
logging.error(e)
else:
logging.info(f"Writing output file for {input_file} succeed.")
comparison_test_pass = True
with open("{}.h".format(input_file)) as output_file, open("results/{}.h".format("context.xml.in")) as refer_file:
differ = Differ()
for line in differ.compare(output_file.readlines(), refer_file.readlines()):
if line.startswith("+") or line.startswith("-"):
comparison_test_pass = False
try:
assert comparison_test_pass
except AssertionError:
logging.error("Extracted file does NOT match with the result. Test failed.")
else:
logging.info("Extracted file does match with the result. Test passed.")
def test_intltool_merge(cmd, input_file):
"""
Check intltool merge behavior
"""
merged_file = "context.xml"
try:
intltool_merge = subprocess.Popen(
[cmd, "-o", "cases", input_file, "cases/{}".format(merged_file)],
stdout=subprocess.PIPE)
intltool_merge_execution_response = intltool_merge.communicate()
assert "Merging" in str(intltool_merge_execution_response)
except AssertionError:
logging.error(f"Writing output file for {input_file} file failed.")
except Exception as e:
logging.error(e)
else:
logging.info(f"Writing output file for {input_file} succeed.")
comparison_test_pass = True
with open("cases/{}".format(merged_file)) as output_file, open("results/{}".format(merged_file)) as refer_file:
differ = Differ()
for line in differ.compare(output_file.readlines(), refer_file.readlines()):
if line.startswith("+") or line.startswith("-"):
comparison_test_pass = False
try:
assert comparison_test_pass
except AssertionError:
logging.error("Merged file does NOT match with the result. Test failed.")
else:
logging.info("Merged file does match with the result. Test passed.")
if __name__ == "__main__":
"""
Executes test cases
"""
logging.info("Executing test cases for Intltool..")
for CMD in COMMANDS:
test_intltool_installation(CMD)
test_intltool_extract(COMMANDS[0], INPUT_FILE)
test_intltool_merge(COMMANDS[1], INPUT_FILE)
logging.info("Tests execution of Intltool completed!")

6
tests/main.fmf Normal file
View File

@ -0,0 +1,6 @@
summary: Run intltool test
test: ./test.sh
framework: beakerlib
require:
- intltool
- python3

19
tests/results/context.xml Normal file
View File

@ -0,0 +1,19 @@
<test>
<entry>
<_name>Foo</_name>
</entry>
<entry>
<!-- This is the comment on the first Bar -->
<_name msgctxt="1">
Bar</_name>
</entry>
<entry>
<!-- This is the comment on the second Bar -->
<_name msgctxt="2">
Bar</_name>
</entry>
<entry>
<!-- This is the comment on Baz -->
<_name>Baz</_name>
</entry>
</test>

View File

@ -0,0 +1,7 @@
char *s = N_("Foo");
/* This is the comment on the first Bar */
char *s = C_("1", "Bar");
/* This is the comment on the second Bar */
char *s = C_("2", "Bar");
/* This is the comment on Baz */
char *s = N_("Baz");

25
tests/test.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="intltool"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "cp -r cases results intltool_tests.py $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlLog "Run intltool_tests.py"
rlRun "python3 intltool_tests.py"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd