Hi Bruno,

Assuming that there are no other issues with this patch, can you check
the commit message and ChangeLog entry before pushing? I noticed that
the ChangeLog entry disagrees with the git log and gnulib-tool.py.TODO
for one of the commits. I'm new to the ChangeLog stuff so I will let
you decide which is more useful to reference.

Here is the commit it was changed:

$ git  diff eed8d6e1b4924b0a7e93905871094909ba0118a3 
eed8d6e1b4924b0a7e93905871094909ba0118a3^
diff --git a/ChangeLog b/ChangeLog
index 986cfb1ddd..370cd98398 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,7 @@
 
 2021-12-12  Bruno Haible  <br...@clisp.org>
 
-       gnulib-tool: Try to support non-recursive-gnulib-prefix-hack with tests.
+       gnulib-tool: Support non-recursive-gnulib-prefix-hack with tests.
        * gnulib-tool (func_import): Synthesize an AC_CONFIG_LIBOBJ_DIR
        invocation.
        * m4/non-recursive-gnulib-prefix-hack.m4

Here is a test case for this patch:

gnulib-tool.py --create-testdir --dir test-python dummy
gnulib-tool --create-testdir --dir test-shell dummy
(cd test-python && gnulib-tool.py --import --with-tests alloca-opt alloca)
(cd test-shell && gnulib-tool --import --with-tests alloca-opt alloca)
git diff --no-index test-python/m4/gnulib-comp.m4 test-shell/m4/gnulib-comp.m4

This diff is fixed by the patch:

