Skip to content

Commit

Permalink
Changing to SPDX style and add checker
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Jaegervall <[email protected]>
  • Loading branch information
erikbosch committed Oct 25, 2023
1 parent b34282b commit 3cd340e
Show file tree
Hide file tree
Showing 44 changed files with 334 additions and 127 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max_line_length = 120
17 changes: 17 additions & 0 deletions .github/actions/verify-headers/action.yml
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions .github/actions/verify-headers/verify-headers.py
Original file line number Diff line number Diff line change
@@ -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)
28 changes: 28 additions & 0 deletions .github/workflows/check-header.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
20 changes: 15 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,25 @@ By supplying this sign-off line, you indicate your acceptance of the COVESA Cert

If using git command line you can add a sign-off by using the `-s` argument when creating a commit.

Each file shall have copyright statement of this form, inspired by the [Eclipse generic copyright header](https://www.eclipse.org/projects/handbook/#ip-copyright-headers)
For certain files it is requested that a copyright and license statement is added as file header.
This currently applies to the following file types:

* VSS source files (`*.vspec`)
* Python files (vss-tools, `*.py`)

Those files shall have copyright statement of this form, inspired by the [Eclipse generic copyright header](https://www.eclipse.org/projects/handbook/#ip-copyright-headers).
Copyright/License-statement may also be added to other files if considered relevant.

```
# Copyright (c) XXXX Contributors to COVESA
# Copyright (c) {year} 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
```
Where XXXX is the year the file was originally created, no need to update or append new years or a range of years later.

### VSS Signals shall be generic
Expand Down
9 changes: 6 additions & 3 deletions overlays/extensions/dual_wiper_systems.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2022 Contributors to COVESA
# Copyright (c) 2022 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

# Overlay to extend wiper system to support multiple instances
# Dependencies to other overlays: None
Expand Down
9 changes: 6 additions & 3 deletions overlays/profiles/motorbike.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2022 Contributors to COVESA
# Copyright (c) 2022 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

# This file contains adoptions to the main spec concering motorbikes.
# It mainly addresses istantiation issues (e.g. wheels) and
Expand Down
9 changes: 6 additions & 3 deletions spec/ADAS/ADAS.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# All Advanced Driver Assist System signals
Expand Down
9 changes: 6 additions & 3 deletions spec/Body/Body.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# All body signals and attributes.
Expand Down
9 changes: 6 additions & 3 deletions spec/Body/BrakeLights.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2022 Contributors to COVESA
# Copyright (c) 2022 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

IsActive:
datatype: string
Expand Down
9 changes: 6 additions & 3 deletions spec/Body/ExteriorMirrors.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# All exterior mirrors
Expand Down
9 changes: 6 additions & 3 deletions spec/Body/SignalingLights.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2022 Contributors to COVESA
# Copyright (c) 2022 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

IsSignaling:
datatype: boolean
Expand Down
9 changes: 6 additions & 3 deletions spec/Body/StaticLights.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2022 Contributors to COVESA
# Copyright (c) 2022 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

IsOn:
datatype: boolean
Expand Down
9 changes: 6 additions & 3 deletions spec/Body/WiperSystem.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2022 Contributors to COVESA
# Copyright (c) 2022 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

# This file describes signals for a wiper system interface, allowing movement for one or more wipers
# to be controlled in great detail.
Expand Down
9 changes: 6 additions & 3 deletions spec/Cabin/Cabin.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# All in-cabin originated signals and attributes
Expand Down
9 changes: 6 additions & 3 deletions spec/Cabin/HVAC.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# All HVAC-originated signals
Expand Down
9 changes: 6 additions & 3 deletions spec/Cabin/Infotainment.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# In-Vehicle Infotainment Signals
Expand Down
9 changes: 6 additions & 3 deletions spec/Cabin/InteriorLights.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# All interior lights and sensors
Expand Down
10 changes: 7 additions & 3 deletions spec/Cabin/Occupant.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## Copyright (c) 2020 Contributors to COVESA
# Copyright (c) 2020 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

#
# Occupant data
#
Expand Down
10 changes: 7 additions & 3 deletions spec/Cabin/SingleConfigurableLight.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## Copyright (c) 2023 Contributors to COVESA
# Copyright (c) 2023 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


#
# Generic specification for a light whose color and brightness can be configured.
Expand Down
10 changes: 7 additions & 3 deletions spec/Cabin/SingleDoor.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## Copyright (c) 2016 Contributors to COVESA
# Copyright (c) 2023 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


#
# Definition of a single door. Start position for Door is Closed.
Expand Down
9 changes: 6 additions & 3 deletions spec/Cabin/SingleHVACStation.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# A single HVAC station in the vehicle.
Expand Down
9 changes: 6 additions & 3 deletions spec/Cabin/SingleSeat.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# Seat signals
Expand Down
9 changes: 6 additions & 3 deletions spec/Chassis/Chassis.vspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Copyright (c) 2016 Contributors to COVESA
# 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

#
# Chassis signals and attributes
Expand Down
Loading

0 comments on commit 3cd340e

Please sign in to comment.