On 05/16/2013 12:53 AM, Martin Kletzander wrote:
On 05/16/2013 02:23 AM, Eric Blake wrote:
> To ensure we don't regress and cause the need for further
> cleanups, add a 'make syntax-check' rule that ensures new
> files have proper copyright contents.
>
> * cfg.mk (sc_copyright_file): New rule.
>
>
> +# We have to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), but
> +# we want source files to be explicit that they are LGPL.
> +sc_copyright_file:
> + @prohibit='COPYING([^.]|\.LIB)' \
COPYING.asdf and similar wouldn't match, but we don't need to take care
of that.
Aha - I can use require=COPYING\.LESSER and containing=COPYING, to
fine-tune this to say that if "COPYING" is present, it better be a
substring of "COPYING.LESSER" in at least one usage; I can't outright
forbid plain COPYING (think the spec file, which installs both), but can
forbid COPYING.LIB (any file accidentally referring to the old name).
Since most files use the string "COPYING" zero times (our usual
boilerplate) or one time (calling out a single file), this will catch
most common abuses.
ACK,
Even though I still don't prevent someone from saying "COPYING.asdf" if
they also use "COPYING.LESSER" somewhere else in the same file, I don't
think anyone will really attempt that. Meanwhile, with my tweaks, I was
able to get the exception list smaller (which was the only reason I
originally created a new rule in the first place), so I was able to
combine my new rule with an existing one and rename it to cover the fact
that it now covers multiple copyright usage checks. Here's what I pushed.
From 0e55024e7b5c57adbe5fd0258cd7d890929488ac Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake(a)redhat.com>
Date: Tue, 14 May 2013 17:41:15 -0600
Subject: [PATCH] maint: enforce correct copyright usage
To ensure we don't regress and cause the need for further
cleanups, add a 'make syntax-check' rule that ensures new
files have proper copyright contents.
* cfg.mk (sc_copyright_address): Rename...
(sc_copyright_usage): ...and enhance.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
cfg.mk | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index e013195..639ac83 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -682,11 +682,22 @@ sc_copyright_format:
$(_sc_search_regexp)
# Prefer the new URL listing over the old street address listing when
-# calling out where to get a copy of the [L]GPL.
-sc_copyright_address:
+# calling out where to get a copy of the [L]GPL. Also, while we have
+# to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), we want any
+# source file that calls out a top-level file to call out the LGPL
+# version. Note that our typical copyright boilerplate refers to the
+# license by name, not by reference to a top-level file.
+sc_copyright_usage:
@prohibit=Boston,' MA' \
halt='Point to <
http://www.gnu.org/licenses/>, not an address' \
$(_sc_search_regexp)
+ @require='COPYING\.LESSER' \
+ containing='COPYING' \
+ halt='Refer to COPYING.LESSER for LGPL' \
+ $(_sc_search_regexp)
+ @prohibit='COPYING\.LIB' \
+ halt='Refer to COPYING.LESSER for LGPL' \
+ $(_sc_search_regexp)
# Some functions/macros produce messages intended solely for developers
# and maintainers. Do not mark them for translation.
@@ -853,7 +864,7 @@ exclude_file_name_regexp--sc_avoid_write = \
exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
-exclude_file_name_regexp--sc_copyright_address = \
+exclude_file_name_regexp--sc_copyright_usage = \
^COPYING(|\.LESSER)$$
exclude_file_name_regexp--sc_flags_usage =
^(docs/|src/util/virnetdevtap\.c$$|tests/vircgroupmock\.c$$)
--
1.8.1.4
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org