diff --git a/test-python/m4/gnulib-comp.m4 b/test-shell/m4/gnulib-comp.m4
index 82773fffde..ac6e4d0b7b 100644
--- a/test-python/m4/gnulib-comp.m4
+++ b/test-shell/m4/gnulib-comp.m4
@@ -51,6 +51,7 @@ AC_DEFUN([gl_EARLY],
 # "Check for header files, types and library functions".
 AC_DEFUN([gl_INIT],
 [
+  AC_CONFIG_LIBOBJ_DIR([lib])

I'm still learning how gnulib-tool works so I'm not sure how to get
'tests=lib/alloca.c' in "$tmp"/new-files to test the second
conditional [1]. Feel free to let me know if there is an easy way to
do it.

[1] https://git.savannah.gnu.org/cgit/gnulib.git/tree/gnulib-tool#n6044

Collin
From 7d04cbcec2363a646d83b3012584edba538d97b6 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 9 Mar 2024 01:41:02 -0800
Subject: [PATCH 3/3] gnulib-tool.py: Follow gnulib-tool changes, part 50.

Follow gnulib-tool changes
2021-12-12  Bruno Haible  <br...@clisp.org>
gnulib-tool: Try to support non-recursive-gnulib-prefix-hack with tests.
2021-12-13  Bruno Haible  <br...@clisp.org>
gnulib-tool: Fix mistake in last commit.

* pygnulib/GLImport.py (GLImport.gnulib_comp): Expect the filetable as a
parameter instead of a list of all files. Add type checks. Invoke
AC_CONFIG_LIBOBJ_DIR based on the location of alloca.c.
(GLImport.execute): Adjust call to GLImport.gnulib_comp to reflect
parameter changes.
---
 ChangeLog            | 14 ++++++++++++++
 gnulib-tool.py.TODO  | 20 --------------------
 pygnulib/GLImport.py | 28 ++++++++++++++++++++++++----
 3 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ca39bbc532..b4dc53aca7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-03-09  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Follow gnulib-tool changes, part 50.
+	Follow gnulib-tool changes
+	2021-12-12  Bruno Haible  <br...@clisp.org>
+	gnulib-tool: Try to support non-recursive-gnulib-prefix-hack with tests.
+	2021-12-13  Bruno Haible  <br...@clisp.org>
+	gnulib-tool: Fix mistake in last commit.
+	* pygnulib/GLImport.py (GLImport.gnulib_comp): Expect the filetable as a
+	parameter instead of a list of all files. Add type checks. Invoke
+	AC_CONFIG_LIBOBJ_DIR based on the location of alloca.c.
+	(GLImport.execute): Adjust call to GLImport.gnulib_comp to reflect
+	parameter changes.
+
 2024-03-08  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Follow gnulib-tool changes, part 49.
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 7031462593..eedb916ca9 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -344,26 +344,6 @@ Date:   Wed Dec 15 19:18:31 2021 +0100
 
 --------------------------------------------------------------------------------
 
-commit dc08febea1fc0a8c902dfa89d0abc2952873529b
-Author: Bruno Haible <br...@clisp.org>
-Date:   Mon Dec 13 03:03:13 2021 +0100
-
-    gnulib-tool: Fix mistake in last commit.
-
-commit 4e7b4cc6fb3e3b659c98baf6db26d8a06099fbee
-Author: Bruno Haible <br...@clisp.org>
-Date:   Mon Dec 13 02:43:21 2021 +0100
-
-    gnulib-tool: Support non-recursive-gnulib-prefix-hack with tests.
-
-    * gnulib-tool (func_import): Synthesize an AC_CONFIG_LIBOBJ_DIR
-    invocation.
-    * m4/non-recursive-gnulib-prefix-hack.m4
-    (gl_NON_RECURSIVE_GNULIB_PREFIX_HACK): Don't invoke
-    AC_CONFIG_LIBOBJ_DIR.
-
---------------------------------------------------------------------------------
-
 commit 4b071c115309079528db7b60e8d2ffb22b129088
 Author: Paul Eggert <egg...@cs.ucla.edu>
 Date:   Mon Apr 26 23:31:29 2021 -0700
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 24c6623293..9ba2775425 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -562,16 +562,21 @@ class GLImport(object):
             emit += 'gl_VC_FILES([%s])\n' % vc_files
         return constants.nlconvert(emit)
 
-    def gnulib_comp(self, files, gentests):
+    def gnulib_comp(self, filetable, gentests):
         '''GLImport.gnulib_comp(files) -> str
 
         Emit the contents of generated $m4base/gnulib-comp.m4 file.
         GLConfig: destdir, localpath, tests, sourcebase, m4base, pobase, docbase,
         testsbase, conddeps, libtool, macro_prefix, podomain, vc_files.
 
-        files is the list of files to use.
+        filetable is a dictionary with a category used as a key to access
+          a list of files.
         gentests is True if a tests Makefile.am is being generated, False
           otherwise.'''
+        if type(filetable) is not dict:
+            raise TypeError(f'filetable should be a dict, not {type(filetable).__name__}')
+        if type(gentests) is not bool:
+            raise TypeError(f'gentests should be a bool, not {type(gentests).__name__}')
         emit = ''
         assistant = self.assistant
         moduletable = self.moduletable
@@ -640,6 +645,21 @@ AC_DEFUN([%s_EARLY],
 # "Check for header files, types and library functions".
 AC_DEFUN([%s_INIT],
 [\n''' % (configure_ac, macro_prefix)
+
+        # This AC_CONFIG_LIBOBJ_DIR invocation silences an error from the automake
+        # front end:
+        #   error: required file './alloca.c' not found
+        # It is needed because of the last remaining use of AC_LIBSOURCES in
+        # _AC_LIBOBJ_ALLOCA, invoked from AC_FUNC_ALLOCA.
+        # All the m4_pushdef/m4_popdef logic in func_emit_initmacro_start/_end
+        # does not help to avoid this error.
+        newfile_set = {x[1] for x in filetable['new']}
+        if 'lib/alloca.c' in newfile_set:
+            emit += '  AC_CONFIG_LIBOBJ_DIR([%s])\n' % sourcebase
+        elif 'tests=lib/alloca.c' in newfile_set:
+            # alloca.c will be present in $testsbase.
+            emit += '  AC_CONFIG_LIBOBJ_DIR([%s])\n' % testsbase
+
         if libtool:
             emit += '  AM_CONDITIONAL([GL_COND_LIBTOOL], [true])\n'
             emit += '  gl_cond_libtool=true\n'
@@ -702,7 +722,7 @@ AC_DEFUN([%s_INIT],
 # This macro records the list of files which have been installed by
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
-        emit += '  %s\n' % '\n  '.join(files)
+        emit += '  %s\n' % '\n  '.join(filetable['all'])
         emit += '])\n'
         return emit
 
@@ -1277,7 +1297,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
         # Create m4/gnulib-comp.m4.
         basename = joinpath(m4base, 'gnulib-comp.m4')
         tmpfile = self.assistant.tmpfilename(basename)
-        emit = self.gnulib_comp(filetable['all'], gentests)
+        emit = self.gnulib_comp(filetable, gentests)
         with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
             file.write(emit)
         filename, backup, flag = self.assistant.super_update(basename, tmpfile)
-- 
2.44.0

Reply via email to