All,

I ran into another problem triggered by the submodule-checks's in
maint.mk, see earlier thread here:
https://lists.gnu.org/archive/html/bug-gnulib/2022-08/msg00040.html

Here is what happens when I run 'make check' (in Guix with a minimized
git tool) for OATH Toolkit, which doesn't use any git submodules at all:

$ time make -j$(nproc) check V=1 VERBOSE=t
echo 2.6.12.53-fed1 > .version-t && mv .version-t .version
if test -d ./.git                               \
        && git --version >/dev/null 2>&1; then                  \
  cd . &&                                               \
  git submodule --quiet foreach                                 \
      'test "$(git rev-parse "$sha1")"                  \
          = "$(git merge-base origin "$sha1")"'         \
    || { echo 'maint.mk: found non-public submodule commit' >&2;        \
         exit 1; };                                             \
else                                                            \
  : ;                                                           \
fi
git: 'submodule' is not a git command. See 'git --help'.
maint.mk: found non-public submodule commit
make: *** [maint.mk:1643: public-submodule-commit] Error 1

I usually disable these checks in all my projects like this:

submodule-checks =
gl_public_submodule_commit =

This time I instead installed the attached patch so that the commands
aren't invoked when there is no .gitsubmodule file.  This should work
for my cases since I'm migrating away from using git submodules for
gnulib, and this approach allow me to remove the submodule-check
customization from cfg.mk.

/Simon
From ba4e57eea99f57370842f8a1dd31ced242ba5598 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <si...@josefsson.org>
Date: Mon, 7 Apr 2025 08:56:09 +0200
Subject: [PATCH] maintainer-makefile: Avoid submodule-checks fail without
 submodules.

* top/maint.mk (no-submodule-changes): Condition on .gitmodules.
(public-submodule-commit): Likewise.
---
 ChangeLog    | 6 ++++++
 top/maint.mk | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index b24c4d104b..05c48f05da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-04-07  Simon Josefsson  <si...@josefsson.org>
+
+	maintainer-makefile: Avoid submodule-checks fail without submodules.
+	* top/maint.mk (no-submodule-changes): Condition on .gitmodules.
+	(public-submodule-commit): Likewise.
+
 2025-04-06  Collin Funk  <collin.fu...@gmail.com>
 
 	fseterr: Port to recent Haiku snapshots.
diff --git a/top/maint.mk b/top/maint.mk
index 00775f786f..54c5e82753 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -1625,6 +1625,7 @@ endef
 .PHONY: no-submodule-changes
 no-submodule-changes:
 	$(AM_V_GEN)if test -d $(srcdir)/.git				\
+		&& test -e $(srcdir)/.gitmodules			\
 		&& git --version >/dev/null 2>&1; then			\
 	  diff=$$(cd $(srcdir) && git submodule -q foreach		\
 		  git diff-index --name-only HEAD)			\
@@ -1644,6 +1645,7 @@ submodule-checks ?= no-submodule-changes public-submodule-commit
 .PHONY: public-submodule-commit
 public-submodule-commit:
 	$(AM_V_GEN)if test -d $(srcdir)/.git				\
+		&& test -e $(srcdir)/.gitmodules			\
 		&& git --version >/dev/null 2>&1; then			\
 	  cd $(srcdir) &&						\
 	  git submodule --quiet foreach					\
-- 
2.49.0

Attachment: signature.asc
Description: PGP signature

  • Re: support shallow gnulib subm... Simon Josefsson via Gnulib discussion list

Reply via email to