[libvirt] [PATCH] build: avoid infinite autogen loop

Laine Stump laine at laine.org
Mon Oct 1 17:09:28 UTC 2012


On 10/01/2012 11:48 AM, Eric Blake wrote:
> Several people have reported that if the .gnulib submodule is dirty,
> then 'make' will go into an infinite loop attempting to rerun bootstrap,
> because that never cleans up the dirty submodule.  By default, we
> should halt and make the user investigate, but if the user doesn't
> know why or care that the submodule is dirty, I also added the ability
> to 'make CLEAN_SUBMODULE=1' to get things going again.
>
> Also, while testing this, I noticed that when a submodule update was
> needed, 'make' would first run autoreconf, then bootstrap (which
> reruns autoreconf); adding a strategic dependency allows for less work.
>
> * .gnulib: Update to latest, for maint.mk improvements.
> * cfg.mk (_autogen): Also hook maint.mk, to run before autoreconf.
> * autogen.sh (bootstrap): Refuse to run if gnulib is dirty, unless
> user requests discarding gnulib changes.

ACK. I had saved a directory that was giving me this problem, applied
this patch, and the loop was broken!

(I added CLEAN_SUBMODULE=1 as suggested, and this fixed the build).

> ---
>
> * .gnulib 440a1db...b493832 (39):
>   > sockets, sys_stat: restore AC_C_INLINE
>   > localeconv tests: Avoid test failure on OpenIndiana.
>   > havelib: Follow libtool developments.
>   > ChangeLog: mention who reported the problem.
>   > fstatat.c: fix a compile-impeding typo
>   > extern-inline: provide a -Wundef safe config.h
>   > hash-pjw: relax license to LGPLv2+
>   > autoupdate
>   > maint.mk: fix strict vs. lazy variable issues with RELEASE
>   > maint.mk: formatting changes
>   > maint.mk: provide "make upload" to ease uploading
>   > maint.mk: factor the validation of RELEASE_TYPE
>   > maint.mk: silent rules
>   > localename: port gl_locale_name_thread_unsafe to FreeBSD
>   > binary-io, eealloc, mbfile, mbiter, mbutil, xsize: better 'inline'
>   > pipe-filter-gi, pipe-filter-ii: better use of 'inline'
>   > fdutimensat: omit unnecessary AC_C_INLINE
>   > fchmodat, fchownat, fstatat: use extern-inline
>   > acl, mbchar, priv-set: use extern-inline
>   > sockets, sys_stat: remove AC_C_INLINE in MSVC-only cases
>   > tls-tests: omit unnecessary 'inline'
>   > utimens-tests: avoid unnecessary 'inline'
>   > misc: don't limit commentary to inline functions
>   > non-recursive-gnulib-prefix-hack: new module
>   > ChangeLog: fix indentation
>   > maint.mk: generalize _gl_tight_scope for non-recursive make
>   > maint.mk: exempt trailing blanks found in "binary" files
>   > maint.mk: sc_prohibit_path_max_allocation: don't FP for UNIX_PATH_MAX
>   > maint.mk: teach sc_prohibit_magic_number_exit to accept 77
>   > maint.mk: relax sc_prohibit_strcmp, to avoid a false positive
>   > localcharset: work around Mac OS X bug with UTF-8 and MB_CUR_MAX
>   > doc: document sticky-EOF issue
>   > poll: fix poll(0, NULL, msec)
>   > poll: fix for systems that can't recv() on a non-socket
>   > poll/select: document portability problems not fixed by Gnulib.
>   > update from texinfo
>   > Fix typo in previous patch: 1 -> 4.
>   > fcntl-h: check for AIX 7.1 bug with O_NOFOLLOW and O_CREAT
>   > net_if: give more details about the bug being fixed
>
>  .gnulib    |    2 +-
>  autogen.sh |   11 +++++++++++
>  cfg.mk     |   16 ++++++++--------
>  3 files changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/.gnulib b/.gnulib
> index 440a1db..b493832 160000
> --- a/.gnulib
> +++ b/.gnulib
> @@ -1 +1 @@
> -Subproject commit 440a1dbe523e37f206252cb034c3a62f26867e42
> +Subproject commit b4938324b7113c9d73f8390d21f3ecbd842e74b9
> diff --git a/autogen.sh b/autogen.sh
> index 72f1e7a..d183397 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -63,11 +63,22 @@ bootstrap_hash()
>  if test -d .git; then
>      curr_status=.git-module-status
>      t=$(bootstrap_hash; git diff .gnulib)
> +    case $t:${CLEAN_SUBMODULE+set} in
> +        *:set) ;;
> +        *-dirty*)
> +            echo "error: gnulib submodule is dirty, please investigate" 2>&1
> +            echo "set env-var CLEAN_SUBMODULE to discard gnulib changes" 2>&1
> +            exit 1 ;;
> +    esac
>      if test "$t" = "$(cat $curr_status 2>/dev/null)" \
>          && test -f "po/Makevars"; then
>          # good, it's up to date, all we need is autoreconf
>          autoreconf -if
>      else
> +        if test ${CLEAN_SUBMODULE+set}; then
> +            echo cleaning up submodules...
> +            git submodule foreach 'git clean -dfqx && git reset --hard'
> +        fi
>          echo running bootstrap$no_git...
>          ./bootstrap$no_git --bootstrap-sync && bootstrap_hash > $curr_status \
>              || { echo "Failed to bootstrap, please investigate."; exit 1; }
> diff --git a/cfg.mk b/cfg.mk
> index bbfd4a2..e1fbf4f 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -700,10 +700,17 @@ ifeq (0,$(MAKELEVEL))
>    _clean_requested = $(filter %clean,$(MAKECMDGOALS))
>    ifeq (1,$(_update_required)$(_clean_requested))
>      $(info INFO: gnulib update required; running ./autogen.sh first)
> -Makefile: _autogen
> +maint.mk 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
> +
>  # Give credit where due:
>  # Ensure that each commit author email address (possibly mapped via
>  # git log's .mailmap) appears in our AUTHORS file.
> @@ -718,13 +725,6 @@ sc_check_author_list:
>  	  && echo '$(ME): committer(s) not listed in AUTHORS' >&2;	\
>  	test $$fail = 0
>
> -# 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
> -
>  # regenerate HACKING as part of the syntax-check
>  syntax-check: $(top_srcdir)/HACKING
>




More information about the libvir-list mailing list