From 0e5fc944d7d241d7141fc97e5839c0d597dc1851 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sun, 2 Jul 2023 20:33:09 -0700 Subject: [PATCH] Amend check_commit and PR template Require GPLv3 license and check for violations. --- .github/pull_request_template.md | 1 + tools/check_commit.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a8fb72361..68cc5141f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,6 +8,7 @@ The following must be true before PRs can be merged: * Commits in a single PR should be related. * Major new features or bug fixes should reference a [CHIRP issue](https://chirp.danplanet.com/projects/chirp/issues). * New drivers should be accompanied by a test image in `tests/images` (except for thin aliases where the driver is sufficiently tested already). +* All files must be GPLv3 licensed or contain no license verbiage. No additional restrictions can be placed on the usage (i.e. such as noncommercial). Please also follow these guidelines: diff --git a/tools/check_commit.sh b/tools/check_commit.sh index 6672c8443..844187a18 100755 --- a/tools/check_commit.sh +++ b/tools/check_commit.sh @@ -1,6 +1,6 @@ #!/bin/bash -BASE="$1" +BASE=${1:-origin/master} RETCODE=0 RED='\033[1;31m' @@ -14,6 +14,7 @@ function fail() { echo -e "${GREEN}Checking from $(git rev-parse --short ${BASE}):${NC}" git log --pretty=oneline --no-merges --abbrev-commit ${BASE}.. +echo git diff ${BASE}.. '*.py' | grep '^+' > added_lines @@ -53,6 +54,11 @@ if grep '/cpep8.blacklist' added_lines; then fail 'Do not add new files to cpep8.blacklist' fi +grep -i 'license' added_lines > license_lines +if grep -iv '(GNU General Public License|Free Software Foundation)' license_lines; then + fail 'Files must be GPLv3 licensed (or not contain any license language)' +fi + for file in $(git diff --name-only ${BASE}..); do if file $file | grep -q CRLF; then fail "$file : Files should be LF (Unix) format, not CR (Mac) or CRLF (Windows)"