[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: spurious message about include files from `bootstrap' script
From: |
Bruno Haible |
Subject: |
Re: spurious message about include files from `bootstrap' script |
Date: |
Sat, 3 Dec 2011 16:19:45 +0100 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
Jim Meyering wrote:
> How about diagnosing a missing License: when
> the module is not a -test one?
Neat idea. This one can be implemented without a heuristic. Done as follows:
2011-12-03 Bruno Haible <address@hidden>
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.
--- gnulib-tool.orig Sat Dec 3 16:16:52 2011
+++ gnulib-tool Sat Dec 3 16:14:34 2011
@@ -2375,31 +2375,50 @@
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
--
In memoriam Rudolf Slánský <http://en.wikipedia.org/wiki/Rudolf_Slánský>