changeset 13070:71d59ec8c75f

New module description field 'Comment'.
author Bruno Haible <bruno@clisp.org>
date Sat, 27 Mar 2010 20:52:28 +0100
parents 5a91813baecc
children b2385e7b332e
files ChangeLog gnulib-tool modules/TEMPLATE-EXTENDED
diffstat 3 files changed, 51 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-03-27  Bruno Haible  <bruno@clisp.org>
+
+	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.
+
 2010-03-27  Bruno Haible  <bruno@clisp.org>
 
 	Addendum to 2010-02-07 commit.
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -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
@@ -5289,6 +5319,16 @@
     done
     ;;
 
+  extract-comment )
+    for module
+    do
+      func_verify_module
+      if test -n "$module"; then
+        func_get_comment "$module"
+      fi
+    done
+    ;;
+
   extract-status )
     for module
     do
--- a/modules/TEMPLATE-EXTENDED
+++ b/modules/TEMPLATE-EXTENDED
@@ -1,5 +1,7 @@
 Description:
 
+Comment:
+
 Status:
 
 Notice: