[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN PATCH for-4.17 2/4] tools/include/xen-foreign: Capture licences from the input headers
The headers install in "/usr/include/xen/foreign/" are missing a licence. While we could probably just add the MIT licence to the generated file, this patch instead try to grab the licence from the original input file. Since licences are in the first multiline C comments, we just look for that. Also with this patch, the possible licences will not be in the "input" variable anymore, but it should be unnecessary to generate the foreign header. With this change, the licence will be copied 2 or 3 time in the install headers depending on the number of input headers. Reported-by: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- Notes: Maybe instead of this, we should just stamp this on the generated header /* SPDX-License-Identifier: MIT */ but we would be missing the "Copyright" informations. I guess we could look for those line with Copyright and copy them. Or, we could replace the licence in the input header by a SPDX and have the script parse that. (Probably still need to grab the Copyright lines) CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: George Dunlap <george.dunlap@xxxxxxxxxx> CC: Jan Beulich <jbeulich@xxxxxxxx> CC: Julien Grall <julien@xxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> tools/include/xen-foreign/mkheader.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py index fb268f0dce..07a9bcbd01 100644 --- a/tools/include/xen-foreign/mkheader.py +++ b/tools/include/xen-foreign/mkheader.py @@ -114,9 +114,19 @@ input = ""; output = ""; fileid = re.sub("[-.]", "_", "__FOREIGN_%s__" % outfile.upper()); -# read input header files +# Try to captures licences headers from original files. +# heuristic: just look for the end of the first multiline comment. +licence_headers = ""; + for name in infiles: f = open(name, "r"); + while True: + line = f.readline() + if not line: + break + licence_headers += line + if line == " */\n": + break input += f.read(); f.close(); @@ -126,11 +136,12 @@ output += """ * public xen defines and struct for %s * generated by %s -- DO NOT EDIT */ +%s #ifndef %s #define %s 1 -""" % (arch, sys.argv[0], fileid, fileid) +""" % (arch, sys.argv[0], licence_headers, fileid, fileid) if arch in header: output += header[arch]; -- Anthony PERARD
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |