This should have ideally been part of commit 'v1.11-519-g1ec1668' of 23-11-2011 "info: allow user to inhibit creation/update of '${infodir}/dir'". Well, better late than never.
* lib/am/texinfos.am (uninstall-info-am): Don't look anymore at the output of "install-info --version" to decide whether to use it to update the '${infodir}/dir' or not; instead, honour the environment variable 'AM_UPDATE_INFO_DIR'. To avoid code duplication with ... (install-info-am): ... the recipe of this target, move common code out to ... (am__can_run_installinfo): ... this new internal variable. * tests/install-info-dir.test: Enhance. * doc/automake.texi (Texinfo): Update. * NEWS: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> --- A minor bugfixing patch I'd like to squash in before 1.11.4. I will push it this evening or tomorrow if there is no objection. NEWS | 6 +++--- doc/automake.texi | 10 +++++----- lib/am/texinfos.am | 27 ++++++++++++++------------- tests/install-info-dir.test | 40 +++++++++++++++++++++++++++++++++++----- 4 files changed, 57 insertions(+), 26 deletions(-) diff --git a/NEWS b/NEWS index 5d463da..8809d2c 100644 --- a/NEWS +++ b/NEWS @@ -103,9 +103,9 @@ New in 1.11.0a: file generated by automake-provided rules by defining the special make variable `$(EXTRA_DEJAGNU_SITE_CONFIG)'. - - The `install-info' rule can now be instructed not to create/update - the `${infodir}/dir' file, by exporting the new environment variable - `AM_UPDATE_INFO_DIR' to the value "no". + - The `install-info' and `uninstall-info' rules can now be instructed + not to create/update the `${infodir}/dir' file, by exporting the new + environment variable `AM_UPDATE_INFO_DIR' to the value "no". - For programs and libraries, automake now detects EXTRA_foo_DEPENDENCIES and adds them to the normal list of dependencies, but without diff --git a/doc/automake.texi b/doc/automake.texi index 7421029..9b6b8f5 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -8025,11 +8025,11 @@ be prevented via the @code{no-installinfo} option. In this case, request this explicitly using @samp{make install-info}. @vindex AM_UPDATE_INFO_DIR -By default, @code{make install-info} will try to run the -@command{install-info} program (if available) to update (or create) -the @file{@code{$@{infodir@}}/dir} index. If this is undesired, it -can be prevented by exporting the @code{AM_UPDATE_INFO_DIR} variable -to "@code{no}". +By default, @code{make install-info} and @code{make install-info} +will try to run the @command{install-info} program (if available) +to update (or create) the @file{@code{$@{infodir@}}/dir} index. +If this is undesired, it can be prevented by exporting the +@code{AM_UPDATE_INFO_DIR} variable to "@code{no}". The following variables are used by the Texinfo build rules. diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am index 9190e8f..1a1766e 100644 --- a/lib/am/texinfos.am +++ b/lib/am/texinfos.am @@ -94,6 +94,18 @@ endif ! %?LOCAL-TEXIS% ## Installing. ## ## ------------ ## +## Some code should be run only if install-info actually exists, and +## if the user doesn't request it not to be run (through the +## 'AM_UPDATE_INFO_DIR' environment variable). See automake bug#9773 +## and Debian Bug#543992. +if %?FIRST% +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +endif + ## Look in both . and srcdir because the info pages might have been ## rebuilt in the build directory. Can't cd to srcdir; that might ## break a possible install-sh reference. @@ -222,16 +234,7 @@ install-info-am: $(INFO_DEPS) echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) -## Only run this code if install-info actually exists, and if the user -## doesn't request it not to be run (through the `AM_UPDATE_INFO_DIR' -## environment variable). See automake bug#9773 and Debian Bug#543992. - @am__run_installinfo=yes; \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) am__run_installinfo=no;; \ - *) (install-info --version) >/dev/null 2>&1 \ - || am__run_installinfo=no;; \ - esac; \ - if test $$am__run_installinfo = yes; then \ + @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ ## Strip directory @@ -322,9 +325,7 @@ uninstall-info-am: @$(PRE_UNINSTALL) ## Run two loops here so that we can handle PRE_UNINSTALL and ## NORMAL_UNINSTALL correctly. - @if test -d '$(DESTDIR)$(infodir)' && \ - (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ diff --git a/tests/install-info-dir.test b/tests/install-info-dir.test index 044bf6d..405480d 100755 --- a/tests/install-info-dir.test +++ b/tests/install-info-dir.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# Copyright (C) 2011, 2012 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -78,12 +78,28 @@ fi # by default (if the `install-info' program is available). # This should happen in a normal as well as in a DESTDIR installation. if test $have_installinfo = yes; then + $MAKE install-info test -f $instdir/info/foo.info test -f $instdir/info/dir + $FGREP 'Does nothing at all, but has a nice name' $instdir/info/dir + + $MAKE uninstall + test ! -f $instdir/info/foo.info + $FGREP 'but has a nice name' $instdir/info/dir && Exit 1 + + dir="$destdir/$cwd/$instdir/info" + $MAKE DESTDIR="$cwd/$destdir" install-info - test -f "$destdir/$cwd/$instdir"/info/foo.info - test -f "$destdir/$cwd/$instdir"/info/dir + test -f "$dir"/foo.info + test -f "$dir"/dir + $FGREP 'Does nothing at all, but has a nice name' "$dir"/dir + $MAKE DESTDIR="$cwd/$destdir" uninstall + test ! -f "$dir"/foo.info + $FGREP 'but has a nice name' "$dir"/dir && Exit 1 + + unset dir + fi rm -rf $instdir $destdir @@ -121,6 +137,11 @@ END $MAKE install-info test -f $instdir/info/foo.info test -f $instdir/info/dir + $MAKE uninstall + test ! -f $instdir/info/foo.info + test -f $instdir/info/dir + $FGREP 'but has a nice name' $instdir/info/dir && Exit 1 + : For shells with busted 'set -e'. fi rm -rf $instdir bin/install-info @@ -134,15 +155,24 @@ for val in no NO n; do test -f $instdir/info/foo.info test ! -f $instdir/info/dir done + +$MAKE install-info +chmod a-w $instdir/info/dir +for val in no NO n; do + env AM_UPDATE_INFO_DIR="$val" $MAKE uninstall + $FGREP 'Does nothing at all, but has a nice name' $instdir/info/dir +done + if test $have_installinfo = yes; then for val in 'yes' 'who cares!'; do rm -rf $instdir env AM_UPDATE_INFO_DIR="$val" $MAKE install-info test -f $instdir/info/foo.info test -f $instdir/info/dir + env AM_UPDATE_INFO_DIR="$val" $MAKE uninstall + test ! -f $instdir/info/foo.info + $FGREP 'but has a nice name' $instdir/info/dir && Exit 1 done fi -rm -rf $instdir - : -- 1.7.9