While upgrading sed to use gnulib (at last), I started from the bison bootstrap script and gradually worked from there. In particular, I removed the quadraticness from the loop that Ralf fixed in gnulib-tool very recently and, after noticing the duplication, I set to use "gnulib-tool --update" within the bootstrap script. This works great, as it removes the annoying list of modules included in bison's bootstrap script (it is in gnulib-cache.m4).
However, gnulib-tool is definitely too verbose for this task. The Copying/Replacing/file list/transitive closures could be enabled/disabled with a --verbose switch, but that's for another day. For now, what I'd like, is that gnulib-tool omitted the output parts that the users couldn't care less about. With the attached patch: - I disable the "header file" and "do not forget to" parts of the output if, respectively, there are no new modules (as is the case for --update) and the --makefile-name did not change (likewise) - I disable the message about "gl_EARLY" and "gl_INIT" altogether unless it is the first time gnulib-tool --import is used. I don't have a copyright on file for gnulib (poll is derived from copyright FSF code), and this patch is not important enough to me, to warrant all the mess of getting a copyright assignment. So, if putting it in the public domain is what is needed to have it included, here's what I do. Anyway, my almost-omonymous from the West coast will surely find something wrong :-) and redo the patch anyway! The patch is attached in -ub and -u formats. Thanks, Paolo
--- gnulib-tool 2006-09-24 20:13:52.000000000 +0200 +++ gnulib-tool 2006-09-25 23:00:03.000000000 +0200 @@ -1366,7 +1365,8 @@ fi # Append the cached and the specified module names. So that # "gnulib-tool --import foo" means to add the module foo. - specified_modules="$cached_specified_modules $1" + new_modules="$1" + specified_modules="$cached_specified_modules $new_modules" # Append the cached and the specified avoidlist. This is probably better # than dropping the cached one when --avoid is specified at least once. avoidlist=`echo $cached_avoidlist $avoidlist` @@ -1946,61 +1946,68 @@ fi echo "Finished." - echo - echo "You may need to add #include directives for the following .h files." - ( - # First the #include <...> directives without #ifs, sorted for convenience. - for module in $modules; do - if func_get_include_directive "$module" | grep '^#if' >/dev/null; then - : - else - func_get_include_directive "$module" | grep -v 'include "' - fi - done | LC_ALL=C sort -u - # Then the #include "..." directives without #ifs, sorted for convenience. - for module in $modules; do - if func_get_include_directive "$module" | grep '^#if' >/dev/null; then - : - else - func_get_include_directive "$module" | grep 'include "' - fi - done | LC_ALL=C sort -u - # Then the #include directives that are surrounded by #ifs. Not sorted. - for module in $modules; do - if func_get_include_directive "$module" | grep '^#if' >/dev/null; then - func_get_include_directive "$module" - fi - done - ) | sed -e '/^$/d;' -e 's/^/ /' - echo - echo "Don't forget to" - if test "$makefile_am" = Makefile.am; then - echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac," - else - echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\"," - fi - if test -n "$inctests"; then + if test "$new_modules" != ""; then + echo + echo "You may need to add #include directives for the following .h files." + # First the #include <...> directives without #ifs, sorted for convenience. + for module in $new_modules; do + if func_get_include_directive "$module" | grep '^#if' >/dev/null; then + : + else + func_get_include_directive "$module" | grep -v 'include "' + fi + done | LC_ALL=C sort -u + # Then the #include "..." directives without #ifs, sorted for convenience. + for module in $new_modules; do + if func_get_include_directive "$module" | grep '^#if' >/dev/null; then + : + else + func_get_include_directive "$module" | grep 'include "' + fi + done | LC_ALL=C sort -u + # Then the #include directives that are surrounded by #ifs. Not sorted. + for module in $new_modules; do + if func_get_include_directive "$module" | grep '^#if' >/dev/null; then + func_get_include_directive "$module" + fi + done + fi | sed -e '1,2b; /^$/d;' -e 's/^/ /' + + header_printed=false + func_echo_header () { + $header_printed || { + echo + echo "Don't forget to" + } + header_printed=: + echo "$@" + } + if test "$makefile_am" != "$cached_makefile_name"; then if test "$makefile_am" = Makefile.am; then - echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac," + func_echo_header " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac," else - echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\"," + func_echo_header " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\"," + fi + if test -n "$inctests"; then + if test "$makefile_am" = Makefile.am; then + func_echo_header " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac," + else + func_echo_header " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\"," + fi + fi + if test -n "$inctests"; then + if test "$makefile_am" = Makefile.am; then + testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'` + testsbase_base=`basename "$testsbase"` + func_echo_header " - mention \"${testsbase_base}\" in SUBDIRS in ${testsbase_dir}Makefile.am," + fi fi fi - if test "$makefile_am" = Makefile.am; then - sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'` - sourcebase_base=`basename "$sourcebase"` - echo " - mention \"${sourcebase_base}\" in SUBDIRS in ${sourcebase_dir}Makefile.am," - fi - if test -n "$inctests"; then - if test "$makefile_am" = Makefile.am; then - testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'` - testsbase_base=`basename "$testsbase"` - echo " - mention \"${testsbase_base}\" in SUBDIRS in ${testsbase_dir}Makefile.am," - fi + if test "$cached_specified_modules" = ""; then + func_echo_header " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am," + func_echo_header " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC," + func_echo_header " - invoke ${macro_prefix}_INIT in $configure_ac." fi - echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am," - echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC," - echo " - invoke ${macro_prefix}_INIT in $configure_ac." } # func_create_testdir testdir modules
2006-09-25 Paolo Bonzini <[EMAIL PROTECTED]> * gnulib-tool (func_import): Save the new_modules into a variable. Omit #include directives part for old modules. Omit makefile blurb unless makefile name change, and configure.ac blurb unless this is the first run of gnulib-tool --import. --- gnulib-tool 2006-09-24 20:13:52.000000000 +0200 +++ gnulib-tool 2006-09-25 23:00:03.000000000 +0200 @@ -1366,7 +1365,8 @@ fi # Append the cached and the specified module names. So that # "gnulib-tool --import foo" means to add the module foo. - specified_modules="$cached_specified_modules $1" + new_modules="$1" + specified_modules="$cached_specified_modules $new_modules" # Append the cached and the specified avoidlist. This is probably better # than dropping the cached one when --avoid is specified at least once. avoidlist=`echo $cached_avoidlist $avoidlist` @@ -1946,11 +1946,11 @@ fi echo "Finished." + if test "$new_modules" != ""; then echo echo "You may need to add #include directives for the following .h files." - ( # First the #include <...> directives without #ifs, sorted for convenience. - for module in $modules; do + for module in $new_modules; do if func_get_include_directive "$module" | grep '^#if' >/dev/null; then : else @@ -1958,7 +1958,7 @@ fi done | LC_ALL=C sort -u # Then the #include "..." directives without #ifs, sorted for convenience. - for module in $modules; do + for module in $new_modules; do if func_get_include_directive "$module" | grep '^#if' >/dev/null; then : else @@ -1966,41 +1966,48 @@ fi done | LC_ALL=C sort -u # Then the #include directives that are surrounded by #ifs. Not sorted. - for module in $modules; do + for module in $new_modules; do if func_get_include_directive "$module" | grep '^#if' >/dev/null; then func_get_include_directive "$module" fi done - ) | sed -e '/^$/d;' -e 's/^/ /' + fi | sed -e '1,2b; /^$/d;' -e 's/^/ /' + + header_printed=false + func_echo_header () { + $header_printed || { echo echo "Don't forget to" + } + header_printed=: + echo "$@" + } + if test "$makefile_am" != "$cached_makefile_name"; then if test "$makefile_am" = Makefile.am; then - echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac," + func_echo_header " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac," else - echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\"," + func_echo_header " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\"," fi if test -n "$inctests"; then if test "$makefile_am" = Makefile.am; then - echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac," + func_echo_header " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac," else - echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\"," + func_echo_header " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\"," fi fi - if test "$makefile_am" = Makefile.am; then - sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'` - sourcebase_base=`basename "$sourcebase"` - echo " - mention \"${sourcebase_base}\" in SUBDIRS in ${sourcebase_dir}Makefile.am," - fi if test -n "$inctests"; then if test "$makefile_am" = Makefile.am; then testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'` testsbase_base=`basename "$testsbase"` - echo " - mention \"${testsbase_base}\" in SUBDIRS in ${testsbase_dir}Makefile.am," + func_echo_header " - mention \"${testsbase_base}\" in SUBDIRS in ${testsbase_dir}Makefile.am," + fi + fi fi + if test "$cached_specified_modules" = ""; then + func_echo_header " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am," + func_echo_header " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC," + func_echo_header " - invoke ${macro_prefix}_INIT in $configure_ac." fi - echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am," - echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC," - echo " - invoke ${macro_prefix}_INIT in $configure_ac." } # func_create_testdir testdir modules