Skip to content

Commit

Permalink
infra: update copyright check scripts
Browse files Browse the repository at this point in the history
Signed-off-by: yuluo-yx <[email protected]>
  • Loading branch information
yuluo-yx committed Oct 6, 2024
1 parent 11f1bf8 commit ea58a4b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- name: Run Copyright-check
run : |
apt-get install jq
make ./hack/copyright-check.sh
- name: Build Kmesh
Expand Down
8 changes: 5 additions & 3 deletions hack/copyright-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ go_copyright_path=$ROOT_DIR/hack/copyright/apache.txt
c_copyright_path1=$ROOT_DIR/hack/copyright/BSDandGPL1.txt
c_copyright_path2=$ROOT_DIR/hack/copyright/BSDandGPL2.txt

go_dirs="$ROOT_DIR/pkg"
c_dirs="$ROOT_DIR/bpf"

function check_go_copyright() {
target_file=$1
copyright_file=$go_copyright_path
Expand Down Expand Up @@ -94,13 +91,18 @@ function c_check_dir() {
dir=$1
find $dir -type f -name "*.c" -o -name "*.h" | while read file; do
# echo $file
exclude_dirs=$(jq -r '.exclude_dirs[]' ./copyright/copyright_scan_dir.json)
if ! echo $exclude_dirs | grep -q $(dirname $file); then
check_c_copyright $file
fi
done
}

function copyright_check() {

go_dirs=$(jq -r '.go_dirs[]' ./copyright/copyright_scan_dir.json)
c_dirs=$(jq -r '.c_dirs[]' ./copyright/copyright_scan_dir.json)

for dir in ${go_dirs}; do
go_check_dir $dir
done
Expand Down
17 changes: 17 additions & 0 deletions hack/copyright/copyright_scan_dir.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"go_dirs": [
"/pkg",
"/cniplugin",
"/ctl",
"/daemon",
"/test"
],
"c_dirs": [
"/bpf",
"/config",
"/depends",
"/kernel",
"/oncn-mda"
],
"exclude_dirs": []
}
5 changes: 3 additions & 2 deletions pkg/utils/kernel_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// +build linux

/*
* Copyright The Kmesh Authors.
* Copyright The Kmesh Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/

package utils

import (
Expand Down

0 comments on commit ea58a4b

Please sign in to comment.