Browse Source

scripts: board_v1_to_v2: Add License + copyright

When creating file Kconfig.<board>, get the copyright from
old Kconfig.board file and use it in the new file.
Add the License as well.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
pull/69687/head
Erwan Gouriou 1 year ago committed by Jamie McCrae
parent
commit
dc56a543f3
  1. 14
      scripts/utils/board_v1_to_v2.py

14
scripts/utils/board_v1_to_v2.py

@ -156,19 +156,27 @@ def board_v1_to_v2(board_root, board, new_board, group, vendor, soc, variants): @@ -156,19 +156,27 @@ def board_v1_to_v2(board_root, board, new_board, group, vendor, soc, variants):
board_kconfig_defconfig_file.unlink()
print(f"Creating or updating Kconfig.{new_board}...")
board_kconfig_file = new_board_path / "Kconfig.board"
with open(board_kconfig_file) as f:
for line in f.readlines():
if "Copyright" in line:
copyright = line
new_board_kconfig_file = new_board_path / f"Kconfig.{new_board}"
selects = "\n\t" + "\n\t".join(["select " + setting for setting in board_soc_settings])
header = "# SPDX-License-Identifier: Apache-2.0\n"
if copyright is not None:
header = copyright + header
selects = "\n\t" + "\n\t".join(["select " + setting for setting in board_soc_settings]) + "\n"
if not new_board_kconfig_file.exists():
with open(new_board_kconfig_file, "w") as f:
f.write(
f"config BOARD_{new_board.upper()}{selects}"
header +
f"\nconfig BOARD_{new_board.upper()}{selects}"
)
else:
with open(new_board_kconfig_file, "a") as f:
f.write(selects)
print("Removing old Kconfig.board...")
board_kconfig_file = new_board_path / "Kconfig.board"
board_kconfig_file.unlink()
print("Conversion done!")

Loading…
Cancel
Save