[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH for-4.17 v2 3/6] tools/include/xen-foreign: Add SPDX identifier to generated headers


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Thu, 3 Nov 2022 11:52:01 +0000
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "George Dunlap" <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 03 Nov 2022 11:52:39 +0000
  • Ironport-data: A9a23:VOhq263bOAfYPgR0JfbD5R5xkn2cJEfYwER7XKvMYLTBsI5bpzQGy WZNX2rTOPqONDH0L49+Otiy90kOscDTzIQ2SQE/pC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK5ULSfUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS9XuDgNyo4GlC5wVmPqgS1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfXHFkq /g0AT83QhmFh+Pt66K7dMM1r5F2RCXrFNt3VnBIyDjYCbAtQIzZQrWM7thdtNsyrpkQR7CEP ZNfMGcxKkSbC/FMEg5/5JYWleG0hn75YntApUicv6Yf6GnP1g1hlrPqNbI5f/TaGZgMxBbF9 woq+UyjBRURC8aW1gaqrHmMns/KnSOqCII7QejQGvlC3wTImz175ActfVmmpfi0jGauVtQZL FYbkgIsp6Uv8E2gTvHmQga15nWDu3Y0e9dWCfx81wiLxYLd+QPfDW8BJhZRZdpjuMIoSDgC0 l6Sg8ivFTFpqKeSS3+W6vGTtzzaETcRBX8PY2kDVwRty8L4vIg5gxbLT9BiOK24lNv4HXf32 T/ikcQlr+xN14hRjfz9pA2ZxWL3znTUcuIrzljHdDyhwip2XqKsYYypsnPL7chqda/MGzFto 0M4s8SZ6ekPC7SEmyqMXPgBEdmV2hqVDNHPqQUxRsd8rlxB71bmJNkNu28meC+FJ+5eIVfUj FnvVRS9DXO5FF+jdudJbo24EKzGJoCwRI2+Bpg4gjejC6WdlTNrHgk0OCZ8PEi3yiDAdJ3T3 r/CKK6R4Y4yU/gP8dZPb751PUUX7i4/33jPYpvw0g6q17GTDFbMF+labALSN7tktv3byOkwz zq4H5LUoyizrcWkOnWHmWLtBQ1iwYcH6WDe9JUMK7/rzvtOE2A9Ef7BqY7NiKQ895m5Ytzgp yjlMnK0PXKl2hUr3y3WNS04AF4uNL4jxU8G0dsEZwbwhyZ7Otjzs8/ytfIfJNEayQCq9tYsJ 9FtRilKKq0npujvk9jFUaTAkQ==
  • Ironport-hdrordr: A9a23:Dnlafa0BB8cLsyPYVg+hmQqjBIokLtp133Aq2lEZdPRUGvb3qy nIpoV86faUskdoZJhOo7C90cW7LU80sKQFhLX5Xo3SOzUO2lHYT72KhLGKq1aLdhEWtNQtsZ uIG5IOceEYZmIasS+V2maF+q4bsbu6zJw=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The headers install in "/usr/include/xen/foreign/" are missing a
licence header. This patch adds a SPDX identifier to clarify that
the MIT licence is used.

The script now check that the licence of the input file is also MIT,
by checking for the presence of the SPDX identifier.

Also add information about which files are used to generate the
headers.

Reported-by: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---

Notes:
    v2:
    - Add a SPDX identifier instead of trying to capture the original
      licence text.
    - Check the SPDX identifier of the input headers.
    - Add information about which headers are used as input.

 tools/include/xen-foreign/mkheader.py | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tools/include/xen-foreign/mkheader.py 
b/tools/include/xen-foreign/mkheader.py
index fb268f0dce..ec8a321395 100644
--- a/tools/include/xen-foreign/mkheader.py
+++ b/tools/include/xen-foreign/mkheader.py
@@ -1,5 +1,6 @@
 #!/usr/bin/python
 
+from __future__ import print_function
 import sys, re;
 from structs import unions, structs, defines;
 
@@ -114,23 +115,37 @@ input  = "";
 output = "";
 fileid = re.sub("[-.]", "_", "__FOREIGN_%s__" % outfile.upper());
 
-# read input header files
 for name in infiles:
     f = open(name, "r");
+    # Check the licence of the input file, only SPDX identifier is accepted by
+    # this script.
+    line = f.readline()
+    if not line == "/* SPDX-License-Identifier: MIT */\n":
+        print("%s: Error: %s is missing SPDX identifier" % (sys.argv[0], 
name), file=sys.stderr)
+        exit(1)
     input += f.read();
     f.close();
 
+# replace path in "infiles" by path in '/usr/include' to avoid exposing the
+# build directory path in the generated headers.
+headers_name_list = ""
+public_headers_location = 'xen/include/public/'
+for name in infiles:
+    i = name.rindex(public_headers_location)
+    i += len(public_headers_location)
+    headers_name_list += " xen/%s" % (name[i:])
+
 # add header
-output += """
+output += """/* SPDX-License-Identifier: MIT */
 /*
  * public xen defines and struct for %s
- * generated by %s -- DO NOT EDIT
+ * generated from%s by %s -- DO NOT EDIT
  */
 
 #ifndef %s
 #define %s 1
 
-""" % (arch, sys.argv[0], fileid, fileid)
+""" % (arch, headers_name_list, sys.argv[0], fileid, fileid)
 
 if arch in header:
     output += header[arch];
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.