diff --git a/.github/actions/verify-headers/action.yml b/.github/actions/verify-headers/action.yml new file mode 100644 index 00000000..477ffeed --- /dev/null +++ b/.github/actions/verify-headers/action.yml @@ -0,0 +1,17 @@ +name: verify-headers +description: Verify that files affected by a PR include expected header + +branding: + icon: zap + color: gray-dark + +inputs: + files: + description: > + A comma-separated list of all files to check. + default: '' +runs: + using: "composite" + steps: + - run: $GITHUB_ACTION_PATH/verify-headers.py + shell: bash diff --git a/.github/actions/verify-headers/verify-headers.py b/.github/actions/verify-headers/verify-headers.py new file mode 100755 index 00000000..9c7b7de4 --- /dev/null +++ b/.github/actions/verify-headers/verify-headers.py @@ -0,0 +1,38 @@ +#!/usr/bin/python3 +# Copyright (c) 2023 Contributors to COVESA +# +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +# SPDX-License-Identifier: MPL-2.0 + +import os + + +def string_exists(file_path, search_string) -> bool: + with open(file_path, 'r') as file: + content = file.read() + if search_string in content: + return True + return False + + +if __name__ == '__main__': + + files = os.getenv('files') + files = files.split(',') + for file in files: + file = os.path.abspath(file) + if os.path.isfile(file): + ext = os.path.splitext(file)[1] + if ext in [".vspec", ".py"]: + if not string_exists(file, "Contributors to COVESA"): + print(f"No contribution statement found in {file}") + raise Exception("Check the output, some files have not the right contribution statement!") + if not string_exists(file, "SPDX-License-Identifier: MPL-2.0"): + print(f"Incorrect license statement found in {file}") + raise Exception("Check the output, some files have not the right SPDX statement!") + + print(f"Check succeeded for {file}") + raise SystemExit(0) diff --git a/.github/workflows/check-header.yml b/.github/workflows/check-header.yml new file mode 100755 index 00000000..c20d7194 --- /dev/null +++ b/.github/workflows/check-header.yml @@ -0,0 +1,28 @@ +name: check-header + +on: + pull_request + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + check-headers: + runs-on: ubuntu-latest + + steps: + + - name: Checkout code + uses: actions/checkout@v3 + with: + # required to grab the history of the PR + fetch-depth: 0 + + - name: Get changed files + run: | + echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | tr '\n' ',')" >> $GITHUB_ENV + + - uses: ./.github/actions/verify-headers + with: + files: "${{ env.files }}" diff --git a/contrib/vspec2ttl/vspec2ttl.py b/contrib/vspec2ttl/vspec2ttl.py index 0e313842..9323e3f3 100755 --- a/contrib/vspec2ttl/vspec2ttl.py +++ b/contrib/vspec2ttl/vspec2ttl.py @@ -1,14 +1,12 @@ #!/usr/bin/env python3 -# (C) 2021 BMW Group - All rights reserved. -# AUTHOR: Daniel Wilms BMW Group; - -# -# +# Copyright (c) 2021 Contributors to COVESA # -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 # # Convert vspec file to TTL diff --git a/setup.py b/setup.py index cd012c56..7b7313a3 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,13 @@ #!/usr/bin/env python3 + +# Copyright (c) 2019 Contributors to COVESA +# +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +# SPDX-License-Identifier: MPL-2.0 + from setuptools import setup, find_packages from pathlib import Path diff --git a/vspec/__init__.py b/vspec/__init__.py index 86ace092..57a02399 100755 --- a/vspec/__init__.py +++ b/vspec/__init__.py @@ -1,11 +1,11 @@ +# Copyright (c) 2016 Contributors to COVESA # -# (C) 2021 Robert Bosch GmbH -# (C) 2018 Volvo Cars -# (C) 2016 Jaguar Land Rover -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # VSpec file parser. # diff --git a/vspec/loggingconfig.py b/vspec/loggingconfig.py index 252f26e9..cc021065 100644 --- a/vspec/loggingconfig.py +++ b/vspec/loggingconfig.py @@ -1,8 +1,13 @@ #!/usr/bin/env python3 -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# Copyright (c) 2023 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec files to various other formats # diff --git a/vspec/model/__init__.py b/vspec/model/__init__.py index e69de29b..31f95c9f 100644 --- a/vspec/model/__init__.py +++ b/vspec/model/__init__.py @@ -0,0 +1,7 @@ +# Copyright (c) 2021 Contributors to COVESA +# +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +# SPDX-License-Identifier: MPL-2.0 diff --git a/vspec/model/constants.py b/vspec/model/constants.py index 48915886..4f143f88 100644 --- a/vspec/model/constants.py +++ b/vspec/model/constants.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 +# Copyright (c) 2021 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. -# +# SPDX-License-Identifier: MPL-2.0 # # Constant Types and Mappings diff --git a/vspec/model/exceptions.py b/vspec/model/exceptions.py index 4dbcea1b..7d240859 100644 --- a/vspec/model/exceptions.py +++ b/vspec/model/exceptions.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 +# Copyright (c) 2023 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. -# +# SPDX-License-Identifier: MPL-2.0 class NameStyleValidationException(Exception): def __init__(self, message): diff --git a/vspec/model/vsstree.py b/vspec/model/vsstree.py index 4eec05ed..dba3c031 100644 --- a/vspec/model/vsstree.py +++ b/vspec/model/vsstree.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 +# Copyright (c) 2021 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. -# +# SPDX-License-Identifier: MPL-2.0 from anytree import Node, Resolver, ChildResolverError, RenderTree # type: ignore[import] from .constants import VSSType, VSSDataType, Unit, VSSConstant diff --git a/vspec/utils/__init__.py b/vspec/utils/__init__.py index e69de29b..5d20e1e5 100644 --- a/vspec/utils/__init__.py +++ b/vspec/utils/__init__.py @@ -0,0 +1,7 @@ +# Copyright (c) 2023 Contributors to COVESA +# +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +# SPDX-License-Identifier: MPL-2.0 diff --git a/vspec/utils/stringstyle.py b/vspec/utils/stringstyle.py index 01a9de2f..d66f3af3 100644 --- a/vspec/utils/stringstyle.py +++ b/vspec/utils/stringstyle.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 +# Copyright (c) 2023 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. -# +# SPDX-License-Identifier: MPL-2.0 import re diff --git a/vspec/vssexporters/__init__.py b/vspec/vssexporters/__init__.py index e69de29b..65786e26 100644 --- a/vspec/vssexporters/__init__.py +++ b/vspec/vssexporters/__init__.py @@ -0,0 +1,7 @@ +# Copyright (c) 2022 Contributors to COVESA +# +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +# SPDX-License-Identifier: MPL-2.0 diff --git a/vspec/vssexporters/vss2binary.py b/vspec/vssexporters/vss2binary.py index 059c52c6..f34cab7b 100644 --- a/vspec/vssexporters/vss2binary.py +++ b/vspec/vssexporters/vss2binary.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 -# (c) 2022 Geotab Inc -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# Copyright (c) 2022 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # Convert vspec tree to binary format import argparse diff --git a/vspec/vssexporters/vss2csv.py b/vspec/vssexporters/vss2csv.py index 9847e035..d554c1bc 100644 --- a/vspec/vssexporters/vss2csv.py +++ b/vspec/vssexporters/vss2csv.py @@ -1,12 +1,13 @@ #!/usr/bin/env python3 -# (c) 2022 Robert Bosch GmbH -# (c) 2021 BMW Group -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# Copyright (c) 2021 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # Convert vspec tree to CSV diff --git a/vspec/vssexporters/vss2ddsidl.py b/vspec/vssexporters/vss2ddsidl.py index 46cf4fa2..7a85bb2e 100644 --- a/vspec/vssexporters/vss2ddsidl.py +++ b/vspec/vssexporters/vss2ddsidl.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 +# Copyright (c) 2022 Contributors to COVESA # -# (c) 2022 Robert Bosch GmbH -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec files to DDS-IDL # diff --git a/vspec/vssexporters/vss2franca.py b/vspec/vssexporters/vss2franca.py index 1a59e402..9773b7ce 100644 --- a/vspec/vssexporters/vss2franca.py +++ b/vspec/vssexporters/vss2franca.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 -# (c) 2021 BMW Group -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# Copyright (c) 2021 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # Convert vspec tree to franca diff --git a/vspec/vssexporters/vss2graphql.py b/vspec/vssexporters/vss2graphql.py index fe829dc8..a0b86825 100644 --- a/vspec/vssexporters/vss2graphql.py +++ b/vspec/vssexporters/vss2graphql.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 +# Copyright (c) 2022 Contributors to COVESA # -# Copyright (C) 2022, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 import argparse from vspec.model.vsstree import VSSNode diff --git a/vspec/vssexporters/vss2json.py b/vspec/vssexporters/vss2json.py index b32691dc..1766a90e 100644 --- a/vspec/vssexporters/vss2json.py +++ b/vspec/vssexporters/vss2json.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 -# (c) 2022 Robert Bosch GmbH -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# Copyright (c) 2022 Contributors to COVESA # +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # Convert vspec tree to JSON from vspec.model.vsstree import VSSNode diff --git a/vspec/vssexporters/vss2protobuf.py b/vspec/vssexporters/vss2protobuf.py index 99d21d07..b9bc2049 100755 --- a/vspec/vssexporters/vss2protobuf.py +++ b/vspec/vssexporters/vss2protobuf.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 -# Copyright (c) 2021 Motius GmbH +# Copyright (c) 2021 Contributors to COVESA # -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # Convert vspec file to proto # diff --git a/vspec/vssexporters/vss2yaml.py b/vspec/vssexporters/vss2yaml.py index ed37cf21..d3663cf9 100644 --- a/vspec/vssexporters/vss2yaml.py +++ b/vspec/vssexporters/vss2yaml.py @@ -1,14 +1,13 @@ #!/usr/bin/env python3 +# Copyright (c) 2016 Contributors to COVESA # -# (c) 2021 Robert Bosch GmbH -# (c) 2021 Pavel Sokolov (pavel.sokolov@gmail.com) -# (c) 2016 Jaguar Land Rover -# -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert all vspec input files to a single flat YAML file. # diff --git a/vspec2binary.py b/vspec2binary.py index 2c630530..fb8f5ec4 100755 --- a/vspec2binary.py +++ b/vspec2binary.py @@ -1,12 +1,13 @@ #!/usr/bin/env python3 +# Copyright (c) 2018 Contributors to COVESA # -# (C) 2022 Geotab Inc -# (C) 2018 Volvo Cars -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec file to a platform binary format. # diff --git a/vspec2csv.py b/vspec2csv.py index 8d989938..73b26f49 100755 --- a/vspec2csv.py +++ b/vspec2csv.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 # +# Copyright (c) 2016 Contributors to COVESA # -# (c) 2022 Robert Bosch GmbH -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec2csv wrapper for vspec2x # diff --git a/vspec2ddsidl.py b/vspec2ddsidl.py index 892c7ecb..d6c84a7f 100755 --- a/vspec2ddsidl.py +++ b/vspec2ddsidl.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 # +# Copyright (c) 2022 Contributors to COVESA # -# (c) 2022 Robert Bosch GmbH -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec2idl wrapper for vspec2x # diff --git a/vspec2franca.py b/vspec2franca.py index bf30ce4d..b1206f93 100755 --- a/vspec2franca.py +++ b/vspec2franca.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 -# (c) 2022 BMW Group -# (C) 2016 Jaguar Land Rover +# Copyright (c) 2016 Contributors to COVESA # -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec file to FrancaIDL spec. # diff --git a/vspec2graphql.py b/vspec2graphql.py index 942ac234..4ae02565 100755 --- a/vspec2graphql.py +++ b/vspec2graphql.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 # +# Copyright (c) 2022 Contributors to COVESA # -# (c) 2022 BMW Group -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec2grahql wrapper for vspec2x # diff --git a/vspec2json.py b/vspec2json.py index 987860dd..f6eca381 100755 --- a/vspec2json.py +++ b/vspec2json.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 # +# Copyright (c) 2016 Contributors to COVESA # -# (c) 2022 Robert Bosch GmbH -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec2json wrapper for vspec2x # diff --git a/vspec2jsonschema.py b/vspec2jsonschema.py index 864161e2..5ac3d6e6 100755 --- a/vspec2jsonschema.py +++ b/vspec2jsonschema.py @@ -1,5 +1,13 @@ #!/usr/bin/env python3 # +# Copyright (c) 2023 Contributors to COVESA +# +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec2jsonschema wrapper for vspec2x # diff --git a/vspec2protobuf.py b/vspec2protobuf.py index a0cb6ca6..a8bee678 100755 --- a/vspec2protobuf.py +++ b/vspec2protobuf.py @@ -1,5 +1,13 @@ #!/usr/bin/env python3 # +# Copyright (c) 2021 Contributors to COVESA +# +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec2protobuf wrapper for vspec2x # diff --git a/vspec2x.py b/vspec2x.py index 4f10d1af..07e19a85 100755 --- a/vspec2x.py +++ b/vspec2x.py @@ -1,12 +1,13 @@ #!/usr/bin/env python3 -# (c) 2022 BMW Group -# (c) 2022 Robert Bosch GmbH -# (c) 2016 Jaguar Land Rover +# Copyright (c) 2016 Contributors to COVESA # -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec files to various other formats # diff --git a/vspec2yaml.py b/vspec2yaml.py index be1817ef..4fcf7de7 100755 --- a/vspec2yaml.py +++ b/vspec2yaml.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 # +# Copyright (c) 2021 Contributors to COVESA # -# (c) 2022 Robert Bosch GmbH -# -# All files and artifacts in this repository are licensed under the -# provisions of the license provided by the LICENSE file in this repository. +# This program and the accompanying materials are made available under the +# terms of the Mozilla Public License 2.0 which is available at +# https://www.mozilla.org/en-US/MPL/2.0/ # +# SPDX-License-Identifier: MPL-2.0 + # # Convert vspec2yaml wrapper for vspec2x #