bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnulib-tool: List modules separately, explicit vs dependenci


From: Bruno Haible
Subject: Re: [PATCH] gnulib-tool: List modules separately, explicit vs dependencies.
Date: Sun, 13 Jun 2010 15:57:00 +0200
User-agent: KMail/1.9.9

Hi Thi,

> To me, somewhat interesting is a count of the specified modules
> (i.e., aggregate information that i am not directly aware of),
> and really interesting is the full list of "support modules"
> (non-specified dependencies).  The latter because it gives me
> an idea of the project's "utility" of gnulib (roughly, the
> ratio between specified and supported modules -- higher is
> better).

For me, it's a bit different: I don't think the number of modules
has a lot of information. There are some modules, like 'stdint',
which provide hardly any code, and 'regex', which are complex and
heavy.

But I acknowledge your wish to see specified modules and dependencies to be
distinguishable in the output. How can it be done in a lightweight way,
without reducing the ability to copy&paste the module list? I think
indentation is a reasonable way of doing it. Like this:

Module list with included dependencies (indented):
    alloca-opt
    arg-nonnull
    c++defs
    errno
    extensions
    float
    fpieee
  fprintf-posix
    fpucw
    frexp-nolibm
    frexpl-nolibm
    fseterr
    include_next
    isnand-nolibm
    isnanf-nolibm
    isnanl-nolibm
    math
    memchr
    multiarch
    nocrash
    printf-frexp
    printf-frexpl
    printf-safe
    signbit
    size_max
    stddef
    stdint
    stdio
    string
    vasnprintf
    warn-on-use
    wchar
    xsize

I think this should serve your need? I'm applying this:


2010-06-13  Bruno Haible  <address@hidden>

        gnulib-tool: Display specified modules and dependencies differently.
        * gnulib-tool (func_show_module_list): New function.
        (func_import, func_create_testdir): Invoke it.
        Reported by Thien-Thi Nguyen <address@hidden>.

--- gnulib-tool.orig    Sun Jun 13 15:45:47 2010
+++ gnulib-tool Sun Jun 13 15:45:27 2010
@@ -2460,6 +2460,31 @@
   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
@@ -3591,8 +3616,7 @@
   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"
 
@@ -4811,8 +4835,7 @@
   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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]