From d2308903f51c7987816eeb3323249371d14d4813 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 27 Mar 2010 20:52:28 +0100 Subject: [PATCH] New module description field 'Comment'. --- ChangeLog | 9 +++++++++ gnulib-tool | 40 ++++++++++++++++++++++++++++++++++++++++ modules/TEMPLATE-EXTENDED | 2 ++ 3 files changed, 51 insertions(+) diff --git a/ChangeLog b/ChangeLog index 788a079c4..0d65edb9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2010-03-27 Bruno Haible + 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 + Addendum to 2010-02-07 commit. * gnulib-tool (func_usage): Document --extract-applicability option. diff --git a/gnulib-tool b/gnulib-tool index c17d8896d..b314dc530 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -133,6 +133,7 @@ Usage: gnulib-tool --list 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 @@ Operation modes: --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 @@ sed_extract_prog=':[ ]*$/ { :a n s/^Description:[ ]*$// + s/^Comment:[ ]*$// s/^Status:[ ]*$// s/^Notice:[ ]*$// s/^Applicability:[ ]*$// @@ -1424,6 +1427,7 @@ sed_extract_prog=':[ ]*$/ { # 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 @@ func_get_description () 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 @@ s/\([.*$]\)/[\1]/g' 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 diff --git a/modules/TEMPLATE-EXTENDED b/modules/TEMPLATE-EXTENDED index d3f3e84f2..c9e905189 100644 --- a/modules/TEMPLATE-EXTENDED +++ b/modules/TEMPLATE-EXTENDED @@ -1,5 +1,7 @@ Description: +Comment: + Status: Notice: -- 2.11.0