From: Ján Tomko Date: Sat, 30 Jul 2016 05:39:31 +0000 (-0700) Subject: maint.mk: speed up sc_po_check X-Git-Tag: v1.0~6706 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=04fd8821111d3af23e8485f0f78b60f42babda1d;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 2414e8e7d3..dda0e504ce 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 aa23364a1b..c82afbef4e 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 > $@-1; \ - 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 > $@-2; \ diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \