Change in osmo-ci[master]: lint: checkpatch_osmo.sh: exclude asn1c generated

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Tue Nov 2 13:40:22 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/25963 )

Change subject: lint: checkpatch_osmo.sh: exclude asn1c generated
......................................................................

lint: checkpatch_osmo.sh: exclude asn1c generated

Does not make a noticable speed difference on a typical patch with few
changed files, but makes linting on big patches with ~1000 files and
lots of asn1c generated files in the repository significantly slower.
The next patch will optimize that case.

Change-Id: I7437d888b433fec8a444e4d7c285fff47d16c0c7
---
M lint/checkpatch/checkpatch_osmo.sh
1 file changed, 20 insertions(+), 1 deletion(-)

Approvals:
  fixeria: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/lint/checkpatch/checkpatch_osmo.sh b/lint/checkpatch/checkpatch_osmo.sh
index 91e9abe..f9cc74f 100755
--- a/lint/checkpatch/checkpatch_osmo.sh
+++ b/lint/checkpatch/checkpatch_osmo.sh
@@ -1,6 +1,7 @@
 #!/bin/sh -e
 SCRIPT_DIR="$(dirname "$(realpath "$0")")"
-PROJECT="$(basename "$(git rev-parse --show-toplevel)")"
+PROJECT_DIR="$(git rev-parse --show-toplevel)"
+PROJECT="$(basename "$PROJECT_DIR")"
 
 exclude_paths_common() {
 	# Stdout and stderr of regression tests
@@ -9,6 +10,21 @@
 	echo '--exclude ^debian/changelog$'
 }
 
+exclude_paths_common_asn1c() {
+	local pattern="^ \* Generated by asn1c-"
+	local files="$(find -name '*.c' -o -name '*.h' | cut -d / -f 2-)"
+	local i
+
+	if [ -z "$files" ]; then
+		return
+	fi
+
+	for i in $(grep -l "$pattern" $files); do
+		# Example: --exclude ^include/osmocom/sabp/SABP_Data-Coding-Scheme.h$
+		echo '--exclude ^'$i'$'
+	done
+}
+
 exclude_paths_project() {
 	case "$PROJECT" in
 	libosmocore)
@@ -56,8 +72,11 @@
 # * UNNECESSARY_INT: not followed (see https://gerrit.osmocom.org/c/libosmocore/+/25345)
 # * UNSPECIFIED_INT: not followed (doesn't seem useful for us)
 
+cd "$PROJECT_DIR"
+
 $SCRIPT_DIR/checkpatch.pl \
 	$(exclude_paths_common) \
+	$(exclude_paths_common_asn1c) \
 	$(exclude_paths_project) \
 	--ignore ASSIGN_IN_IF \
 	--ignore AVOID_EXTERNS \

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/25963
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I7437d888b433fec8a444e4d7c285fff47d16c0c7
Gerrit-Change-Number: 25963
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211102/78c41066/attachment.htm>


More information about the gerrit-log mailing list