From 7b5643b31725435a38c255f126110ac256ca16a9 Mon Sep 17 00:00:00 2001 From: Hugo McNally Date: Sat, 8 Jun 2024 13:38:04 +0100 Subject: [PATCH 1/3] Made code base compliant with the REUSE spec --- .devcontainer/Dockerfile | 3 +++ .github/workflows/ci.yml | 3 +-- .gitignore | 7 +++++++ .gitmodules | 3 +++ .reuse/dep5 | 19 +++++++++++++++++++ LICENSES/Apache-2.0.txt | 1 + LICENSES/MIT.txt | 9 +++++++++ scripts/rp2040_uf2/make_rp2040_uf2.sh | 4 +++- scripts/rp2040_uf2/uf2conv-ext.py | 4 ++++ scripts/run_sim.sh | 2 ++ 10 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 .reuse/dep5 create mode 120000 LICENSES/Apache-2.0.txt create mode 100644 LICENSES/MIT.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ee12f2c..8211bc1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,3 +1,6 @@ +# Copyright lowRISC Contributors. +# SPDX-License-Identifier: Apache-2.0 + FROM ubuntu:22.04 ARG USERNAME=sonata # Install nix, git and cmake (required to build sonata-system software, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c978fe6..b5f7544 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,5 @@ # Copyright lowRISC contributors. -# -# SPDX-License-Identifier: MIT +# SPDX-License-Identifier: Apache-2.0 name: CI diff --git a/.gitignore b/.gitignore index 4e51338..8cb3e16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ +# Copyright lowRISC contributors. +# SPDX-License-Identifier: Apache-2.0 + +# xmake artifacts build .xmake + +# clang tooling artifacts compile_commands.json +.cache diff --git a/.gitmodules b/.gitmodules index bc2d860..b06985e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +# Copyright lowRISC Contributors. +# SPDX-License-Identifier: Apache-2.0 + [submodule "cheriot-rtos"] path = cheriot-rtos url = https://github.com/lowrisc/cheriot-rtos diff --git a/.reuse/dep5 b/.reuse/dep5 new file mode 100644 index 0000000..4f22743 --- /dev/null +++ b/.reuse/dep5 @@ -0,0 +1,19 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: *.lock + README.md + **/README.md + hackathon.md + .devcontainer/*.* + scripts/rp2040_uf2/pgrm.bin +Copyright: lowRISC contributors +License: Apache-2.0 + +Files: .clang-tidy + compile_flags.txt +Copyright: Copyright Microsoft and CHERIoT Contributors +License: MIT + +Files: scripts/rp2040_uf2/uf2families.json +Copyright: Microsoft Corporation +License: MIT diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt new file mode 120000 index 0000000..ea5b606 --- /dev/null +++ b/LICENSES/Apache-2.0.txt @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..2071b23 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/scripts/rp2040_uf2/make_rp2040_uf2.sh b/scripts/rp2040_uf2/make_rp2040_uf2.sh index a59d04d..9c2c68d 100755 --- a/scripts/rp2040_uf2/make_rp2040_uf2.sh +++ b/scripts/rp2040_uf2/make_rp2040_uf2.sh @@ -1,4 +1,6 @@ -#!/bin/sh +#!/usr/bin/env sh +# Copyright lowRISC Contributors. +# SPDX-License-Identifier: Apache-2.0 program_filename=${1%.*} diff --git a/scripts/rp2040_uf2/uf2conv-ext.py b/scripts/rp2040_uf2/uf2conv-ext.py index 23e2e72..dd5845f 100755 --- a/scripts/rp2040_uf2/uf2conv-ext.py +++ b/scripts/rp2040_uf2/uf2conv-ext.py @@ -1,4 +1,8 @@ #!/usr/bin/env python3 +# Copyright Microsoft Corporation +# Copyright lowRISC Contributors. +# SPDX-License-Identifier: Apache-2.0 + import sys import struct import subprocess diff --git a/scripts/run_sim.sh b/scripts/run_sim.sh index 980bad8..feba88e 100755 --- a/scripts/run_sim.sh +++ b/scripts/run_sim.sh @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright lowRISC Contributors. +# SPDX-License-Identifier: Apache-2.0 sonata_simulator -E $SONATA_SIM_BOOT_STUB -E $1 From ede260e53ce6e5c9d5422b167e8b1bee8dbbf9f5 Mon Sep 17 00:00:00 2001 From: Hugo McNally Date: Sat, 8 Jun 2024 13:39:59 +0100 Subject: [PATCH 2/3] Created nix app (run-lints) that runs all lints. --- flake.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index b08d61b..01ddf62 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,13 @@ esac ''; }; + run-lints = pkgs.writeShellApplication { + name = "run-lints"; + text = '' + ${getExe pkgs.reuse} lint + ${getExe clang-lint} check + ''; + }; in { formatter = pkgs.alejandra; devShells = rec { @@ -69,9 +76,15 @@ ''; }; }; - apps.clang-lint = { - type = "app"; - program = getExe clang-lint; + apps = { + run-lints = { + type = "app"; + program = getExe run-lints; + }; + clang-lint = { + type = "app"; + program = getExe clang-lint; + }; }; checks = { clang-checks = pkgs.stdenvNoCC.mkDerivation { From 6fb9fc987edd6c62f72b6e683bd183189f757a48 Mon Sep 17 00:00:00 2001 From: Hugo McNally Date: Sat, 8 Jun 2024 13:42:56 +0100 Subject: [PATCH 3/3] Added licence check to CI --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5f7544..d42b8f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,5 +30,11 @@ jobs: - name: Nix Format Check run: nix fmt -- . --check + # This isn't part of the the nix flake checks + # because it can't ignore submodules + # when they are vendored in by Nix. + - name: Licence Check + run: nix run nixpkgs#reuse lint + - name: Run Nix Checks run: nix flake check -L .?submodules=1