In the the ./import-tests/test-wget2-1.sh output of gnulib-comp.m4
there is this whitespace diff:

$ diff -u ./test-wget2-1.result/m4/gnulib-comp.m4 
tmp115629-result/m4/gnulib-comp.m4
--- ./test-wget2-1.result/m4/gnulib-comp.m4     2024-03-27 03:05:35.527866182 
-0700
+++ tmp115629-result/m4/gnulib-comp.m4  2024-03-27 21:12:14.079772897 -0700
@@ -462,7 +463,7 @@
   gl_CONDITIONAL([GL_COND_OBJ_ACCESS], [test $REPLACE_ACCESS = 1])
   gl_UNISTD_MODULE_INDICATOR([access])
   gl_ALIGNASOF
-changequote(,)dnl
+  changequote(,)dnl
 LTALLOCA=`echo "$ALLOCA" | sed -e 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
 changequote([, ])dnl
 AC_SUBST([LTALLOCA])

This tiny patch fixes it. It looks like lines_to_multiline returned an
empty string which is accepted by the regular expression and added 2
spaces infront of it. We don't have to bother with regular expressions
here anyways.

diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index e245390aa0..efde78823d 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -225,12 +225,10 @@ class GLEmiter(object):
             snippet = module.getAutoconfSnippet()
             snippet = snippet.replace('${gl_include_guard_prefix}',
                                       include_guard_prefix)
-            lines = [ line
+            lines = [ f'{indentation}{line}'
                       for line in snippet.split('\n')
                       if line.strip() ]
             snippet = lines_to_multiline(lines)
-            pattern = re.compile(r'^(.*)$', re.M)
-            snippet = pattern.sub(r'%s\1' % indentation, snippet)
             if disable_libtool:
                 snippet = snippet.replace('$gl_cond_libtool', 'false')
                 snippet = snippet.replace('gl_libdeps', 'gltests_libdeps')
-- 
2.44.0

Collin
From bfaa4834f4a2b5af35878052beec8c97db463b81 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Wed, 27 Mar 2024 21:08:36 -0700
Subject: [PATCH] gnulib-tool.py: Fix whitespace in gnulib-comp.m4.

* pygnulib/GLEmiter.py (GLEmiter.autoconfSnippet): Prefix each line with
the indentation string instead of using regular expressions.
---
 ChangeLog            | 6 ++++++
 pygnulib/GLEmiter.py | 4 +---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aa7df63120..4897e8188d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-03-27  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Fix whitespace in gnulib-comp.m4.
+	* pygnulib/GLEmiter.py (GLEmiter.autoconfSnippet): Prefix each line with
+	the indentation string instead of using regular expressions.
+
 2024-03-27  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Inline 'sed' invocations used on library files.
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index e245390aa0..efde78823d 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -225,12 +225,10 @@ class GLEmiter(object):
             snippet = module.getAutoconfSnippet()
             snippet = snippet.replace('${gl_include_guard_prefix}',
                                       include_guard_prefix)
-            lines = [ line
+            lines = [ f'{indentation}{line}'
                       for line in snippet.split('\n')
                       if line.strip() ]
             snippet = lines_to_multiline(lines)
-            pattern = re.compile(r'^(.*)$', re.M)
-            snippet = pattern.sub(r'%s\1' % indentation, snippet)
             if disable_libtool:
                 snippet = snippet.replace('$gl_cond_libtool', 'false')
                 snippet = snippet.replace('gl_libdeps', 'gltests_libdeps')
-- 
2.44.0

Reply via email to