On 4/27/24 2:29 PM, Bruno Haible wrote:
> Also, the SUBDIRS variable in a Makefile.am determines the order in which
> the subdirectories are traversed during a build. If a subdirectory has some
> chances to fail the build or the tests, it should be mentioned last, so
> that the other (more reliable) subdirectories can at least be built and
> tested. Thus, sorting SUBDIRS in alphabetical order is generally unwelcome.
> 
> It is gnulib-tool.py which needs to adapt.

Thanks for the explanation. I agree, I overlooked the purpose of
SUBDIRS in the original message.

I've pushed the attached patch since it allows me to run this and
pass:

     GNULIB_TOOL_IMPL=sh+py ./gnulib-tool --create-megatestdir --dir=testdir2 
--single-configure sys_types stdio

Can you double check on your machine?

Collin
From dba810f623ad02476401faddccfdcaf234db7b5e Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 27 Apr 2024 15:01:24 -0700
Subject: [PATCH] gnulib-tool.py: Preserve module ordering in
 --create-megatestdir.

* pygnulib/GLTestDir.py (GLMegaTestDir.execute): Use a separate set to
remove duplicates from the original list without sorting.
---
 ChangeLog             | 6 ++++++
 pygnulib/GLTestDir.py | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 935ddbd1ba..34893ebff1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-27  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Preserve module ordering in --create-megatestdir.
+	* pygnulib/GLTestDir.py (GLMegaTestDir.execute): Use a separate set to
+	remove duplicates from the original list without sorting.
+
 2024-04-27  Bruno Haible  <br...@clisp.org>
 
 	fcntl-h, stdio, unistd: Ensure off64_t is defined on all platforms.
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index 758a65168e..002eb30267 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -876,7 +876,12 @@ def execute(self) -> None:
             modules = self.modulesystem.list()
             modules = [ self.modulesystem.find(m)
                         for m in modules ]
-        modules = sorted(set(modules))
+        # Preserve ordering from the command-line, but remove duplicates.
+        # This allows control over the SUBDIRS variable in the top-level Makefile.am.
+        module_set = set(modules)
+        modules = [ module
+                    for module in modules
+                    if module in module_set ]
 
         # First, all modules one by one.
         for module in modules:
-- 
2.44.0

Reply via email to