A colleague noticed in libvirt that the output of a failed po-check rule
was unnecessarily cryptic.  Here's a fix:

>From 089424f94e5be30aa0ec8d7f5293ff314def4de1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[EMAIL PROTECTED]>
Date: Thu, 16 Oct 2008 14:22:46 +0200
Subject: [PATCH] build: when po-check fails, say why and suggest a fix

* maint.mk (po-check): Before, when this check failed, it just
spat out a diff mentioning two temporary files.  Now, it tells
you what's wrong and suggests a fix with a patch using the name
of the affected file (rather than temporary file names) in the
diff output.
---
 maint.mk |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/maint.mk b/maint.mk
index 8db32d9..2752486 100644
--- a/maint.mk
+++ b/maint.mk
@@ -597,10 +597,15 @@ m4-check:
          && { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
               exit 1; } || :

+fix_po_file_diag = \
+'you have changed the set of files with translatable diagnostics;\n\
+apply the above patch\n'
+
 # Verify that all source files using _() are listed in po/POTFILES.in.
+po_file = po/POTFILES.in
 po-check:
-       @if test -f po/POTFILES.in; then                                \
-         grep -E -v '^(#|$$)' po/POTFILES.in                           \
+       @if test -f $(po_file); then                                    \
+         grep -E -v '^(#|$$)' $(po_file)                               \
            | grep -v '^src/false\.c$$' | sort > [EMAIL PROTECTED];             
        \
          files=;                                                       \
          for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do              \
@@ -617,7 +622,8 @@ po-check:
          done;                                                         \
          grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files          \
            | sort -u > [EMAIL PROTECTED];                                      
        \
-         diff -u [EMAIL PROTECTED] [EMAIL PROTECTED] || exit 1;                
                        \
+         diff -u -L $(po_file) -L $(po_file) [EMAIL PROTECTED] [EMAIL 
PROTECTED]                       \
+           || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; };   \
          rm -f [EMAIL PROTECTED] [EMAIL PROTECTED];                            
                \
        fi

--
1.6.0.2.98.gc82e


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to