Hi Paul,

You didn't mention a test case, how to reproduce? Therefore I have to ask
you to test a modification.

> diff --git a/gnulib-tool b/gnulib-tool
> index 628d9d6..2e3b6ca 100755
> --- a/gnulib-tool
> +++ b/gnulib-tool
> @@ -2731,6 +2731,9 @@ func_modules_transitive_closure ()
>                esac
>              done
>              if $inc; then
> +              func_acceptable $dep || inc=false
> +            fi
> +            if $inc; then
>                func_append inmodules " $dep"
>                if test "$cond_dependencies" = true; then
>                  escaped_dep=`echo "$dep" | sed -e "$sed_escape_dependency"`

I had hoped that it would be possible to call func_acceptable
only once for every module. But apparently not...

I'll prefer a simpler code here.

> @@ -3958,7 +3961,9 @@ func_emit_autoconf_snippets ()
>            echo "      $shellvar=true"
>            deps=`func_get_dependencies $module | sed -e 
> "$sed_dependencies_without_conditions"`
>            for dep in $deps; do
> -            if func_cond_module_p "$dep"; then
> +            if ! func_acceptable $dep; then
> +              :
> +            elif func_cond_module_p "$dep"; then
>                func_module_shellfunc_name "$dep"
>                func_cond_module_condition "$module" "$dep"
>                if test "$condition" != true; then
> @@ -3988,7 +3993,9 @@ func_emit_autoconf_snippets ()
>          else
>            deps=`func_get_dependencies $module | sed -e 
> "$sed_dependencies_without_conditions"`
>            for dep in $deps; do
> -            if func_cond_module_p "$dep"; then
> +            if ! func_acceptable $dep; then
> +              :
> +            elif func_cond_module_p "$dep"; then
>                func_module_shellfunc_name "$dep"
>                func_cond_module_condition "$module" "$dep"
>                if test "$condition" != true; then

Here it's better to not add more inputs to func_emit_autoconf_snippets.
func_acceptable is really only meant as an auxiliary function for
func_transitive_closure. Once the transitive closure of modules
(with avoids, tests, etc.) is computed, one should stick to that list.
func_emit_autoconf_snippets is pretty late in the processing chain,
it should be satisfied with the values it gets from the earlier steps.

> @@ -6507,6 +6514,9 @@ s/\([.*$]\)/[\1]/g'
>      ;;
>  
>    extract-dependencies )
> +    if test -n "$avoidlist"; then
> +      func_fatal_error "cannot combine --avoid and --extract-dependencies"
> +    fi
>      for module
>      do
>        func_verify_module

Fine.

Can you please test the attached patch (on top of yours)?

Bruno
-- 
In memoriam Anna Politkovskaya <http://en.wikipedia.org/wiki/Anna_Politkovskaya>
--- gnulib-tool.orig	Sat Oct  8 00:27:05 2011
+++ gnulib-tool	Sat Oct  8 00:26:52 2011
@@ -2730,10 +2730,7 @@
                   ;;
               esac
             done
-            if $inc; then
-              func_acceptable $dep || inc=false
-            fi
-            if $inc; then
+            if $inc && func_acceptable "$dep"; then
               func_append inmodules " $dep"
               if test "$cond_dependencies" = true; then
                 escaped_dep=`echo "$dep" | sed -e "$sed_escape_dependency"`
@@ -3924,6 +3921,7 @@
   disable_libtool="$4"
   disable_gettext="$5"
   if test "$cond_dependencies" = true; then
+    for m in $modules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/modules
     # Emit the autoconf code for the unconditional modules.
     for module in $1; do
       eval $verifier
@@ -3960,10 +3958,10 @@
           func_emit_autoconf_snippet "      "
           echo "      $shellvar=true"
           deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
+          # Intersect $deps with the modules list $1.
+          deps=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
           for dep in $deps; do
-            if ! func_acceptable $dep; then
-              :
-            elif func_cond_module_p "$dep"; then
+            if func_cond_module_p "$dep"; then
               func_module_shellfunc_name "$dep"
               func_cond_module_condition "$module" "$dep"
               if test "$condition" != true; then
@@ -3992,10 +3990,10 @@
           :
         else
           deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
+          # Intersect $deps with the modules list $1.
+          deps=`for m in $deps; do echo $m; done | LC_ALL=C sort -u | LC_ALL=C join - "$tmp"/modules`
           for dep in $deps; do
-            if ! func_acceptable $dep; then
-              :
-            elif func_cond_module_p "$dep"; then
+            if func_cond_module_p "$dep"; then
               func_module_shellfunc_name "$dep"
               func_cond_module_condition "$module" "$dep"
               if test "$condition" != true; then

Reply via email to