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

Re: [PATCH 0/6] xen/x86: Use SPDX (take 1)



Hi Jan,

On 13/02/2023 09:27, Jan Beulich wrote:
On 10.02.2023 00:00, Julien Grall wrote:
This is a first attempt to replace all the full license text with
SPX tag in xen/arch/x86/. For now, this is only covering files with GPL 2.0
and 3 different patterns.

For clarification - the three patterns mentioned here are the three slightly
differently formatted/spelled versions of effectively the same text, not ...

Correct.


I have used the script below to remove the full license and add
an SPDX tag. The script is based on the work from Anthony [1]

42sh> cat replace_license.py
#! /usr/bin/python3
## We are opening/writing to files using the binary mode to avoid
## python interpreting the content (reading ./drivers/video/font_8x14.c
## will throw some encoding error otherwise).

import sys

if len(sys.argv) < 4:
     print("./replace_license <licence-file> <spdx> <file> [debug]")
     exit(1)

licence_file = sys.argv[1]
spdx = str.encode(sys.argv[2])
file = sys.argv[3]
# HACK: enable debug if there is a 4th argument
debug = len(sys.argv) == 5

with open(licence_file, 'rb') as f:
     licence = f.read()

licence_spdx = b"/* SPDX-License-Identifier: " + spdx + b" */\n"

print(f"reading {file}")
with open(file, 'rb') as f:
     whole_file = f.read()

try:
     licence_loc = whole_file.index(licence)
except ValueError:
     print("licence not found. Ignoring")
     exit(0)

# Replace one the below pattern with nothing
## Pattern 1
# * <license>
# *
whole_file = whole_file.replace(licence + b' *\n', b'')

## Pattern 2
# *
# * <license>
whole_file = whole_file.replace(b' *\n' + licence, b'')

## Pattern 3
# /*
#  * <license>
#  */
whole_file = whole_file.replace(b'/*\n' + licence + b' */\n', b'')

## Pattern 4
# *
# * <license>
whole_file = whole_file.replace(b' * \n' + licence, b'')

... referring to the (really four) patterns here?

Julien Grall (6):
   xen/x86: Replace GPL v2.0 copyright with an SPDX tag in *.c
   xen/x86: Replace GPL v2.0 copyright with an SPDX tag in *.c (part 2)
   xen/x86: Replace GPL v2.0 copyright with an SPDX tag in *.h
   xen/x86: Replace GPL v2.0 copyright with an SPDX tag in *.h (part 2)
   xen/x86: Replace GPL v2.0 copyright with an SPDX tag in *.c (part 3)
   xen/x86: Replace GPL v2.0 copyright with an SPDX tag in *.h (part 3)

With the one further adjustment you did spot yourself:
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks! The series is mostly mechanical change. So I am not sure whether I should wait for all the maintainers to ack before committing (it has been already a week).

Any thoughts?

Cheers,

--
Julien Grall



 


Rackspace

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