gnucash master: Tweak cmake/autotools so they produce the same output for POTFILES.in
Geert Janssens
gjanssens at code.gnucash.org
Thu Aug 3 12:19:32 EDT 2017
Updated via https://github.com/Gnucash/gnucash/commit/16b98cc5 (commit)
from https://github.com/Gnucash/gnucash/commit/96642c60 (commit)
commit 16b98cc5a461726fdb2f34cd7ddd8b12c782ca54
Author: Geert Janssens <geert at kobaltwit.be>
Date: Thu Aug 3 12:02:49 2017 +0200
Tweak cmake/autotools so they produce the same output for POTFILES.in
diff --git a/make-gnucash-potfiles.in b/make-gnucash-potfiles.in
index 12c6a10..576c0bb 100644
--- a/make-gnucash-potfiles.in
+++ b/make-gnucash-potfiles.in
@@ -33,23 +33,15 @@ close IN;
# * case-insensitive
# * ignoring punctuation (-,_,.)
#
-sub sort_func
-{
- my $stripped_a = $a;
- my $stripped_b = $b;
- $stripped_a =~ s/[-_.]//g;
- $stripped_b =~ s/[-_.]//g;
+# This sort function has been extracted into a separate file (util/elegant-sort.pl)
+# in order to use the same algorithm in both cmake and autools based builds
- lc ($stripped_a) cmp lc ($stripped_b)
- ||
- lc ($a) cmp lc ($b)
-}
-
-my @possible_files = sort sort_func
- `cd @-SRCDIR-@ && find src lib -name '*.c' \\
+my @possible_files = `cd @-SRCDIR-@ && \\
+ find src lib -name '*.c' \\
-o -name '*.cpp' -o -name '*.glade' \\
-o -name '*.desktop.in' -o -name '*.keys.in' \\
- -o -name '*.gschema.xml.in.in' -o -name '*.scm'`;
+ -o -name '*.gschema.xml.in.in' -o -name '*.scm' \\
+ | util/elegant-sort.pl`;
## For perl files add the following:
# -o -name '*.pl'
@@ -71,7 +63,7 @@ foreach my $file (@possible_files) {
}
}
next if $ignores{$path . $name};
-
+
# Ignore unreadable files, e.g. dangling symlinks
next unless (-r "@-SRCDIR-@/" . $path . $name);
@@ -80,7 +72,7 @@ foreach my $file (@possible_files) {
if ($file =~ m/.gschema.xml.in.in/ ){
$type = "[type: gettext/gsettings]";
}
-
+
print $type . $path . $name . "\n";
}
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index b22e91c..77bd40c 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -66,7 +66,7 @@ ENDFUNCTION()
FUNCTION(MAKE_GNUCASH_POTFILES)
- SET(IGNORE_PATTERNS "gw-" "test" "experimental" "python-bindings" "swig-.*\\.c")
+ SET(IGNORE_PATTERNS "gw-" "test" "experimental" "python-bindings" "swig-.*\\.c" "^src/gnc/" "^src/optional/gtkmm")
# Create a list of candidate translation files
FILE(GLOB_RECURSE FILES_IN RELATIVE ${CMAKE_SOURCE_DIR}
@@ -76,7 +76,7 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
# Only consider files in the src/ directory. Also check against list of ignore patterns
SET(FILES "")
FOREACH(path ${FILES_IN})
- STRING(REGEX MATCH "^src" IS_SRC ${path})
+ STRING(REGEX MATCH "^(src/|lib)" IS_SRC ${path})
IF (IS_SRC)
SET(IS_IGNORED FALSE)
FOREACH(pattern ${IGNORE_PATTERNS})
@@ -107,7 +107,7 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
STRING(REPLACE ";" "\n" SORT_IN "${FILES}")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in.in "${SORT_IN}")
- EXECUTE_PROCESS(COMMAND "sort"
+ EXECUTE_PROCESS(COMMAND "${PERL_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/util/elegant-sort.pl"
INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in.in
OUTPUT_VARIABLE POTFILES_IN
)
@@ -116,7 +116,7 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
# Write out the final list.
# intltool-update insists that this file be in the source directory. :-(
SET(POTFILES_IN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in)
- FILE(WRITE ${POTFILES_IN_PATH} "# This is a list of files which contain tranlatable strings.
+ FILE(WRITE ${POTFILES_IN_PATH} "# This is a list of files which contain translatable strings.
# This file was generated by ../make-gnucash-potfiles.
")
@@ -134,8 +134,6 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
src/gnome/gnucash.desktop.in.in
src/libqof/qof/qofbookslots.h
doc/tip_of_the_day.list.in
-lib/goffice/go-charmap-sel.c
-lib/goffice/go-optionmenu.c
")
ENDFUNCTION()
@@ -203,4 +201,4 @@ ADD_CUSTOM_TARGET(check-po
-D PO_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-P check-po.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-)
\ No newline at end of file
+)
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 58efc79..27588ce 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -2,6 +2,7 @@
# not distributed.
src/backend/dbi/gncmod-backend-dbi.c
src/backend/xml/gncmod-backend-xml.c
+src/backend/xml/gncmod-backend-xml.cpp
src/gnome-utils/gnc-tree-model-selection.c
# These we don't want to translate because they're experimental:
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
index a428f41..2eb9d88 100644
--- a/util/CMakeLists.txt
+++ b/util/CMakeLists.txt
@@ -1,2 +1,2 @@
-SET_DIST_LIST(util_DIST gnc-vcs-info guile.c CMakeLists.txt)
\ No newline at end of file
+SET_DIST_LIST(util_DIST elegant-sort.pl gnc-vcs-info guile.c CMakeLists.txt)
diff --git a/util/elegant-sort.pl b/util/elegant-sort.pl
new file mode 100755
index 0000000..3ca6fb6
--- /dev/null
+++ b/util/elegant-sort.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+# -*- perl -*-
+#
+# Sort filenames in POTFILES.in in a consistent way
+# This reduces the amount of clutter in our version manangement system
+# The files will be sorted
+# * per directory
+# * case-insensitive
+# * ignoring punctuation (-,_,.)
+#
+sub sort_func
+{
+ my $stripped_a = $a;
+ my $stripped_b = $b;
+ $stripped_a =~ s/[-_.]//g;
+ $stripped_b =~ s/[-_.]//g;
+
+ lc ($stripped_a) cmp lc ($stripped_b)
+ ||
+ lc ($a) cmp lc ($b)
+}
+
+#open my $fh, '<', $ARGV[0];
+#my @raw_files = <$fh>;
+my @raw_files = <STDIN>;
+my @possible_files = sort sort_func @raw_files;
+print @possible_files;
Summary of changes:
make-gnucash-potfiles.in | 24 ++++++++----------------
po/CMakeLists.txt | 12 +++++-------
po/POTFILES.skip | 1 +
util/CMakeLists.txt | 2 +-
util/elegant-sort.pl | 27 +++++++++++++++++++++++++++
5 files changed, 42 insertions(+), 24 deletions(-)
create mode 100755 util/elegant-sort.pl
More information about the gnucash-changes
mailing list