bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-cache.m4 readability


From: Eric Blake
Subject: gnulib-cache.m4 readability
Date: Mon, 23 Jun 2008 18:03:37 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

On m4, I'm currently playing with multiple branches, each of which has imported 
a different set of gnulib modules via 'gnulib-tool --import'.  I'm finding it 
very difficult to track which modules have been imported to which branches by 
using a 'git diff' of the various versions of gnulib-cache.m4.  This is because 
both the command-line and gl_MODULES listings are run-ons, with every single 
module crammed into a really long line, and picking out a one-word change in a 
600-character line that has been wrapped across an 80-column terminal is not 
easy.

The task of tracking changes to gnulib-cache.m4 would be a lot easier if 
modules were listed on a separate line, as in the proposed patch; then there is 
no longer any line-wrapping of the gl_MODULES portion of the file, and the 
added or deleted modules diff independently of the remaining modules.  I did 
this only for gl_MODULES; the comment on a command-line invocation to reproduce 
the import needs to remain as a run-on line to be pastable into a shell.  But 
as long as one of the two instances is newline separated, then diffs between 
versions of gnulib-cache.m4 become much easier to inspect.  OK to commit?

Autoconf claims [1] that using address limiters (such as '/)/' in the patch 
below) within {} command groups is not required by POSIX.  But a defect was 
recently raised against POSIX [2] that claims POSIX is wrong, and that 
all 'editing commands' (including addresses) rather than 'functions' (excluding 
addresses) was intended.  Does anyone know whether any existing sed 
implementations would choke on this proposed patch, in which case I would have 
to rewrite it using the 's' and 't' commands rather than 'address' and 'b'?  At 
any rate, GNU sed in --posix mode didn't reject the construct.

[1] http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Usual-
Tools.html#Limitations-of-Usual-Tools, under sed
[2] https://www.opengroup.org/sophocles/show_mail.tpl?
CALLER=index.tpl&source=L&listname=austin-review-l&id=2578

From: Eric Blake <address@hidden>
Date: Mon, 23 Jun 2008 11:30:06 -0600
Subject: [PATCH] Make gnulib-cache.m4 easier to diff.

* gnulib-tool (func_import): Allow newlines when reading cached
gl_MODULES, and generate newlines when creating gnulib-cache.m4.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog   |    6 ++++++
 gnulib-tool |    9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c4f9c9a..e93c2ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-06-23  Eric Blake  <address@hidden>
 
+       Make gnulib-cache.m4 easier to diff.
+       * gnulib-tool (func_import): Allow newlines when reading cached
+       gl_MODULES, and generate newlines when creating gnulib-cache.m4.
+
+2008-06-23  Eric Blake  <address@hidden>
+
        Fix typo.
        * tests/test-sigaction.c (MASK_SA_FLAGS): Add missing operator.
 
diff --git a/gnulib-tool b/gnulib-tool
index a3b9df5..92b368f 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -2197,6 +2197,11 @@ func_import ()
         s,^.*gl_LOCAL_DIR([[ ]*\([^])]*\).*$,cached_local_gnulib_dir="\1",p
       }
       /gl_MODULES(/ {
+        :loop
+        /)/b done
+        N
+        b loop
+        :done
         s,^.*gl_MODULES([[ ]*\([^])]*\).*$,cached_specified_modules="\1",p
       }
       /gl_AVOID(/ {
@@ -3004,7 +3009,9 @@ func_import ()
         esac ;;
     esac
     echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
-    echo "gl_MODULES(["`echo $specified_modules`"])"
+    echo "gl_MODULES(["
+    echo "$specified_modules" | sed 's/^/  /g'
+    echo "])"
     echo "gl_AVOID([$avoidlist])"
     echo "gl_SOURCE_BASE([$sourcebase])"
     echo "gl_M4_BASE([$m4base])"
-- 
1.5.6







reply via email to

[Prev in Thread] Current Thread [Next in Thread]