[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] maint.mk: speed up po_check
From: |
Ján Tomko |
Subject: |
[PATCH 1/4] maint.mk: speed up po_check |
Date: |
Tue, 26 Jul 2016 16:28:14 +0200 |
There is some logic in sc_po_check that skips files based on their
names, or existence of files with derived names.
Rewrite it in perl instead of shell to make the check faster.
---
ChangeLog | 9 +++++++++
top/maint.mk | 35 ++++++++++++++++++++---------------
2 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2414e8e..7dd78e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-07-26 Ján Tomko <address@hidden>
+
+ maint.mk: speed up po_check
+
+ There is some logic in sc_po_check that skips files based on their
+ names, or existence of files with derived names.
+
+ Rewrite it in perl instead of shell to make the check faster.
+
2016-07-15 Paul Eggert <address@hidden>
obstack: pacify GCC 6 with -Wnull-dereference
diff --git a/top/maint.mk b/top/maint.mk
index aa23364..a907bff 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -1123,6 +1123,24 @@ fix_po_file_diag = \
'you have changed the set of files with translatable diagnostics;\n\
apply the above patch\n'
+# Generate a list of files where we look for translatable strings
+perl_translatable_files_list_ = \
+ -e '$$ret = 0;' \
+ -e 'foreach $$file (@ARGV) {' \
+ -e ' \# The file extension should have one or two letters'
\
+ -e ' next if not $$file =~ /\...?$$/;' \
+ -e ' \# Ignore m4 and mk files' \
+ -e ' next if ($$file =~ /\.m[4k]$$/);' \
+ -e ' \# Ignore .c and .h files with a corresponding .l or .y file'
\
+ -e ' if ($$file =~ /\.[ch]$$/) {' \
+ -e ' $$base = $$file;' \
+ -e ' chop $$base;' \
+ -e ' next if (-e ($$base . "l") or -e ($$base . "y"));' \
+ -e ' }' \
+ -e ' \# Skip non-readable files' \
+ -e ' print "$$file " if -r $$file;' \
+ -e '}'
+
# Verify that all source files using _() (more specifically, files that
# match $(_gl_translatable_string_re)) are listed in po/POTFILES.in.
po_file ?= $(srcdir)/po/POTFILES.in
@@ -1132,21 +1150,8 @@ sc_po_check:
@if test -f $(po_file); then \
grep -E -v '^(#|$$)' $(po_file) \
| grep -v '^src/false\.c$$' | sort > address@hidden;
\
- files=; \
- for file in $$($(VC_LIST_EXCEPT)) $(generated_files); do \
- test -r $$file || continue; \
- case $$file in \
- *.m4|*.mk) continue ;; \
- *.?|*.??) ;; \
- *) continue;; \
- esac; \
- case $$file in \
- *.[ch]) \
- base=`expr " $$file" : ' \(.*\)\..'`; \
- { test -f $$base.l || test -f $$base.y; } && continue;; \
- esac; \
- files="$$files $$file"; \
- done; \
+ files=$$(perl $(perl_translatable_files_list_) \
+ $$($(VC_LIST_EXCEPT)) $(generated_files)) ; \
grep -E -l '$(_gl_translatable_string_re)' $$files \
| $(SED) 's|^$(_dot_escaped_srcdir)/||' | sort -u > address@hidden;
\
diff -u -L $(po_file) -L $(po_file) address@hidden address@hidden
\
--
2.7.3