From 36ac6226ff8855b68741c78fd01f6c066d5f1ef8 Mon Sep 17 00:00:00 2001 From: Nicholas Chin Date: Sun, 23 Jun 2024 10:39:23 -0600 Subject: [PATCH] util/autoport: Add function to create empty files As per commit cf4722d317ea ("src/mb: Update unlicensable files with the CC-PDDC SPDX ID") effectively empty files should use the Creative Commons Public Domain Dedication and Certification (CC-PDDC) license header. Add a function to create an empty file and add the CC-PDDC SPDX header and a comment to change the license if content is added. The only empty files that autoport currently generates are ec.asl and superio.asl on non-laptop systems, where NoEC() is used. Change-Id: I409a6d90d671258e318c26e34a35c238d6fd28c1 Signed-off-by: Nicholas Chin Reviewed-on: https://review.coreboot.org/c/coreboot/+/84329 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- util/autoport/ec_none.go | 7 ++----- util/autoport/main.go | 12 ++++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/util/autoport/ec_none.go b/util/autoport/ec_none.go index a1a0df94f0..ceb84a0528 100644 --- a/util/autoport/ec_none.go +++ b/util/autoport/ec_none.go @@ -16,9 +16,6 @@ Method(_PTS, 1) } `) - si := Create(ctx, "acpi/superio.asl") - defer si.Close() - - ec := Create(ctx, "acpi/ec.asl") - defer ec.Close() + Create_Empty(ctx, "acpi/superio.asl", ASL) + Create_Empty(ctx, "acpi/ec.asl", ASL) } diff --git a/util/autoport/main.go b/util/autoport/main.go index c4f884a985..1246e3277c 100644 --- a/util/autoport/main.go +++ b/util/autoport/main.go @@ -120,8 +120,9 @@ var CommentFormatStrings map[Filetype]string = map[Filetype]string { type License string const ( - GPL2_only License = "GPL-2.0-only" - GPL2_or_later = "GPL-2.0-or-later" + CC_PDDC License = "CC-PDDC" + GPL2_only = "GPL-2.0-only" + GPL2_or_later = "GPL-2.0-or-later" ) var KconfigBool map[string]bool = map[string]bool{} @@ -233,6 +234,13 @@ func Create(ctx Context, name string) *os.File { } return mf } +func Create_Empty(ctx Context, name string, filetype Filetype) { + f := Create(ctx, name) + defer f.Close() + Add_SPDX(f, filetype, CC_PDDC) + Add_Comment(f, filetype, + "Please update the license if adding licensable material.") +} func Add_SPDX(f *os.File, filetype Filetype, license License) { Add_Comment(f, filetype, "SPDX-License-Identifier: " + string(license))