summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2025-09-25 21:58:50 +0100
committerDave Hibberd <hibby@debian.org>2025-09-25 21:58:50 +0100
commitdff1a610625ebe7841fca01e20ca6d86b65ee4d0 (patch)
tree97c0482e33cbbd110ac648db8a32ea8e09638134 /tools
parentf6b2e6e7159906b8b3204dca3a9e58e42c36ccbb (diff)
New upstream version 20250912upstream/20250912
Diffstat (limited to 'tools')
-rwxr-xr-xtools/check_commit.sh35
-rwxr-xr-xtools/check_for_bug.sh7
-rw-r--r--tools/cpep8.manifest2
-rwxr-xr-xtools/fast-driver.py2
4 files changed, 31 insertions, 15 deletions
diff --git a/tools/check_commit.sh b/tools/check_commit.sh
index 4a6d68d..9273912 100755
--- a/tools/check_commit.sh
+++ b/tools/check_commit.sh
@@ -16,7 +16,7 @@ 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
+git diff ${BASE}.. -- '*.py' | grep '^+' > added_lines
if grep -E '(from|import).*six' added_lines; then
fail No new uses of future
@@ -50,11 +50,11 @@ if grep -E "eval\(" added_lines; then
fail 'Use of eval() is dangerous and not permitted!'
fi
-if git diff ${BASE}.. 'tools/cpep8.manifest' | tail -n +5 | grep -q '^+'; then
+if git diff ${BASE}.. -- 'tools/cpep8.manifest' | tail -n +5 | grep -q '^+'; then
fail 'Do not add new files to cpep8.manifest; no longer needed'
fi
-if git diff ${BASE}.. 'tools/cpep8.blacklist' | tail -n +5 | grep -q '^+'; then
+if git diff ${BASE}.. -- 'tools/cpep8.blacklist' | tail -n +5 | grep -q '^+'; then
fail 'Do not add new files to cpep8.blacklist; fix the code'
fi
@@ -73,12 +73,16 @@ done
# fail 'New drivers should not have match_model() implemented as it is not needed'
#fi
+if grep -E '\Wprint\(' added_lines; then
+ fail 'Do not use print()'
+fi
+
if git log ${BASE}.. --merges | grep .; then
fail Please do not include merge commits in your PR
fi
make -C chirp/locale clean all >/dev/null 2>&1
-if git diff chirp/locale | grep '^+[^#+]' | grep -v POT-Creation; then
+if git diff -- chirp/locale | grep '^+[^#+]' | grep -v POT-Creation; then
fail Locale files need updating
fi
@@ -88,7 +92,14 @@ if echo $added_py | grep -q chirp.drivers && ! echo $added_files | grep -q tests
fail All new drivers should include a test image
fi
-existing_drivers=$(git ls-tree --name-only $BASE chirp/drivers/)
+modified_files=$(git diff --name-only --diff-filter=M ${BASE}..)
+modified_img=$(echo "$modified_files" | grep 'tests.images')
+modified_py=$(echo "$modified_files" | grep '\.py$')
+if [ "$modified_img" -a "$modified_py" ]; then
+ fail "Change modifies an image and (potentially) a driver for a possible upgrade breakage"
+fi
+
+existing_drivers=$(git ls-tree --name-only $BASE -- chirp/drivers/)
limit=51
for nf in $added_py; do
for of in $existing_drivers; do
@@ -104,4 +115,18 @@ done
rm -f added_lines license_lines
+commits=$(git log --pretty=format:%h ${BASE}..)
+for commit in $commits; do
+ git log -n1 $commit --pretty=format:%B > commit_msg
+ if [[ `sed -n '1p' commit_msg | wc -c` > 99 ]]; then
+ fail "First line of commit message of $commit must be <99 chars"
+ fi
+ if [[ `wc -l < commit_msg` > 1 ]]; then
+ if ! sed -n '2p' commit_msg | grep '^$'; then
+ fail "Second line of commit message of $commit must be blank for proper formatting in the notification emails"
+ fi
+ fi
+ rm -f commit_msg
+done
+
exit $RETCODE
diff --git a/tools/check_for_bug.sh b/tools/check_for_bug.sh
deleted file mode 100755
index c8b042d..0000000
--- a/tools/check_for_bug.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env sh
-
-# This checks a given revision to make sure that it has a bug number
-# in it, of the form "#123". It should be used in your pretxncommit
-# hook
-
-hg log -r $1 --template {desc} | egrep -q "\#[0-9]+"
diff --git a/tools/cpep8.manifest b/tools/cpep8.manifest
index 2850863..1b499c3 100644
--- a/tools/cpep8.manifest
+++ b/tools/cpep8.manifest
@@ -53,8 +53,6 @@
./chirp/drivers/th_uv88.py
./chirp/drivers/thd72.py
./chirp/drivers/tk760.py
-./chirp/drivers/tk760g.py
-./chirp/drivers/tk8180.py
./chirp/drivers/tmd710.py
./chirp/drivers/ts480.py
./chirp/drivers/ts590.py
diff --git a/tools/fast-driver.py b/tools/fast-driver.py
index 669a5e1..3f078e2 100755
--- a/tools/fast-driver.py
+++ b/tools/fast-driver.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env Python3
+#!/usr/bin/env python3
import glob
import os