This patch fixes this diff in a few of the import tests:
$ diff -u ./test-oath-toolkit-4.result/libpskc/gl/Makefile.am
tmp529642-result/libpskc/gl/Makefile.am
--- ./test-oath-toolkit-4.result/libpskc/gl/Makefile.am 2024-03-28
02:51:26.031078064 -0700
+++ tmp529642-result/libpskc/gl/Makefile.am 2024-03-28 02:52:03.811081884
-0700
@@ -58,7 +58,6 @@
DISTCLEANFILES =
MAINTAINERCLEANFILES =
# No GNU Make output.
-EXTRA_DIST += m4/gnulib-cache.m4
AM_CPPFLAGS =
AM_CFLAGS =
This loop in the Python version was written incorrectly. Missing the
'not' and 'isfile':
diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py
index 40fbc44c43..b15e21b443 100644
--- a/pygnulib/GLMakefileTable.py
+++ b/pygnulib/GLMakefileTable.py
@@ -35,6 +35,7 @@ __copyright__ = constants.__copyright__
# Define global constants
#===============================================================================
TESTS = constants.TESTS
+isfile = os.path.isfile
joinpath = constants.joinpath
@@ -98,7 +99,7 @@ class GLMakefileTable(object):
dir1 = '%s%s' % (m4base, os.path.sep)
dir2 = ''
while (dir1
- and (joinpath(self.config['destdir'], dir1, 'Makefile.am')
+ and not (isfile(joinpath(self.config['destdir'], dir1,
'Makefile.am'))
or joinpath(dir1, 'Makefile.am') == joinpath(sourcebase,
source_makefile_am)
or (gentests and joinpath(dir1, 'Makefile.am') ==
joinpath(testsbase, tests_makefile_am)))):
dir2 = joinpath(os.path.basename(dir1), dir2)
The corresponding code in gnulib-tool.sh:
sed_last='s,^.*/\([^/][^/]*\)//*$,\1/,
s,//*$,/,'
sed_butlast='s,[^/][^/]*//*$,,'
dir1="${m4base}/"; dir2=""
while test -n "$dir1" \
&& ! { test -f "${destdir}/${dir1}Makefile.am" \
|| test "${dir1}Makefile.am" =
"$sourcebase/$source_makefile_am" \
|| test "./${dir1}Makefile.am" =
"$sourcebase/$source_makefile_am" \
|| { $gentests \
&& { test "${dir1}Makefile.am" =
"$testsbase/$tests_makefile_am" \
|| test "./${dir1}Makefile.am" =
"$testsbase/$tests_makefile_am"; }; }; }; do
dir2=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
This fixes the Makefile output but also uncovers this bug:
$ diff test-oath-toolkit-4.out tmp529822-out
196a197
> - mention "m4/gnulib-cache.m4" in EXTRA_DIST in gl/Makefile.am,
It looks like GLEmiter.lib_Makefile_am() and
GLEmiter.tests_Makefile_am() don't handle the GLMakefileTable
correctly. I'll submit another patch later for that since it will
require some code restructuring and such.
Collin
From d9b309b01603d883140f3cc81b0d81feeeef818b Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Thu, 28 Mar 2024 02:40:46 -0700
Subject: [PATCH 2/2] gnulib-tool.py: Fix missing 'gnulib-cache.m4' in
EXTRA_DIST.
* pygnulib/GLMakefileTable.py (GLMakefileTable.parent): Fix the loop
condition so that it matches gnulib-tool.sh.
---
ChangeLog | 6 ++++++
pygnulib/GLMakefileTable.py | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 4897e8188d..a96ab640af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-03-28 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Fix missing 'gnulib-cache.m4' in EXTRA_DIST.
+ * pygnulib/GLMakefileTable.py (GLMakefileTable.parent): Fix the loop
+ condition so that it matches gnulib-tool.sh.
+
2024-03-27 Collin Funk <collin.fu...@gmail.com>
gnulib-tool.py: Fix whitespace in gnulib-comp.m4.
diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py
index 40fbc44c43..b15e21b443 100644
--- a/pygnulib/GLMakefileTable.py
+++ b/pygnulib/GLMakefileTable.py
@@ -35,6 +35,7 @@ __copyright__ = constants.__copyright__
# Define global constants
#===============================================================================
TESTS = constants.TESTS
+isfile = os.path.isfile
joinpath = constants.joinpath
@@ -98,7 +99,7 @@ class GLMakefileTable(object):
dir1 = '%s%s' % (m4base, os.path.sep)
dir2 = ''
while (dir1
- and (joinpath(self.config['destdir'], dir1, 'Makefile.am')
+ and not (isfile(joinpath(self.config['destdir'], dir1, 'Makefile.am'))
or joinpath(dir1, 'Makefile.am') == joinpath(sourcebase, source_makefile_am)
or (gentests and joinpath(dir1, 'Makefile.am') == joinpath(testsbase, tests_makefile_am)))):
dir2 = joinpath(os.path.basename(dir1), dir2)
--
2.44.0