From e25cdc9a4f9ac24ace0dbc1ab4fc84ca6a13efd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 29 Jul 2016 22:39:31 -0700 Subject: [PATCH] maint.mk: speed up sc_po_check sc_po_check would skip files based on their names, or on the existence of files with derived names. Rewrite it to use perl instead of shell to make the check faster. * top/maint.mk (perl_translatable_files_list_): Define. (sc_po_check): Use it. --- ChangeLog | 9 +++++++++ top/maint.mk | 32 +++++++++++++++++--------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2414e8e..dda0e50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2016-07-26 Ján Tomko + + maint.mk: speed up sc_po_check + sc_po_check would skip files based on their names, or on the + existence of files with derived names. Rewrite it to use perl + instead of shell to make the check faster. + * top/maint.mk (perl_translatable_files_list_): Define. + (sc_po_check): Use it. + 2016-07-15 Paul Eggert obstack: pacify GCC 6 with -Wnull-dereference diff --git a/top/maint.mk b/top/maint.mk index aa23364..c82afbe 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -1123,6 +1123,21 @@ 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 in which to search for translatable strings. +perl_translatable_files_list_ = \ + -e 'foreach $$file (@ARGV) {' \ + -e ' \# Consider only file extensions with one or two letters' \ + -e ' $$file =~ /\...?$$/ or next;' \ + -e ' \# Ignore m4 and mk files' \ + -e ' $$file =~ /\.m[4k]$$/ and next;' \ + -e ' \# Ignore a .c or .h file with a corresponding .l or .y file' \ + -e ' $$file =~ /(.+)\.[ch]$$/ && (-e "$${1}.l" || -e "$${1}.y")' \ + -e ' and next;' \ + -e ' \# Skip unreadable files' \ + -e ' -r $$file or next;' \ + -e ' print "$$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 +1147,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.8.0-rc2