bug-gnulib
[Top][All Lists]
Advanced

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

gnulib-tool: new option --extract-notice


From: Bruno Haible
Subject: gnulib-tool: new option --extract-notice
Date: Sun, 9 Sep 2007 14:16:57 +0200
User-agent: KMail/1.5.4

Jim Meyering wrote on 2007-09-04:
> How about adding a way to tell gnulib-tool
> that a module (or just one of its names) is deprecated.  Then, assuming
> both malloc and malloc-gnu module names are accepted and equivalent
> for several months -- while gnulib-tool emits warnings[*] -- remove the
> three deprecated aliases.

Here's a patch that implements this suggestion. It allows an arbitrary notice
to be put into a module, that will be shown when gnulib-tool is run. For
example you can put

  Notice:
  The module malloc has been renamed to malloc-gnu. Please use the new name now.

Bruno


2007-09-09  Bruno Haible  <address@hidden>

        Allow for modules to show an arbitrary notice.
        * modules/TEMPLATE-EXTENDED: Add 'Notice' field.
        * gnulib-tool: New option --extract-notice.
        (func_usage): Document it.
        (sed_extract_prog): Update.
        (func_get_notice): New function.
        (func_modules_notice): New function.
        (func_import, func_create_testdir): Invoke it.
        Suggested by Jim Meyering.

*** modules/TEMPLATE-EXTENDED   3 Apr 2007 23:27:28 -0000       1.1
--- modules/TEMPLATE-EXTENDED   9 Sep 2007 12:09:59 -0000
***************
*** 1,5 ****
--- 1,7 ----
  Description:
  
+ Notice:
+ 
  Files:
  
  Depends-on:
*** gnulib-tool 9 Sep 2007 11:49:58 -0000       1.256
--- gnulib-tool 9 Sep 2007 12:10:00 -0000
***************
*** 89,94 ****
--- 89,95 ----
         gnulib-tool --test --dir=directory module1 ... moduleN
         gnulib-tool --megatest --dir=directory [module1 ... moduleN]
         gnulib-tool --extract-description module
+        gnulib-tool --extract-notice module
         gnulib-tool --extract-filelist module
         gnulib-tool --extract-dependencies module
         gnulib-tool --extract-autoconf-snippet module
***************
*** 114,119 ****
--- 115,121 ----
        --megatest            test the given modules one by one and all together
                              (recommended to use CC=\"gcc -Wall\" here)
        --extract-description        extract the description
+       --extract-notice             extract the notice or banner
        --extract-filelist           extract the list of files
        --extract-dependencies       extract the dependencies
        --extract-autoconf-snippet   extract the snippet for configure.ac
***************
*** 1142,1147 ****
--- 1144,1150 ----
    :a
      n
      s/^Description:[   ]*$//
+     s/^Notice:[        ]*$//
      s/^Files:[         ]*$//
      s/^Depends-on:[    ]*$//
      s/^configure\.ac-early:[   ]*$//
***************
*** 1166,1171 ****
--- 1169,1183 ----
    sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
  }
  
+ # func_get_notice module
+ # Input:
+ # - local_gnulib_dir  from --local-dir
+ func_get_notice ()
+ {
+   func_lookup_file "modules/$1"
+   sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
+ }
+ 
  # func_get_filelist module
  # Input:
  # - local_gnulib_dir  from --local-dir
***************
*** 1444,1449 ****
--- 1456,1482 ----
    fi
  }
  
+ # func_modules_notice
+ # Input:
+ # - local_gnulib_dir  from --local-dir
+ # - verbose         integer, default 0, inc/decremented by --verbose/--quiet
+ # - modules         list of modules, including dependencies
+ func_modules_notice ()
+ {
+   if test $verbose -ge -1; then
+     for module in $modules; do
+       func_verify_module
+       if test -n "$module"; then
+         msg=`func_get_notice $module`
+         if test -n "$msg"; then
+           echo "Notice from module $module:"
+           echo "$msg" | sed -e 's/^/  /'
+         fi
+       fi
+     done
+   fi
+ }
+ 
  # func_modules_to_filelist
  # Input:
  # - local_gnulib_dir  from --local-dir
***************
*** 1463,1469 ****
    files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
  }
  
- 
  # func_execute_command command [args...]
  # Executes a command.
  # Uses also the variables
--- 1496,1501 ----
***************
*** 2148,2153 ****
--- 2180,2188 ----
      done
    fi
  
+   # Show banner notice of every module.
+   func_modules_notice
+ 
    # Determine script to apply to imported library files.
    sed_transform_lib_file=
    for module in $modules; do
***************
*** 3068,3073 ****
--- 3103,3111 ----
    # Add the dummy module if needed.
    func_modules_add_dummy
  
+   # Show banner notice of every module.
+   func_modules_notice
+ 
    # Determine final file list.
    func_modules_to_filelist
    if test $verbose -ge 0; then
***************
*** 3749,3754 ****
--- 3787,3802 ----
      done
      ;;
  
+   extract-notice )
+     for module
+     do
+       func_verify_module
+       if test -n "$module"; then
+         func_get_notice "$module"
+       fi
+     done
+     ;;
+ 
    extract-filelist )
      for module
      do





reply via email to

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