bug-gnulib
[Top][All Lists]
Advanced

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

gnulib-tool: new field for comments


From: Bruno Haible
Subject: gnulib-tool: new field for comments
Date: Sat, 27 Mar 2010 20:52:37 +0100
User-agent: KMail/1.9.9

Hi,

Some modules (such as 'sigpipe', 'malloc', or 'realloc') are not suitable as
dependencies from tests modules, because the way they are implemented, they
would have side effects on the main module set (in the situation Jim is
seeing with GNU grep).

To avoid this, one needs to add comments to these module descriptions. But
first, a section for comments about the module as a whole should be available.
Implemented as follows:


2010-03-27  Bruno Haible  <address@hidden>

        New module description field 'Comment'.
        * gnulib-tool: New option --extract-comment.
        (func_usage): Document it.
        (sed_extract_prog, sed_extract_field_header): Support 'Comment' field.
        (func_get_comment): New function.
        * modules/TEMPLATE-EXTENDED: Add a blank Comment field.

--- modules/TEMPLATE-EXTENDED.orig      Sat Mar 27 20:46:39 2010
+++ modules/TEMPLATE-EXTENDED   Sat Mar 27 20:39:28 2010
@@ -1,5 +1,7 @@
 Description:
 
+Comment:
+
 Status:
 
 Notice:
--- gnulib-tool.orig    Sat Mar 27 20:46:38 2010
+++ gnulib-tool Sat Mar 27 20:46:07 2010
@@ -133,6 +133,7 @@
        gnulib-tool --test --dir=directory module1 ... moduleN
        gnulib-tool --megatest --dir=directory [module1 ... moduleN]
        gnulib-tool --extract-description module
+       gnulib-tool --extract-comment module
        gnulib-tool --extract-status module
        gnulib-tool --extract-notice module
        gnulib-tool --extract-applicability module
@@ -163,6 +164,7 @@
       --megatest            test the given modules one by one and all together
                             (recommended to use CC=\"gcc -Wall\" here)
       --extract-description        extract the description
+      --extract-comment            extract the comment
       --extract-status             extract the status (obsolete or not)
       --extract-notice             extract the notice or banner
       --extract-applicability      extract the applicability
@@ -1401,6 +1403,7 @@
   :a
     n
     s/^Description:[    ]*$//
+    s/^Comment:[        ]*$//
     s/^Status:[         ]*$//
     s/^Notice:[         ]*$//
     s/^Applicability:[  ]*$//
@@ -1424,6 +1427,7 @@
 # NOTE: Keep this in sync with sed_extract_prog above!
 sed_extract_field_header='
   s/^Description:[      ]*$/description/
+  s/^Comment:[  ]*$/comment/
   s/^Status:[   ]*$/status/
   s/^Notice:[   ]*$/notice/
   s/^Applicability:[    ]*$/applicability/
@@ -1716,6 +1720,32 @@
   fi
 }
 
+# func_get_comment module
+# Input:
+# - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
+func_get_comment ()
+{
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_comment[$1]+set}"; then
+        echo "${modcache_comment[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_comment_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_comment\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
+}
+
 # func_get_status module
 # Input:
 # - local_gnulib_dir  from --local-dir
@@ -5288,6 +5318,16 @@
       fi
     done
     ;;
+
+  extract-comment )
+    for module
+    do
+      func_verify_module
+      if test -n "$module"; then
+        func_get_comment "$module"
+      fi
+    done
+    ;;
 
   extract-status )
     for module




reply via email to

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