Skip to content

Commit

Permalink
github: add new SPDX-README.md and show it when checkpatch fails
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
marc-hb authored and lgirdwood committed Jan 11, 2023
1 parent fab1376 commit 82220c8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/SPDX-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Pleasing checkpatch is hard when adding new files because:

- checkpatch wants a different SPDX style for .c versus .h files!
- SOF rejects C99 comments starting with //

The trick is to keep the SPDX separate. See solution below.

References:
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/license-rules.rst#n71
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9f3a89926d6d


Start .h files like this:
```
/* SPDX-License-Identifier: ... */
/*
* Copyright(c) ...
*
* Author: ...
*/
```

Start .c files like this:
```
// SPDX-License-Identifier: ...
/*
* Copyright(c) ...
*
* Author: ...
*/
```
5 changes: 5 additions & 0 deletions .github/workflows/checkpatch_list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ main()
./scripts/checkpatch.pl $@ -g $sha || failures=$((failures+1))
done
printf '\n -------------- \n\n'

if [ $failures -ne 0 ]; then
cat .github/workflows/SPDX-README.md
fi

return $failures
}

Expand Down

0 comments on commit 82220c8

Please sign in to comment.