From b8fdff200854e5bbc6327918a2b482bd521c6122 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Fri, 27 Jan 2023 08:24:27 +0100 Subject: [PATCH 1/2] examples/zigbee: use LicenseRef-Included as SPDX-License-Identifier Examples for zigbee are using custom license, which is not present on the SPDX license list. This was discussed on !16205 and a decision was made that the examples will be put on check-copyright's ignore list. SPDX has LicenseRef-[idstring] identifier for such cases, so let's try to use it. In this particular case the LicenseRef-Included is used to express that the full license text is included in the source file. Note that the LicenseRef-Included is not part of SPDX. It's just something I used. No change is needed on the check-copyright side. Signed-off-by: Frantisek Hrbata --- .../zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.c | 4 ++-- .../zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.h | 4 ++-- examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.c | 4 ++-- examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.h | 4 ++-- .../light_sample/HA_on_off_light/main/esp_zb_light.c | 4 ++-- .../light_sample/HA_on_off_light/main/esp_zb_light.h | 4 ++-- .../light_sample/HA_on_off_light/main/light_driver.c | 4 ++-- .../light_sample/HA_on_off_light/main/light_driver.h | 4 ++-- .../light_sample/HA_on_off_switch/main/esp_zb_switch.c | 4 ++-- .../light_sample/HA_on_off_switch/main/esp_zb_switch.h | 4 ++-- .../light_sample/HA_on_off_switch/main/switch_driver.c | 4 ++-- .../light_sample/HA_on_off_switch/main/switch_driver.h | 4 ++-- tools/ci/check_copyright_config.yaml | 8 +++++++- 13 files changed, 31 insertions(+), 25 deletions(-) diff --git a/examples/zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.c b/examples/zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.c index b1c7d4a318df..a1b8bbe0774a 100644 --- a/examples/zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.c +++ b/examples/zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.h b/examples/zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.h index 06268f762031..4c22871a385a 100644 --- a/examples/zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.h +++ b/examples/zigbee/esp_zigbee_gateway/main/esp_zigbee_gateway.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.c b/examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.c index fe96d9cee4b7..966baf32df11 100644 --- a/examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.c +++ b/examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.h b/examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.h index c59bd98d81f0..50f708a5412c 100644 --- a/examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.h +++ b/examples/zigbee/esp_zigbee_rcp/main/esp_zigbee_rcp.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/light_sample/HA_on_off_light/main/esp_zb_light.c b/examples/zigbee/light_sample/HA_on_off_light/main/esp_zb_light.c index d4e2a2501e6d..0c38d7d8707b 100644 --- a/examples/zigbee/light_sample/HA_on_off_light/main/esp_zb_light.c +++ b/examples/zigbee/light_sample/HA_on_off_light/main/esp_zb_light.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/light_sample/HA_on_off_light/main/esp_zb_light.h b/examples/zigbee/light_sample/HA_on_off_light/main/esp_zb_light.h index 82c3b2bc7701..e555e2ed1118 100644 --- a/examples/zigbee/light_sample/HA_on_off_light/main/esp_zb_light.h +++ b/examples/zigbee/light_sample/HA_on_off_light/main/esp_zb_light.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/light_sample/HA_on_off_light/main/light_driver.c b/examples/zigbee/light_sample/HA_on_off_light/main/light_driver.c index 2febb110930b..72ff6b9e3726 100644 --- a/examples/zigbee/light_sample/HA_on_off_light/main/light_driver.c +++ b/examples/zigbee/light_sample/HA_on_off_light/main/light_driver.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/light_sample/HA_on_off_light/main/light_driver.h b/examples/zigbee/light_sample/HA_on_off_light/main/light_driver.h index 8fb07dd0d02e..b9f734fdde8d 100644 --- a/examples/zigbee/light_sample/HA_on_off_light/main/light_driver.h +++ b/examples/zigbee/light_sample/HA_on_off_light/main/light_driver.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/light_sample/HA_on_off_switch/main/esp_zb_switch.c b/examples/zigbee/light_sample/HA_on_off_switch/main/esp_zb_switch.c index 7ec811bfd4a6..119b7f05feb7 100644 --- a/examples/zigbee/light_sample/HA_on_off_switch/main/esp_zb_switch.c +++ b/examples/zigbee/light_sample/HA_on_off_switch/main/esp_zb_switch.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/light_sample/HA_on_off_switch/main/esp_zb_switch.h b/examples/zigbee/light_sample/HA_on_off_switch/main/esp_zb_switch.h index 98f86bf7404d..eeca2125b71a 100644 --- a/examples/zigbee/light_sample/HA_on_off_switch/main/esp_zb_switch.h +++ b/examples/zigbee/light_sample/HA_on_off_switch/main/esp_zb_switch.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.c b/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.c index 7b2435b0054e..2acf388944e0 100644 --- a/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.c +++ b/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.h b/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.h index 67d431a9bc1d..10d332cd6e13 100644 --- a/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.h +++ b/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD - * All rights reserved. + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * + * SPDX-License-Identifier: LicenseRef-Included * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: diff --git a/tools/ci/check_copyright_config.yaml b/tools/ci/check_copyright_config.yaml index 1a3957c825ee..6c51f273c3c9 100644 --- a/tools/ci/check_copyright_config.yaml +++ b/tools/ci/check_copyright_config.yaml @@ -166,6 +166,13 @@ protocol_examples_common_component: - CC0-1.0 license_for_new_files: Unlicense OR CC0-1.0 +zigbee: + include: + - 'examples/zigbee/' + allowed_licenses: + - Apache-2.0 + - LicenseRef-Included + # files matching this section do not perform the check # file patterns starting with ! are negated, meaning files matching them won't match the section. ignore: @@ -181,7 +188,6 @@ ignore: - components/bt/host/bluedroid/ - '!components/bt/host/bluedroid/api/' - '!components/bt/host/bluedroid/btc/' - - examples/zigbee/ - components/esp_local_ctrl/proto-c/ - components/esp_local_ctrl/python/ - components/protocomm/proto-c/ From 8e893db5f3f99f221178315b5eec829931fa1955 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Wed, 25 Jan 2023 16:20:50 +0100 Subject: [PATCH 2/2] docs: allow to use SPDX LicenseRef-[idstring] indentifier In a very rare cases there is a need to use custom license, which is not present on the SPDX list. Now, files under such license are added to the check_copyright ignore list. For example zigbee examples introduced by !16205. SPDX has a LicenseRef-[idstring] identifier[1] for such cases, so let's try to use it in license representation[2]. The idea is that licenses not on the SPDX list can be added into the LICENSES[3] directory and used as SPDX-License-Identifier: LicenseRef-Special-License Or if the custom license is present directly in a source file we can use a special LicenseRef-Included identifier to state that the license is included. SPDX-License-Identifier: LicenseRef-Included Please note that LicenseRef-Included is just a made up identifier to state the fact that the license is included directly in the source file. There is nothing in the SPDX spec about this usage. This relatively small adjustment allows to refer to custom licenses without a need to skip check_copyright for them. [1] https://spdx.github.io/spdx-spec/v2.3/other-licensing-information-detected/#101-license-identifier-field [2] https://spdx.github.io/spdx-spec/v2.3/using-SPDX-short-identifiers-in-source-files/#e4-representing-multiple-licenses [3] https://reuse.software/spec/ Signed-off-by: Frantisek Hrbata --- docs/en/contribute/copyright-guide.rst | 31 ++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/en/contribute/copyright-guide.rst b/docs/en/contribute/copyright-guide.rst index 3f84b4e54b8b..37387176326b 100644 --- a/docs/en/contribute/copyright-guide.rst +++ b/docs/en/contribute/copyright-guide.rst @@ -1,6 +1,8 @@ Copyright Header Guide ====================== +.. highlight:: c + ESP-IDF is released under :project_file:`the Apache License 2.0 ` with some additional third-party copyrighted code released under various licenses. For further information please refer to :doc:`the list of copyrights and licenses <../../../COPYRIGHT>`. This page explains how the source code should be properly marked with a copyright header. ESP-IDF uses `The Software Package Data Exchange (SPDX) `_ format which is short and can be easily read by humans or processed by automated tools for copyright checks. @@ -23,7 +25,7 @@ Common Examples of Copyright Headers The simplest case is when the code is not based on any licensed previous work, e.g. it was written completely from scratch. Such code can be decorated with the following copyright header and put under the license of ESP-IDF:: /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -34,7 +36,7 @@ Less restrictive parts of ESP-IDF Some parts of ESP-IDF are deliberately under less restrictive licenses in order to ease their re-use in commercial closed source projects. This is the case for :project:`ESP-IDF examples ` which are in Public domain or under the Creative Commons Zero Universal (CC0) license. The following header can be used in such source files:: /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -53,12 +55,33 @@ The following example is a suitable header for a code licensed under the "GNU Ge * * SPDX-License-Identifier: GPL-2.0-or-later * - * SPDX-FileContributor: 2019-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2019-2023 Espressif Systems (Shanghai) CO LTD + */ + +The licenses can be identified and the short SPDX identifiers can be found in the official `SPDX license list`_. Other very common licenses are the GPL-2.0-only, the BSD-3-Clause, and the BSD-2-Clause. + +In exceptional case, when a license is not present on the `SPDX license list`_, it can be expressed by using the `LicenseRef-[idString]`_ custom license identifier, for example ``LicenseRef-Special-License``. The full license text must be added into the ``LICENSES`` directory under ``Special-License`` filename. :: + + /* + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: LicenseRef-Special-License */ -The licenses can be identified and the short SPDX identifiers can be found in the official `SPDX license list `_. Other very common licenses are the GPL-2.0-only, the BSD-3-Clause, and the BSD-2-Clause. +Dedicated ``LicenseRef-Included`` custom license identifier can be used to express a situation when the custom license is included directly in the source file. :: + + /* + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: LicenseRef-Included + * + * + */ The configuration stored in ``tools/ci/check_copyright_config.yaml`` offers features useful for third party licenses: * A different license can be defined for the files part of a third party library. * The check for a selected set of files can be permanently disabled. Please use this option with care and only in cases when none of the other options are suitable. + +.. _SPDX license list: https://spdx.org/licenses +.. _LicenseRef-[idString]: https://spdx.github.io/spdx-spec/v2.3/other-licensing-information-detected/#101-license-identifier-field