Mercurial > hg > octave-lojdl > gnulib-hg
changeset 16153:04717ea7c365
gnulib-tool: Verify that the License field is present and non-empty.
* gnulib-tool (func_get_license_raw): New function, extracted from
func_get_license.
(func_get_license): Use it. Warn if the module is not a test module and
has no license.
Suggested by Jim Meyering.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 03 Dec 2011 16:19:56 +0100 |
parents | cd99c80c513b |
children | 03dcd25a20a4 |
files | ChangeLog gnulib-tool |
diffstat | 2 files changed, 46 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-12-03 Bruno Haible <bruno@clisp.org> + + gnulib-tool: Verify that the License field is present and non-empty. + * gnulib-tool (func_get_license_raw): New function, extracted from + func_get_license. + (func_get_license): Use it. Warn if the module is not a test module and + has no license. + Suggested by Jim Meyering. + 2011-12-03 Bruno Haible <bruno@clisp.org> sethostname tests: Fix link error on mingw.
--- a/gnulib-tool +++ b/gnulib-tool @@ -2375,31 +2375,50 @@ fi } +# func_get_license_raw module +# Input: +# - local_gnulib_dir from --local-dir +# - modcache true or false, from --cache-modules/--no-cache-modules +func_get_license_raw () +{ + if ! $modcache; then + func_lookup_file "modules/$1" + sed -n -e "/^License$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 eval 'test -n "${modcache_license[$1]+set}"'; then + eval 'echo "${modcache_license[$1]}"' + fi + else + eval "field_set=\"\$${cachevar}_license_set\"" + if test -n "$field_set"; then + eval "field_value=\"\$${cachevar}_license\"" + echo "${field_value}" + fi + fi + fi +} + # func_get_license module # Input: # - local_gnulib_dir from --local-dir # - modcache true or false, from --cache-modules/--no-cache-modules func_get_license () { + # Warn if the License field is missing. + case "$1" in + *-tests ) ;; + * ) + license=`func_get_license_raw "$1"` + if test -z "$license"; then + func_warning "module $1 lacks a License" + fi + ;; + esac { - if ! $modcache; then - func_lookup_file "modules/$1" - sed -n -e "/^License$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 eval 'test -n "${modcache_license[$1]+set}"'; then - eval 'echo "${modcache_license[$1]}"' - fi - else - eval "field_set=\"\$${cachevar}_license_set\"" - if test -n "$field_set"; then - eval "field_value=\"\$${cachevar}_license\"" - echo "${field_value}" - fi - fi - fi + func_get_license_raw "$1" # The default is GPL. echo "GPL" } | sed -e 's,^ *$,,' | sed -e 1q