Skip to contentSkip to conversation

scripts: add check for net driver names without net prefix

PATCH In review Bruce Richardson 2 participants 5 messages Jul 5, 2016 – Jul 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: add check for net driver names without net prefix

Since the current standard for commit prefixes is to put the device type e.g. "net", in front of the driver name, add a check for commit titles which have a net driver name without any prefix in front of it.

---
 scripts/check-git-log.sh | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/check-git-log.sh +6 -0
index 7d2c7ee..7dc1fd8 100755
@@ -78,6 +78,12 @@ bad=$(echo "$headlines" | grep --color=always \
 	| sed 's,^,\t,')
 [ -z "$bad" ] || printf "Wrong headline label:\n$bad\n"
 
+# check headline label for net/ prefix if needed
+bad=$(echo "$headlines" | grep -E --color=always \
+	-e "^($(ls drivers/net | grep -v Makefile | tr '\n' '|')):" \
+	| sed 's,^,\t,')
+[ -z "$bad" ] || printf "Headline missing 'net/' prefix:\n$bad\n"
+
 # check headline lowercase for first words
 bad=$(echo "$headlines" | grep --color=always \
 	-e '^.*[A-Z].*:' \
Signature · 1 line
2.5.5
#1 lore raw

2016-07-05 15:40, Bruce Richardson:

scripts/check-git-log.sh bad=$(echo "$headlines" | grep --color=always \ · line 85

Quoted 5 lines
scripts/check-git-log.sh +5 -0
+# check headline label for net/ prefix if needed
+bad=$(echo "$headlines" | grep -E --color=always \
+	-e "^($(ls drivers/net | grep -v Makefile | tr '\n' '|')):" \
+	| sed 's,^,\t,')
+[ -z "$bad" ] || printf "Headline missing 'net/' prefix:\n$bad\n"

This check is definitely a good idea.
We need the same thing for crypto.
Few nits:
- -E is not needed for this regex
- "/base:" cases are not handled because of the colon at the end of the regex.
- patches touching several drivers are not handled. Examples:
"mlx:" -> "net/mlx:"
"drivers/net:" -> "net:"

By the way, I am looking at an idea, that Nelio sent me, based on modified files. It can complete this check.

#2 lore raw
Quoted 13 lines · Thomas Monjalon

2016-07-05 15:40, Bruce Richardson:

scripts/check-git-log.sh bad=$(echo "$headlines" | grep --color=always \ · line 85

Quoted 5 lines
scripts/check-git-log.sh +5 -0
+# check headline label for net/ prefix if needed
+bad=$(echo "$headlines" | grep -E --color=always \
+	-e "^($(ls drivers/net | grep -v Makefile | tr '\n' '|')):" \
+	| sed 's,^,\t,')
+[ -z "$bad" ] || printf "Headline missing 'net/' prefix:\n$bad\n"

This check is definitely a good idea.
We need the same thing for crypto.
Few nits:
- -E is not needed for this regex
- "/base:" cases are not handled because of the colon at the end of the regex.

Good point. Easy enough to fix, I suspect.

Quoted 4 lines

- patches touching several drivers are not handled. Examples:
"mlx:" -> "net/mlx:"
"drivers/net:" -> "net:"

Yes, however, those are in the minority of cases, and we can always add special case extra regex's for those - hardcoded like the other regex's in the file. I did the pulling directory list so we don't have to update the checks every time a new driver was added.

Quoted 2 lines

By the way, I am looking at an idea, that Nelio sent me, based on modified files. It can complete this check.

Great. I'll look forward to seeing that. If it works out well, by all means drop this patch. If it's not coming any time soon though, I can do a V2 of this patch, but I won't bother right now in the expectation that a better solution is coming.

/Bruce

#3 lore raw

2016-07-06 10:25, Bruce Richardson:

Quoted 17 lines · Thomas Monjalon
Quoted 13 lines

2016-07-05 15:40, Bruce Richardson:

scripts/check-git-log.sh bad=$(echo "$headlines" | grep --color=always \ · line 85

Quoted 5 lines
scripts/check-git-log.sh +5 -0
+# check headline label for net/ prefix if needed
+bad=$(echo "$headlines" | grep -E --color=always \
+	-e "^($(ls drivers/net | grep -v Makefile | tr '\n' '|')):" \
+	| sed 's,^,\t,')
+[ -z "$bad" ] || printf "Headline missing 'net/' prefix:\n$bad\n"

This check is definitely a good idea.
We need the same thing for crypto.
Few nits:
- -E is not needed for this regex
- "/base:" cases are not handled because of the colon at the end of the regex.

Good point. Easy enough to fix, I suspect.

Quoted 8 lines
Quoted 4 lines

- patches touching several drivers are not handled. Examples:
"mlx:" -> "net/mlx:"
"drivers/net:" -> "net:"

Yes, however, those are in the minority of cases, and we can always add special case extra regex's for those - hardcoded like the other regex's in the file. I did the pulling directory list so we don't have to update the checks every time a new driver was added.

Another issue: I suspect you will have false positives with librte_ring and librte_vhost.

Quoted 7 lines
Quoted 2 lines

By the way, I am looking at an idea, that Nelio sent me, based on modified files. It can complete this check.

Great. I'll look forward to seeing that. If it works out well, by all means drop this patch. If it's not coming any time soon though, I can do a V2 of this patch, but I won't bother right now in the expectation that a better solution is coming.

My concern is that the file-based solution will handle only the patches where every changes are in drivers/ (not config/ or anything else).
I'm thinking how to merge both solutions.

I'm also concerned by the time passed developing these checks ;)

#4 lore raw
Quoted 22 lines · Thomas Monjalon

2016-07-06 10:25, Bruce Richardson:

Quoted 21 lines · Thomas Monjalon
Quoted 13 lines

2016-07-05 15:40, Bruce Richardson:

scripts/check-git-log.sh bad=$(echo "$headlines" | grep --color=always \ · line 85

Quoted 5 lines
scripts/check-git-log.sh +5 -0
+# check headline label for net/ prefix if needed
+bad=$(echo "$headlines" | grep -E --color=always \
+	-e "^($(ls drivers/net | grep -v Makefile | tr '\n' '|')):" \
+	| sed 's,^,\t,')
+[ -z "$bad" ] || printf "Headline missing 'net/' prefix:\n$bad\n"

This check is definitely a good idea.
We need the same thing for crypto.
Few nits:
- -E is not needed for this regex
- "/base:" cases are not handled because of the colon at the end of the regex.

Good point. Easy enough to fix, I suspect.

Quoted 4 lines

- patches touching several drivers are not handled. Examples:
"mlx:" -> "net/mlx:"
"drivers/net:" -> "net:"

Quoted 7 lines
Quoted 4 lines

Yes, however, those are in the minority of cases, and we can always add special case extra regex's for those - hardcoded like the other regex's in the file. I did the pulling directory list so we don't have to update the checks every time a new driver was added.

Another issue: I suspect you will have false positives with librte_ring and librte_vhost.

Yep, good catch there. Need to tune up those filters if I proceed with this.

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

By the way, I am looking at an idea, that Nelio sent me, based on modified files. It can complete this check.

Great. I'll look forward to seeing that. If it works out well, by all means drop this patch. If it's not coming any time soon though, I can do a V2 of this patch, but I won't bother right now in the expectation that a better solution is coming.

Quoted 5 lines

My concern is that the file-based solution will handle only the patches where every changes are in drivers/ (not config/ or anything else).
I'm thinking how to merge both solutions.

I'm also concerned by the time passed developing these checks ;)

"Time is an illusion. Lunchtime doubly so."