mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-12-10 14:25:33 -05:00
fw: Import tkey-libs fw-2
This is an import of the fw-2 tag of tkey-libs. We import the entire tkey-libs repo minus dot files into the tillitis-key1 repo to make it very simple not to make mistakes regarding which firmware tag depends on which tkey-libs tag, especially considering locking down with NVCM. Please see README for information about developing with another tkey-libs or how to import future tkey-libs. Since tkey-libs is now a part of the repo we also add tkey-libs to the clean_fw target.
This commit is contained in:
parent
3dbc31f54c
commit
16a9e8c367
38 changed files with 5973 additions and 0 deletions
92
hw/application_fpga/tkey-libs/tools/spdx-ensure
Executable file
92
hw/application_fpga/tkey-libs/tools/spdx-ensure
Executable file
|
|
@ -0,0 +1,92 @@
|
|||
#!/bin/bash
|
||||
# SPDX-FileCopyrightText: 2022 Tillitis AB <tillitis.se>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
set -eu
|
||||
|
||||
# Check for the SPDX tag in all files in the repo. Exit with a non-zero code if
|
||||
# some is missing. The missingok arrays below contain files and directories
|
||||
# with files where the the tag is not required.
|
||||
|
||||
cd "${0%/*}"
|
||||
cd ..
|
||||
|
||||
tag="SPDX-License-Identifier:"
|
||||
|
||||
missingok_dirs=(
|
||||
.github/workflows/
|
||||
LICENSES/
|
||||
)
|
||||
|
||||
missingok_files=(
|
||||
.clang-format
|
||||
.editorconfig
|
||||
.gitignore
|
||||
LICENSE
|
||||
Makefile
|
||||
README.md
|
||||
README-DIST.txt
|
||||
RELEASE.md
|
||||
example-app/Makefile
|
||||
monocypher/LICENSE
|
||||
monocypher/README.md
|
||||
)
|
||||
|
||||
is_missingok() {
|
||||
item="$1"
|
||||
# ok for empty files
|
||||
[[ -f "$item" ]] && [[ ! -s "$item" ]] && return 0
|
||||
for fileok in "${missingok_files[@]}"; do
|
||||
[[ "$item" = "$fileok" ]] && return 0
|
||||
done
|
||||
for dirok in "${missingok_dirs[@]}"; do
|
||||
[[ "$item" =~ ^$dirok ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
printf "* Checking for SPDX tags in %s\n" "$PWD"
|
||||
|
||||
mapfile -t repofiles < <(git ls-files || true)
|
||||
if [[ -z "${repofiles[*]}" ]]; then
|
||||
printf "* No files in the repo?!\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
failed=0
|
||||
|
||||
printed=0
|
||||
for fileok in "${missingok_files[@]}"; do
|
||||
[[ -f "$fileok" ]] && continue
|
||||
if (( !printed )); then
|
||||
printf "* Some files in missingok_files are themselves missing:\n"
|
||||
printed=1
|
||||
failed=1
|
||||
fi
|
||||
printf "%s\n" "$fileok"
|
||||
done
|
||||
|
||||
printed=0
|
||||
for dirok in "${missingok_dirs[@]}"; do
|
||||
[[ -d "$dirok" ]] && continue
|
||||
if (( !printed )); then
|
||||
printf "* Some dirs in missingok_dirs are themselves missing:\n"
|
||||
printed=1
|
||||
failed=1
|
||||
fi
|
||||
printf "%s\n" "$dirok"
|
||||
done
|
||||
|
||||
printed=0
|
||||
for file in "${repofiles[@]}"; do
|
||||
is_missingok "$file" && continue
|
||||
if ! grep -q "$tag" "$file"; then
|
||||
if (( !printed )); then
|
||||
printf "* Files missing the SPDX tag:\n"
|
||||
printed=1
|
||||
failed=1
|
||||
fi
|
||||
printf "%s\n" "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
exit "$failed"
|
||||
Loading…
Add table
Add a link
Reference in a new issue