summaryrefslogtreecommitdiff
path: root/gnulib-tool
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-12-03 16:19:56 +0100
committerBruno Haible <bruno@clisp.org>2011-12-03 16:19:56 +0100
commitc7ceb8a4e434ec8ab76af04b6ec01e78786a16df (patch)
treed788570ee40f554dafcb14fd6e8e8f0108ae7bfd /gnulib-tool
parent99e8c6b00e5399e9d22fd5a0d27dc523d9ea0373 (diff)
downloadgnulib-c7ceb8a4e434ec8ab76af04b6ec01e78786a16df.tar.gz
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.
Diffstat (limited to 'gnulib-tool')
-rwxr-xr-xgnulib-tool55
1 files changed, 37 insertions, 18 deletions
diff --git a/gnulib-tool b/gnulib-tool
index 792bd4993d..d9d4526ccb 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -2375,31 +2375,50 @@ func_get_link_directive ()
fi
}
-# func_get_license module
+# 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 ()
+func_get_license_raw ()
{
- {
- if ! $modcache; then
- func_lookup_file "modules/$1"
- sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
+ 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
- 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
+ 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
+ {
+ func_get_license_raw "$1"
# The default is GPL.
echo "GPL"
} | sed -e 's,^ *$,,' | sed -e 1q