When gnulib-tool --create-testdir is used with option --without-tests,
the Python implementation creates a wrong result. See:
$ rm -rf ../testdir1; ./gnulib-tool.sh --create-testdir --dir=../testdir1
--without-tests fstrcmp
$ rm -rf ../testdir2; ./gnulib-tool.py --create-testdir --dir=../testdir2
--without-tests fstrcmp
$ diff -r -u testdir1 testdir2
diff -r -u testdir1/configure testdir2/configure
--- testdir1/configure 2024-08-05 16:41:43.743223394 +0200
+++ testdir2/configure 2024-08-05 16:41:55.535289350 +0200
@@ -20333,7 +20333,7 @@
-ac_config_files="$ac_config_files Makefile gllib/Makefile glm4/Makefile"
+ac_config_files="$ac_config_files Makefile gllib/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -21111,7 +21111,6 @@
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"gllib/Makefile") CONFIG_FILES="$CONFIG_FILES gllib/Makefile" ;;
- "glm4/Makefile") CONFIG_FILES="$CONFIG_FILES glm4/Makefile" ;;
*) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;;
esac
diff -r -u testdir1/configure.ac testdir2/configure.ac
--- testdir1/configure.ac 2024-08-05 16:41:42.647217259 +0200
+++ testdir2/configure.ac 2024-08-05 16:41:54.431283179 +0200
@@ -377,5 +377,5 @@
gl_INIT
-AC_CONFIG_FILES([Makefile gllib/Makefile glm4/Makefile])
+AC_CONFIG_FILES([Makefile gllib/Makefile])
AC_OUTPUT
Only in testdir1/glm4: Makefile.in
$ (cd testdir1 && ./configure && make)
(OK)
$ (cd testdir2 && ./configure && make)
...
Making all in glm4
make[2]: Entering directory '/GNULIB/testdir2/glm4'
make[2]: *** No rule to make target 'all'. Stop.
make[2]: Leaving directory '/GNULIB/testdir2/glm4'
make[1]: *** [Makefile:1436: all-recursive] Error 1
make[1]: Leaving directory '/GNULIB/testdir2'
make: *** [Makefile:1377: all] Error 2
This patch fixes it.
2024-08-05 Bruno Haible <[email protected]>
gnulib-tool.py: Fix testdirs created with --without-tests.
* pygnulib/GLTestDir.py (GLTestDir.execute): Don't assume that 'gltests'
is the last subdirectory with a configure.ac.
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index ecedf992c6..268a14afef 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -619,17 +619,13 @@ def execute(self) -> None:
emit += self.emitter.initmacro_done('%stests' % macro_prefix,
testsbase)
emit += '\ngl_INIT\n\n'
if subdirs_with_configure_ac:
- if single_configure:
- emit += 'AC_CONFIG_SUBDIRS([%s])\n' % '
'.join(subdirs_with_configure_ac[:-1])
- else: # if not single_configure
- emit += 'AC_CONFIG_SUBDIRS([%s])\n' % '
'.join(subdirs_with_configure_ac)
+ emit += 'AC_CONFIG_SUBDIRS([%s])\n' % '
'.join(subdirs_with_configure_ac)
makefiles = ['Makefile']
for directory in subdirs:
# For subdirs that have a configure.ac by their own, it's the
subdir's
# configure.ac which creates the subdir's Makefile.am, not this
one.
- makefiles.append(joinpath(directory, 'Makefile'))
- if not single_configure:
- makefiles = makefiles[:-1]
+ if not directory in subdirs_with_configure_ac:
+ makefiles.append(joinpath(directory, 'Makefile'))
emit += 'AC_CONFIG_FILES([%s])\n' % ' '.join(makefiles)
emit += 'AC_OUTPUT\n'
path = joinpath(self.testdir, 'configure.ac')