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

[PATCH v2 0/7] xen/x86: Use SPDX (take 1)



From: Julien Grall <jgrall@xxxxxxxxxx>

Hi all,

This is a first attempt to replace all the full license text with
SPX tag in xen/arch/x86/. This is covering most of the x86 files.

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].

#! /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
# *
# * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# *
# * <licence>
# *
# * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
whole_file = whole_file.replace(
b' *\n'  +
b' * 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n' +
b' *\n'  +
licence +
b' *\n' +
b' * 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n', 
b'')

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

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

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

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

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

# Check if the license was removed
try:
    _ = whole_file.index(licence)
    print("The license was not removed. Bailing out")
    exit(0)
except ValueError:
    print("The license was removed. Updating the file")

if debug:
    print(whole_file)
else:
    with open('%s' % file, 'wb') as f:
        f.write(licence_spdx)
        f.write(whole_file)

[1] 
https://lore.kernel.org/xen-devel/20221103115204.49610-7-anthony.perard@xxxxxxxxxx/

Julien Grall (7):
  LICENSES: Clarify that the SPDX tag GPL-2.0 is deprecated
  xen/x86: Replace GPL v2.0 license boilerplate with an SPDX tag in *.c
  xen/x86: Replace GPL v2.0 license boilerplate with an SPDX tag in *.c
    (part 3)
  xen/x86: Replace GPL v2.0 license boilerplate with an SPDX tag in *.h
  xen/x86: Replace GPL v2.0 license boilerplate with an SPDX tag in *.h
    (part 3)
  xen/x86: Replace GPL v2.0+ license boilerplate with an SPDX tag in *.c
  xen/x86: Replace GPL v2.0+ license boilerplate with an SPDX tag in *.h

 LICENSES/GPL-2.0                              |  4 ++--
 xen/arch/x86/alternative.c                    | 14 +-------------
 xen/arch/x86/cpu/mcheck/amd_nonfatal.c        | 14 +-------------
 xen/arch/x86/cpu/mcheck/mce_amd.c             | 14 +-------------
 xen/arch/x86/cpu/mcheck/vmce.c                | 14 +-------------
 xen/arch/x86/cpu/mcheck/x86_mca.h             | 14 +-------------
 xen/arch/x86/cpu/mwait-idle.c                 | 13 +------------
 xen/arch/x86/cpu/vpmu.c                       | 13 +------------
 xen/arch/x86/cpu/vpmu_amd.c                   | 13 +------------
 xen/arch/x86/cpu/vpmu_intel.c                 | 13 +------------
 xen/arch/x86/genapic/x2apic.c                 | 13 +------------
 xen/arch/x86/guest/hyperv/hyperv.c            | 14 +-------------
 xen/arch/x86/guest/hyperv/private.h           | 14 +-------------
 xen/arch/x86/guest/hyperv/tlb.c               | 14 +-------------
 xen/arch/x86/guest/hyperv/util.c              | 14 +-------------
 xen/arch/x86/guest/hypervisor.c               | 14 +-------------
 xen/arch/x86/guest/xen/pvh-boot.c             | 14 +-------------
 xen/arch/x86/guest/xen/xen.c                  | 14 +-------------
 xen/arch/x86/hvm/asid.c                       | 13 +------------
 xen/arch/x86/hvm/dm.c                         | 13 +------------
 xen/arch/x86/hvm/dom0_build.c                 | 13 +------------
 xen/arch/x86/hvm/domain.c                     | 13 +------------
 xen/arch/x86/hvm/grant_table.c                | 14 +-------------
 xen/arch/x86/hvm/hpet.c                       | 13 +------------
 xen/arch/x86/hvm/hvm.c                        | 13 +------------
 xen/arch/x86/hvm/hypercall.c                  | 14 +-------------
 xen/arch/x86/hvm/intercept.c                  | 13 +------------
 xen/arch/x86/hvm/io.c                         | 13 +------------
 xen/arch/x86/hvm/ioreq.c                      | 13 +------------
 xen/arch/x86/hvm/irq.c                        | 13 +------------
 xen/arch/x86/hvm/mtrr.c                       | 13 +------------
 xen/arch/x86/hvm/nestedhvm.c                  | 13 +------------
 xen/arch/x86/hvm/pmtimer.c                    | 13 +------------
 xen/arch/x86/hvm/quirks.c                     | 13 +------------
 xen/arch/x86/hvm/save.c                       | 13 +------------
 xen/arch/x86/hvm/svm/asid.c                   | 13 +------------
 xen/arch/x86/hvm/svm/emulate.c                | 13 +------------
 xen/arch/x86/hvm/svm/intr.c                   | 13 +------------
 xen/arch/x86/hvm/svm/nestedsvm.c              | 13 +------------
 xen/arch/x86/hvm/svm/svm.c                    | 13 +------------
 xen/arch/x86/hvm/svm/svmdebug.c               | 13 +------------
 xen/arch/x86/hvm/svm/vmcb.c                   | 13 +------------
 xen/arch/x86/hvm/vlapic.c                     | 13 +------------
 xen/arch/x86/hvm/vmx/intr.c                   | 13 +------------
 xen/arch/x86/hvm/vmx/vmcs.c                   | 13 +------------
 xen/arch/x86/hvm/vmx/vmx.c                    | 13 +------------
 xen/arch/x86/hvm/vmx/vvmx.c                   | 13 +------------
 xen/arch/x86/hvm/vpt.c                        | 13 +------------
 xen/arch/x86/hypercall.c                      | 14 +-------------
 xen/arch/x86/include/asm/altp2m.h             | 13 +------------
 xen/arch/x86/include/asm/endbr.h              | 14 +-------------
 xen/arch/x86/include/asm/guest.h              | 13 +------------
 xen/arch/x86/include/asm/guest/hyperv-hcall.h | 13 +------------
 xen/arch/x86/include/asm/guest/hyperv.h       | 13 +------------
 xen/arch/x86/include/asm/guest/hypervisor.h   | 13 +------------
 xen/arch/x86/include/asm/guest/pvh-boot.h     | 13 +------------
 xen/arch/x86/include/asm/guest/xen-hcall.h    | 13 +------------
 xen/arch/x86/include/asm/guest/xen.h          | 13 +------------
 xen/arch/x86/include/asm/guest_pt.h           | 14 +-------------
 xen/arch/x86/include/asm/hap.h                | 14 +-------------
 xen/arch/x86/include/asm/hvm/asid.h           | 13 +------------
 xen/arch/x86/include/asm/hvm/domain.h         | 13 +------------
 xen/arch/x86/include/asm/hvm/grant_table.h    | 13 +------------
 xen/arch/x86/include/asm/hvm/hvm.h            | 13 +------------
 xen/arch/x86/include/asm/hvm/io.h             | 13 +------------
 xen/arch/x86/include/asm/hvm/ioreq.h          | 13 +------------
 xen/arch/x86/include/asm/hvm/irq.h            | 13 +------------
 xen/arch/x86/include/asm/hvm/monitor.h        | 13 +------------
 xen/arch/x86/include/asm/hvm/nestedhvm.h      | 13 +------------
 xen/arch/x86/include/asm/hvm/save.h           | 13 +------------
 xen/arch/x86/include/asm/hvm/support.h        | 13 +------------
 xen/arch/x86/include/asm/hvm/svm/nestedsvm.h  | 13 +------------
 xen/arch/x86/include/asm/hvm/svm/svm.h        | 13 +------------
 xen/arch/x86/include/asm/hvm/svm/svmdebug.h   | 13 +------------
 xen/arch/x86/include/asm/hvm/svm/vmcb.h       | 13 +------------
 xen/arch/x86/include/asm/hvm/vcpu.h           | 13 +------------
 xen/arch/x86/include/asm/hvm/vlapic.h         | 13 +------------
 xen/arch/x86/include/asm/hvm/vm_event.h       | 13 +------------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h       | 13 +------------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h        | 13 +------------
 xen/arch/x86/include/asm/hvm/vmx/vvmx.h       | 13 +------------
 xen/arch/x86/include/asm/hvm/vpt.h            | 13 +------------
 xen/arch/x86/include/asm/iommu.h              | 14 +-------------
 xen/arch/x86/include/asm/ioreq.h              | 13 +------------
 xen/arch/x86/include/asm/mem_access.h         | 14 +-------------
 xen/arch/x86/include/asm/mem_paging.h         | 14 +-------------
 xen/arch/x86/include/asm/mem_sharing.h        | 14 +-------------
 xen/arch/x86/include/asm/p2m.h                | 14 +-------------
 xen/arch/x86/include/asm/paging.h             | 14 +-------------
 xen/arch/x86/include/asm/pv/domain.h          | 13 +------------
 xen/arch/x86/include/asm/pv/grant_table.h     | 13 +------------
 xen/arch/x86/include/asm/pv/mm.h              | 13 +------------
 xen/arch/x86/include/asm/pv/shim.h            | 13 +------------
 xen/arch/x86/include/asm/pv/traps.h           | 13 +------------
 xen/arch/x86/include/asm/shstk.h              | 14 +-------------
 xen/arch/x86/include/asm/spec_ctrl.h          | 14 +-------------
 xen/arch/x86/include/asm/spec_ctrl_asm.h      | 14 +-------------
 xen/arch/x86/include/asm/traps.h              | 14 +-------------
 xen/arch/x86/include/asm/vm_event.h           | 13 +------------
 xen/arch/x86/include/asm/vpmu.h               | 13 +------------
 xen/arch/x86/include/asm/xenoprof.h           | 14 +-------------
 xen/arch/x86/mm.c                             | 14 +-------------
 xen/arch/x86/mm/altp2m.c                      | 13 +------------
 xen/arch/x86/mm/guest_walk.c                  | 14 +-------------
 xen/arch/x86/mm/hap/guest_walk.c              | 13 +------------
 xen/arch/x86/mm/hap/hap.c                     | 14 +-------------
 xen/arch/x86/mm/hap/nested_ept.c              | 13 +------------
 xen/arch/x86/mm/hap/nested_hap.c              | 14 +-------------
 xen/arch/x86/mm/hap/private.h                 | 13 +------------
 xen/arch/x86/mm/mem_access.c                  | 14 +-------------
 xen/arch/x86/mm/mem_paging.c                  | 14 +-------------
 xen/arch/x86/mm/mem_sharing.c                 | 14 +-------------
 xen/arch/x86/mm/mm-locks.h                    | 14 +-------------
 xen/arch/x86/mm/nested.c                      | 14 +-------------
 xen/arch/x86/mm/p2m-basic.c                   | 14 +-------------
 xen/arch/x86/mm/p2m-ept.c                     | 13 +------------
 xen/arch/x86/mm/p2m-pod.c                     | 14 +-------------
 xen/arch/x86/mm/p2m-pt.c                      | 14 +-------------
 xen/arch/x86/mm/p2m.c                         | 14 +-------------
 xen/arch/x86/mm/p2m.h                         | 14 +-------------
 xen/arch/x86/mm/paging.c                      | 14 +-------------
 xen/arch/x86/mm/physmap.c                     | 14 +-------------
 xen/arch/x86/mm/shadow/common.c               | 14 +-------------
 xen/arch/x86/mm/shadow/hvm.c                  | 14 +-------------
 xen/arch/x86/mm/shadow/multi.c                | 14 +-------------
 xen/arch/x86/mm/shadow/multi.h                | 14 +-------------
 xen/arch/x86/mm/shadow/private.h              | 14 +-------------
 xen/arch/x86/mm/shadow/pv.c                   | 14 +-------------
 xen/arch/x86/mm/shadow/set.c                  | 14 +-------------
 xen/arch/x86/mm/shadow/types.h                | 14 +-------------
 xen/arch/x86/msr.c                            | 14 +-------------
 xen/arch/x86/pv/callback.c                    | 13 +------------
 xen/arch/x86/pv/descriptor-tables.c           | 13 +------------
 xen/arch/x86/pv/emul-gate-op.c                | 14 +-------------
 xen/arch/x86/pv/emul-inv-op.c                 | 14 +-------------
 xen/arch/x86/pv/emul-priv-op.c                | 14 +-------------
 xen/arch/x86/pv/emulate.c                     | 14 +-------------
 xen/arch/x86/pv/grant_table.c                 | 13 +------------
 xen/arch/x86/pv/hypercall.c                   | 14 +-------------
 xen/arch/x86/pv/misc-hypercalls.c             | 14 +-------------
 xen/arch/x86/pv/mm.c                          | 13 +------------
 xen/arch/x86/pv/ro-page-fault.c               | 14 +-------------
 xen/arch/x86/pv/shim.c                        | 14 +-------------
 xen/arch/x86/pv/traps.c                       | 14 +-------------
 xen/arch/x86/smpboot.c                        | 14 +-------------
 xen/arch/x86/spec_ctrl.c                      | 14 +-------------
 xen/arch/x86/traps.c                          | 14 +-------------
 xen/arch/x86/x86_64/mmconfig.h                | 13 +------------
 xen/arch/x86/x86_emulate/x86_emulate.c        | 14 +-------------
 xen/arch/x86/x86_emulate/x86_emulate.h        | 14 +-------------
 150 files changed, 151 insertions(+), 1858 deletions(-)

-- 
2.39.2




 


Rackspace

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