Skip to content

Commit 82220c8

Browse files
marc-hblgirdwood
authored andcommitted
github: add new SPDX-README.md and show it when checkpatch fails
Pleasing checkpatch is hard when adding new files. This is tricky and comes up every time someone adds new files, examples in #6284, #6796, #6931 , etc. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent fab1376 commit 82220c8

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/SPDX-README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Pleasing checkpatch is hard when adding new files because:
2+
3+
- checkpatch wants a different SPDX style for .c versus .h files!
4+
- SOF rejects C99 comments starting with //
5+
6+
The trick is to keep the SPDX separate. See solution below.
7+
8+
References:
9+
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst#n71
10+
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9f3a89926d6d
11+
12+
13+
Start .h files like this:
14+
```
15+
/* SPDX-License-Identifier: ... */
16+
/*
17+
* Copyright(c) ...
18+
*
19+
* Author: ...
20+
*/
21+
```
22+
23+
Start .c files like this:
24+
```
25+
// SPDX-License-Identifier: ...
26+
/*
27+
* Copyright(c) ...
28+
*
29+
* Author: ...
30+
*/
31+
```

.github/workflows/checkpatch_list.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ main()
1616
./scripts/checkpatch.pl $@ -g $sha || failures=$((failures+1))
1717
done
1818
printf '\n -------------- \n\n'
19+
20+
if [ $failures -ne 0 ]; then
21+
cat .github/workflows/SPDX-README.md
22+
fi
23+
1924
return $failures
2025
}
2126

0 commit comments

Comments
 (0)