mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-01-01 10:56:27 -05:00
Let script check all files in repo no matter where it is run from
Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
parent
9a6a790715
commit
31fa0b476c
@ -1,9 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
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:"
|
tag="SPDX-License-Identifier:"
|
||||||
|
|
||||||
dirsok=(
|
missingok_dirs=(
|
||||||
.github/workflows/
|
.github/workflows/
|
||||||
LICENSES/
|
LICENSES/
|
||||||
doc/
|
doc/
|
||||||
@ -12,7 +19,7 @@ hw/application_fpga/core/uart/
|
|||||||
hw/application_fpga/fw/tk1/blake2s/
|
hw/application_fpga/fw/tk1/blake2s/
|
||||||
)
|
)
|
||||||
|
|
||||||
filesok=(
|
missingok_files=(
|
||||||
.editorconfig
|
.editorconfig
|
||||||
.gitattributes
|
.gitattributes
|
||||||
.gitignore
|
.gitignore
|
||||||
@ -40,10 +47,10 @@ is_missingok() {
|
|||||||
item="$1"
|
item="$1"
|
||||||
# ok for empty files
|
# ok for empty files
|
||||||
[[ -f "$item" ]] && [[ ! -s "$item" ]] && return 0
|
[[ -f "$item" ]] && [[ ! -s "$item" ]] && return 0
|
||||||
for fileok in "${filesok[@]}"; do
|
for fileok in "${missingok_files[@]}"; do
|
||||||
[[ "$item" = "$fileok" ]] && return 0
|
[[ "$item" = "$fileok" ]] && return 0
|
||||||
done
|
done
|
||||||
for dirok in "${dirsok[@]}"; do
|
for dirok in "${missingok_dirs[@]}"; do
|
||||||
[[ "$item" =~ ^$dirok ]] && return 0
|
[[ "$item" =~ ^$dirok ]] && return 0
|
||||||
done
|
done
|
||||||
return 1
|
return 1
|
||||||
@ -60,10 +67,10 @@ fi
|
|||||||
failed=0
|
failed=0
|
||||||
|
|
||||||
printed=0
|
printed=0
|
||||||
for fileok in "${filesok[@]}"; do
|
for fileok in "${missingok_files[@]}"; do
|
||||||
[[ -f "$fileok" ]] && continue
|
[[ -f "$fileok" ]] && continue
|
||||||
if (( !printed )); then
|
if (( !printed )); then
|
||||||
printf "* Some files in filesok are themselves missing:\n"
|
printf "* Some files in missingok_files are themselves missing:\n"
|
||||||
printed=1
|
printed=1
|
||||||
failed=1
|
failed=1
|
||||||
fi
|
fi
|
||||||
@ -71,10 +78,10 @@ for fileok in "${filesok[@]}"; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
printed=0
|
printed=0
|
||||||
for dirok in "${dirsok[@]}"; do
|
for dirok in "${missingok_dirs[@]}"; do
|
||||||
[[ -d "$dirok" ]] && continue
|
[[ -d "$dirok" ]] && continue
|
||||||
if (( !printed )); then
|
if (( !printed )); then
|
||||||
printf "* Some dirs in dirsok are themselves missing:\n"
|
printf "* Some dirs in missingok_dirs are themselves missing:\n"
|
||||||
printed=1
|
printed=1
|
||||||
failed=1
|
failed=1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user