stat: Update regarding AIX.
[gnulib.git] / gnulib-tool
index 1902c5c..bc967e3 100755 (executable)
@@ -2398,63 +2398,55 @@ func_modules_transitive_closure ()
           if test -n "$duplicated_deps"; then
             func_warning "module $module has duplicated dependencies: "`echo $duplicated_deps`
           fi
-          for dep in $deps; do
-            if test -n "$incobsolete" \
-               || { inc=true
-                    for word in `func_get_status $dep`; do
-                      case "$word" in
-                        obsolete)
-                          inc=false
-                          ;;
-                      esac
-                    done
-                    $inc
-                  }; then
-              func_append inmodules " $dep"
-            fi
-          done
           if test -n "$inctests"; then
             testsmodule=`func_get_tests_module $module`
             if test -n "$testsmodule"; then
-              # Determine whether to include the tests module.
-              inc=true
-              for word in `func_get_status "$testsmodule"`; do
-                case "$word" in
-                  c++-test)
-                    test -z "$excl_cxx_tests" \
-                      || inc=false
-                    test -n "$fmtc_inc_all_tests" || test -n "$inc_cxx_tests" \
-                      || inc=false
-                    ;;
-                  longrunning-test)
-                    test -z "$excl_longrunning_tests" \
-                      || inc=false
-                    test -n "$fmtc_inc_all_tests" || test -n "$inc_longrunning_tests" \
-                      || inc=false
-                    ;;
-                  privileged-test)
-                    test -z "$excl_privileged_tests" \
-                      || inc=false
-                    test -n "$fmtc_inc_all_tests" || test -n "$inc_privileged_tests" \
-                      || inc=false
-                    ;;
-                  unportable-test)
-                    test -z "$excl_unportable_tests" \
-                      || inc=false
-                    test -n "$fmtc_inc_all_tests" || test -n "$inc_unportable_tests" \
-                      || inc=false
-                    ;;
-                  *-test)
-                    test -n "$fmtc_inc_all_tests" \
-                      || inc=false
-                    ;;
-                esac
-              done
-              if $inc; then
-                func_append inmodules " $testsmodule"
-              fi
+              deps="$deps $testsmodule"
             fi
           fi
+          for dep in $deps; do
+            # Determine whether to include the dependency or tests module.
+            inc=true
+            for word in `func_get_status $dep`; do
+              case "$word" in
+                obsolete)
+                  test -n "$incobsolete" \
+                    || inc=false
+                  ;;
+                c++-test)
+                  test -z "$excl_cxx_tests" \
+                    || inc=false
+                  test -n "$fmtc_inc_all_tests" || test -n "$inc_cxx_tests" \
+                    || inc=false
+                  ;;
+                longrunning-test)
+                  test -z "$excl_longrunning_tests" \
+                    || inc=false
+                  test -n "$fmtc_inc_all_tests" || test -n "$inc_longrunning_tests" \
+                    || inc=false
+                  ;;
+                privileged-test)
+                  test -z "$excl_privileged_tests" \
+                    || inc=false
+                  test -n "$fmtc_inc_all_tests" || test -n "$inc_privileged_tests" \
+                    || inc=false
+                  ;;
+                unportable-test)
+                  test -z "$excl_unportable_tests" \
+                    || inc=false
+                  test -n "$fmtc_inc_all_tests" || test -n "$inc_unportable_tests" \
+                    || inc=false
+                  ;;
+                *-test)
+                  test -n "$fmtc_inc_all_tests" \
+                    || inc=false
+                  ;;
+              esac
+            done
+            if $inc; then
+              func_append inmodules " $dep"
+            fi
+          done
         fi
       fi
     done
@@ -2468,6 +2460,31 @@ func_modules_transitive_closure ()
   rm -f "$tmp"/queued-modules
 }
 
+# func_show_module_list
+# Input:
+# - specified_modules  list of specified modules (one per line, sorted)
+# - modules         complete list of modules (one per line, sorted)
+# - tmp             pathname of a temporary directory
+func_show_module_list ()
+{
+  if case "$TERM" in
+       xterm*) test -t 1;;
+       *) false;;
+     esac; then
+    # Assume xterm compatible escape sequences.
+    bold_on=`printf '\x1b[1m'`
+    bold_off=`printf '\x1b[0m'`
+  else
+    bold_on=
+    bold_off=
+  fi
+  echo "Module list with included dependencies (indented):"
+  echo "$specified_modules" | sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
+  echo "$modules" | sed -e '/^$/d' \
+    | LC_ALL=C join -t '|' -a 2 "$tmp"/specified-modules - \
+    | sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/    /' -e 's/^    |\(.*\)$/  '"${bold_on}"'\1'"${bold_off}"'/'
+}
+
 # func_modules_add_dummy
 # Input:
 # - local_gnulib_dir  from --local-dir
@@ -3599,8 +3616,7 @@ func_import ()
   modules="$specified_modules"
   func_modules_transitive_closure
   if test $verbose -ge 0; then
-    echo "Module list with included dependencies:"
-    echo "$modules" | sed -e 's/^/  /'
+    func_show_module_list
   fi
   final_modules="$modules"
 
@@ -4746,7 +4762,10 @@ func_create_testdir ()
     modules=`func_all_modules`
     modules=`for m in $modules; do case $m in config-h | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
   fi
-  modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
+  specified_modules="$modules"
+
+  # Canonicalize the list of specified modules.
+  specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
 
   # Unlike in func_import, here we want to include all kinds of tests for the
   # directly specified modules, but not for dependencies.
@@ -4755,13 +4774,12 @@ func_create_testdir ()
 
   # Check that the license of every module is consistent with the license of
   # its dependencies.
-  saved_modules="$modules"
   saved_inctests="$inctests"
   # When computing transitive closures, don't consider $module to depend on
   # $module-tests. Need this becauses tests are implicitly GPL and may depend
   # on GPL modules - therefore we don't want a warning in this case.
   inctests=""
-  for requested_module in $saved_modules; do
+  for requested_module in $specified_modules; do
     requested_license=`func_get_license "$requested_module"`
     if test "$requested_license" != GPL; then
       # Here we use func_modules_transitive_closure, not just
@@ -4801,7 +4819,6 @@ func_create_testdir ()
       done
     fi
   done
-  modules="$saved_modules"
   inctests="$saved_inctests"
 
   # Subdirectory names.
@@ -4815,10 +4832,10 @@ func_create_testdir ()
   vc_files=
 
   # Determine final module list.
+  modules="$specified_modules"
   func_modules_transitive_closure
   if test $verbose -ge 0; then
-    echo "Module list with included dependencies:"
-    echo "$modules" | sed -e 's/^/  /'
+    func_show_module_list
   fi
 
   # Add the dummy module if needed.