diff --git a/.gitignore b/.gitignore index 6e180d9..e11a1eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ ocaml-gettext-0.3.3.tar.gz /ocaml-gettext-0.3.4.tar.gz /ocaml-gettext-0.3.5.tar.gz +/0.3.7.tar.gz diff --git a/0001-pr_gettext-stop-tracking-and-printing-untranslated-s.patch b/0001-pr_gettext-stop-tracking-and-printing-untranslated-s.patch new file mode 100644 index 0000000..511eb3b --- /dev/null +++ b/0001-pr_gettext-stop-tracking-and-printing-untranslated-s.patch @@ -0,0 +1,109 @@ +From 35d2d7381c7101bb73d0b7f00fea06442c7b2ab8 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 29 Aug 2017 18:29:34 +0200 +Subject: [PATCH 1/3] pr_gettext: stop tracking (and printing) untranslated + strings + +Do not collect anymore the information of untranslated strings, since it +is only used to print all of them at the end of the message extraction. + +While I understand the reason why this was done (i.e. to discover +potentially untranslated user strings), this is something that just +causes lots of output in complex projects, since strings are basically +used for many non-UI tasks (say Str, Sys.command, etc), so the actual +result is that there are lots of false positive. Also, this is not +something xgettext (from GNU gettext) does. +--- + libgettext-ocaml/pr_gettext.ml | 44 ------------------------------------------ + 1 file changed, 44 deletions(-) + +diff --git a/libgettext-ocaml/pr_gettext.ml b/libgettext-ocaml/pr_gettext.ml +index c44933f..d78cf21 100644 +--- a/libgettext-ocaml/pr_gettext.ml ++++ b/libgettext-ocaml/pr_gettext.ml +@@ -71,17 +71,10 @@ struct + module Loc = Syntax.Loc + module Ast = Syntax.Ast + +- type untranslated_t = +- { +- str: string; (* Real string, not OCaml one *) +- locations: (string * int) list; (* Location in the file *) +- } +- + type t = + { + po_content: po_content; + translated: SetString.t; +- untranslated: untranslated_t MapString.t; + } + + let string_of_ocaml_string str = +@@ -91,29 +84,6 @@ struct + "%S" + (fun s -> s) + +- let string_not_translated t ocaml_str = +- not (SetString.mem ocaml_str t.translated) +- +- let add_untranslated t loc ocaml_str = +- let cur = +- try +- MapString.find ocaml_str t.untranslated +- with Not_found -> +- { +- str = string_of_ocaml_string ocaml_str; +- locations = []; +- } +- in +- let untranslated = +- MapString.add +- ocaml_str +- {cur with +- locations = +- (Loc.file_name loc, Loc.start_line loc) :: cur.locations} +- t.untranslated +- in +- {t with untranslated = untranslated} +- + + let add_translation t loc ocaml_singular plural_opt domain = + let filepos = +@@ -164,15 +134,6 @@ struct + | Some f -> open_out f + | None -> stdout + in +- MapString.iter +- (fun _ {str = str; locations = locs} -> +- List.iter +- (fun (fn, lineno) -> +- Printf.eprintf +- "%s:%d String %S not translated\n%!" +- fn lineno str) +- locs) +- t.untranslated; + Marshal.to_channel fd t.po_content [] + + (* Check if the given node belong to the given functions *) +@@ -197,7 +158,6 @@ struct + val t = + { + po_content = empty_po; +- untranslated = MapString.empty; + translated = SetString.empty; + } + +@@ -234,10 +194,6 @@ struct + (* Add a plural / defined domain string *) + {< t = add_translation t loc singular (Some plural) (Some domain) >} + +- | <:expr@loc<$str:str$>> when +- string_not_translated t str -> +- {< t = add_untranslated t loc str >} +- + | e -> super#expr e + + end +-- +2.13.2 + diff --git a/0002-pr_gettext-stop-printing-extracted-strings.patch b/0002-pr_gettext-stop-printing-extracted-strings.patch new file mode 100644 index 0000000..6d656d9 --- /dev/null +++ b/0002-pr_gettext-stop-printing-extracted-strings.patch @@ -0,0 +1,26 @@ +From 3f4fc73c2a0315c2da16dee7db0fcb2766f55d3c Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 29 Aug 2017 18:36:10 +0200 +Subject: [PATCH 2/3] pr_gettext: stop printing extracted strings + +They are written in the pot file already, no need to print them to +stderr (even though they are not errors). +--- + libgettext-ocaml/pr_gettext.ml | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/libgettext-ocaml/pr_gettext.ml b/libgettext-ocaml/pr_gettext.ml +index d78cf21..47d93e5 100644 +--- a/libgettext-ocaml/pr_gettext.ml ++++ b/libgettext-ocaml/pr_gettext.ml +@@ -78,7 +78,6 @@ struct + } + + let string_of_ocaml_string str = +- prerr_endline str; + Scanf.sscanf + (Printf.sprintf "\"%s\"" str) + "%S" +-- +2.13.2 + diff --git a/0003-add-more-generated-files-to-.gitignore.patch b/0003-add-more-generated-files-to-.gitignore.patch new file mode 100644 index 0000000..00b410c --- /dev/null +++ b/0003-add-more-generated-files-to-.gitignore.patch @@ -0,0 +1,44 @@ +From 202bf1e00eaa533e133c29b509d77cdfb7c13f5e Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 29 Aug 2017 18:55:37 +0200 +Subject: [PATCH 3/3] add more generated files to .gitignore + +Make sure all the files generated during a build are properly ignored +from the git status. +--- + .gitignore | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/.gitignore b/.gitignore +index d853d40..87821c3 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -1,3 +1,12 @@ ++*.a ++*.cma ++*.cmi ++*.cmo ++*.cmx ++*.cmxa ++*.o ++*.so ++*_parser.output + /_build/ + /setup.data + /setup.log +@@ -7,6 +16,12 @@ + /configure + /libgettext-ocaml/META + /libgettext-ocaml/gettextConfig.ml ++/libgettext-ocaml/gettextPo_parser.mli + /config.log + /config.status ++/po/*.mo + /po/fr.po.bak ++/doc/*.1 ++/doc/*.5 ++/ocaml-gettext/ocaml-gettext ++/ocaml-gettext/ocaml-xgettext +-- +2.13.2 + diff --git a/ocaml-gettext-0.3.5-disable-warning-31.patch b/ocaml-gettext-0.3.5-disable-warning-31.patch deleted file mode 100644 index 7b07266..0000000 --- a/ocaml-gettext-0.3.5-disable-warning-31.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ocaml-gettext-0.3.5.old/ConfMakefile.in 2014-08-04 22:33:52.000000000 +0100 -+++ ocaml-gettext-0.3.5/ConfMakefile.in 2016-11-04 16:47:56.012135630 +0000 -@@ -37,7 +37,7 @@ - OCAMLFIND_COMMANDS = "ocamlc=@OCAMLC@ \ - ocamlopt=@OCAMLOPT@ \ - ocamldep=@OCAMLDEP@" --OCAMLC = @OCAMLFIND@ ocamlc -+OCAMLC = @OCAMLFIND@ ocamlc -w -31 - OCAMLOPT = @OCAMLFIND@ ocamlopt - OCAMLDEP = @OCAMLFIND@ ocamldep - OCAMLBEST = @OCAMLBEST@ diff --git a/ocaml-gettext.spec b/ocaml-gettext.spec index 35c505a..14a033d 100644 --- a/ocaml-gettext.spec +++ b/ocaml-gettext.spec @@ -1,18 +1,19 @@ %global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) Name: ocaml-gettext -Version: 0.3.5 -Release: 18%{?dist} +Version: 0.3.7 +Release: 1%{?dist} Summary: OCaml library for i18n License: LGPLv2+ with exceptions -URL: http://forge.ocamlcore.org/projects/ocaml-gettext +URL: https://github.com/gildor478/ocaml-gettext -Source0: https://forge.ocamlcore.org/frs/download.php/1433/%{name}-%{version}.tar.gz +Source0: https://github.com/gildor478/%{name}/archive/%{version}.tar.gz -Patch1: ocaml-gettext-0.3.4-use-ocamlopt-g.patch -# Disable warning 31, so we can compile (with warnings) on OCaml 4.04. -Patch2: ocaml-gettext-0.3.5-disable-warning-31.patch +Patch0: ocaml-gettext-0.3.4-use-ocamlopt-g.patch +Patch0001: 0001-pr_gettext-stop-tracking-and-printing-untranslated-s.patch +Patch0002: 0002-pr_gettext-stop-printing-extracted-strings.patch +Patch0003: 0003-add-more-generated-files-to-.gitignore.patch BuildRequires: ocaml >= 4.00.1 BuildRequires: ocaml-findlib-devel >= 1.3.3-3 @@ -29,6 +30,7 @@ BuildRequires: ocaml-ounit-devel BuildRequires: ocaml-camomile-devel >= 0.8.1 BuildRequires: ocaml-camomile-data %endif +BuildRequires: autoconf, automake %if !0%{?rhel} # ocaml-gettext program needs camomile data files @@ -90,9 +92,9 @@ signature files for developing applications that use %prep %setup -q +%autopatch -p1 -%patch1 -p1 -%patch2 -p1 +autoreconf -i %build @@ -203,6 +205,11 @@ chrpath --delete $OCAMLFIND_DESTDIR/stublibs/dll*.so %changelog +* Sat Sep 23 2017 Richard W.M. Jones - 0.3.7-1 +- Update to new upstream version 0.3.7. +- New URL. +- Include upstream patches since 0.3.7 was released. + * Wed Aug 30 2017 Richard W.M. Jones - 0.3.5-18 - Subpackage ocaml-gettext-camomile-devel should depend on ocaml-gettext-camomile (thanks: Pino Toscano). diff --git a/sources b/sources index d950627..9645c1e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3c3c5156578104819b486584aa14f807 ocaml-gettext-0.3.5.tar.gz +SHA512 (0.3.7.tar.gz) = 1358320359b9d2f3fd97a47d69b2a619942a65605c1e5cbf25e33ef42a10273167b526bca15e6c9523b87d8ea9dfd3215334050ad8eb84a8c41d4feef880a27a