Skip to content

Commit

Permalink
build: improve check for out-of-date .gnulib submodule
Browse files Browse the repository at this point in the history
git reset --hard 96e5a2d
./autogen.sh
make -s
git pull
make -s    <-- expecting auto-bootstrap here, doesn't happen

Use git diff to expose whether the submodule has untracked changes,
which are typical on an incremental pull if .gnulib was updated but
the user did not manually run 'git submodule update'.

After this patch is applied, I encountered a new problem when
following the reproducing pattern.  Basically, the change to .gnulib
between libvirt's commit 96e5a2d and this patch introduced a change
to sys_ioctl.in.h, but gnulib (intentionally) does not make the
replacement headers depend on Makefile changes.  Therefore, I ended up
with the generated replacement header being broken:
gnulib/lib/sys/ioctl.h complained about a use of @.  But that seems
like something that should be fixed upstream in gnulib's bootstrap
script (that is, when doing a gnulib update, all files created from
.in.h file should probably be deleted).  Without the benefit of that
proposed gnulib fix, I worked around the problem by manually removing
the stale gnulib/lib/sys/ioctl.h.

* autogen.sh (t): Also run bootstrap if the gnulib submodule needs
to be updated.
* cfg.mk (_autogen): Likewise.
Reported by Matthias Bolte.
  • Loading branch information
ebblake committed Apr 2, 2010
1 parent 8d30e5f commit d002c25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bootstrap_hash()
# Ensure that whenever we pull in a gnulib update or otherwise change to a
# different version (i.e., when switching branches), we also rerun ./bootstrap.
curr_status=.git-module-status
t=$(bootstrap_hash)
t=$(bootstrap_hash; git diff .gnulib)
if test "$t" = "$(cat $curr_status 2>/dev/null)"; then
: # good, it's up to date, all we need is autoreconf
autoreconf -if
Expand Down
6 changes: 5 additions & 1 deletion cfg.mk
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ ifeq (0,$(MAKELEVEL))
_submodule_hash = sed 's/^[ +-]//;s/ .*//'
_update_required := $(shell \
actual=$$(git submodule status | $(_submodule_hash); \
git hash-object bootstrap.conf); \
git hash-object bootstrap.conf; \
git diff .gnulib); \
stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)"; \
test "$$stamp" = "$$actual"; echo $$?)
ifeq (1,$(_update_required))
Expand All @@ -303,9 +304,12 @@ Makefile: _autogen
endif
endif

# It is necessary to call autogen any time gnulib changes. Autogen
# reruns configure, then we regenerate all Makefiles at once.
.PHONY: _autogen
_autogen:
$(srcdir)/autogen.sh
./config.status

# Exempt @...@ uses of these symbols.
_makefile_at_at_check_exceptions = ' && !/(SCHEMA|SYSCONF)DIR/'

0 comments on commit d002c25

Please sign in to comment.