[Libguestfs] [PATCH] build: avoid locale-specific changes in generated, VC'd file

Jim Meyering
Wed, 29 Jul 2009 12:16:03 -0000

When I build with LC_ALL=C in my environment,
the all-local rule generates po/POTFILES.in that
is sorted differently from the on that is checked in:

    diff --git a/po/POTFILES.in b/po/POTFILES.in
    index ca01b3d..154915a 100644
    --- a/po/POTFILES.in
    +++ b/po/POTFILES.in
    @@ -63,12 +63,11 @@ fish/tilde.c
     fish/time.c
     inspector/virt-inspector.pl
     java/com_redhat_et_libguestfs_GuestFS.c
    -ocaml/guestfs_c_actions.c
     ocaml/guestfs_c.c
    +ocaml/guestfs_c_actions.c
     perl/bindtests.pl
    -perl/Guestfs.c
    -perl/lib/Sys/Guestfs/Lib.pm
     perl/lib/Sys/Guestfs.pm
    +perl/lib/Sys/Guestfs/Lib.pm
     python/guestfs-py.c
     ruby/ext/guestfs/_guestfs.c
     src/guestfs-actions.c

If we generate that file so that sort always uses the C locale, then,
this type of difference will not arise.  Here's the patch to fix the
rule as well as to reflect the change in the generated file:

>From 609e1d1840da25614a7c9e8954e5356050c9f2ad Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 29 Jul 2009 08:13:35 -0400
Subject: [PATCH] build: avoid locale-specific changes in generated, VC'd
file

* Makefile.am (all-local): Use LC_ALL=C to sort in C locale.
* po/POTFILES.in: Regenerate.
---
 Makefile.am    |    2 +-
 po/POTFILES.in |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f118291..3cba8bc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -165,7 +165,7 @@ all-local:
 	grep -v 'examples/' | \
 	grep -v '/guestfs_protocol.c' | \
 	grep -v '/rc_protocol.c' | \
-	sort | \
+	LC_ALL=C sort | \
 	sed 's,^\./,,' > po/POTFILES.in

 # Pkgconfig.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ca01b3d..154915a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -63,12 +63,11 @@ fish/tilde.c
 fish/time.c
 inspector/virt-inspector.pl
 java/com_redhat_et_libguestfs_GuestFS.c
-ocaml/guestfs_c_actions.c
 ocaml/guestfs_c.c
+ocaml/guestfs_c_actions.c
 perl/bindtests.pl
-perl/Guestfs.c
-perl/lib/Sys/Guestfs/Lib.pm
 perl/lib/Sys/Guestfs.pm
+perl/lib/Sys/Guestfs/Lib.pm
 python/guestfs-py.c
 ruby/ext/guestfs/_guestfs.c
 src/guestfs-actions.c
--
1.6.3.3