[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

support shallow gnulib submodule checkouts

From: Simon Josefsson
Subject: support shallow gnulib submodule checkouts
Date: Tue, 16 Aug 2022 12:37:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)


Fetching the gnulib submodule takes quite some time, so I'd like to use
a shallow checkout instead.  However I get an error:

jas@latte:~/src/gsasl-small$ make check
  GEN      public-submodule-commit
fatal: run_command returned non-zero status for gnulib
maint.mk: found non-public submodule commit
make: *** [maint.mk:1498: public-submodule-commit] Fel 1

See code snippet from maint.mk below.  The test fails but the situation
the documentation says it is intended to protect against is not

How about this patch?  It will only run the test if the first gnulib
commit is present.  I'm not sure it is possible to catch the problem the
situation is trying to detect in a shallow checkout?

diff --git a/top/maint.mk b/top/maint.mk
index c1fdf9ca2c..0b3208a158 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -1496,7 +1496,8 @@ submodule-checks ?= no-submodule-changes 
 .PHONY: public-submodule-commit
        $(AM_V_GEN)if test -d $(srcdir)/.git                            \
-               && git --version >/dev/null 2>&1; then                  \
+               && git --version >/dev/null 2>&1                        \
+               && git cat-file -e d146c864e8d8cc82e96d722337253dd5a3a803b8; 
then                       \
          cd $(srcdir) &&                                               \
          git submodule --quiet foreach                                 \
              'test "$$(git rev-parse "$$sha1")"                        \


# Ensure that each sub-module commit we're using is public.
# Without this, it is too easy to tag and release code that
# cannot be built from a fresh clone.
.PHONY: public-submodule-commit
        $(AM_V_GEN)if test -d $(srcdir)/.git                            \
                && git --version >/dev/null 2>&1; then                  \
          cd $(srcdir) &&                                               \
          git submodule --quiet foreach                                 \
              'test "$$(git rev-parse "$$sha1")"                        \
                  = "$$(git merge-base origin "$$sha1")"'               \
            || { echo '$(ME): found non-public submodule commit' >&2;   \
                 exit 1; };                                             \
        else                                                            \
          : ;                                                           \
# This rule has a high enough utility/cost ratio that it should be a
# dependent of "check" by default.  However, some of us do occasionally
# commit a temporary change that deliberately points to a non-public
# submodule commit, and want to be able to use rules like "make check".
# In that case, run e.g., "make check gl_public_submodule_commit="
# to disable this test.
gl_public_submodule_commit ?= public-submodule-commit
check: $(gl_public_submodule_commit)

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]