diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b16b17d35..82796a129 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,7 @@ jobs: - name: Run Copyright-check run : | - make ./hack/copyright-check.sh + make copyright-check - name: Build Kmesh shell: bash diff --git a/Makefile b/Makefile index a6e881e06..3773190c9 100644 --- a/Makefile +++ b/Makefile @@ -117,6 +117,10 @@ gen: tidy\ gen-check: gen hack/gen-check.sh +.PHONY: copyright-check +copyright-check: + hack/copyright-check.sh + .PHONY: install install: $(QUIET) make install -C api/v2-c diff --git a/cniplugin/main.go b/cniplugin/main.go index ce00e8c9d..bc1c0a758 100644 --- a/cniplugin/main.go +++ b/cniplugin/main.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 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. @@ -12,7 +12,9 @@ * 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. + */ +/* * Author: bitcoffee * Create: 2023-11-19 */ diff --git a/config/kmesh_marcos_def.h b/config/kmesh_marcos_def.h index 4238080c0..4daf23236 100644 --- a/config/kmesh_marcos_def.h +++ b/config/kmesh_marcos_def.h @@ -1,18 +1,5 @@ -/* - * Copyright 2023 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. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * 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. - */ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ /* When the two ends use loopback addresses for communication, there is a * low probability that link conflicts occur. The namespace cookie diff --git a/daemon/main.go b/daemon/main.go index c14fe4a3d..415d06b0c 100644 --- a/daemon/main.go +++ b/daemon/main.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 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. diff --git a/daemon/manager/manager.go b/daemon/manager/manager.go index c093e4517..715ce0da9 100644 --- a/daemon/manager/manager.go +++ b/daemon/manager/manager.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 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. diff --git a/daemon/manager/version/version.go b/daemon/manager/version/version.go index 30b9c7180..7d0605bee 100644 --- a/daemon/manager/version/version.go +++ b/daemon/manager/version/version.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 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. diff --git a/daemon/options/bpf.go b/daemon/options/bpf.go index 02ca2d2a8..7a941f6af 100644 --- a/daemon/options/bpf.go +++ b/daemon/options/bpf.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 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. diff --git a/daemon/options/bypass.go b/daemon/options/bypass.go index 578a58145..c51f05945 100644 --- a/daemon/options/bypass.go +++ b/daemon/options/bypass.go @@ -1,4 +1,5 @@ -/* Copyright 2024 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. diff --git a/daemon/options/cni.go b/daemon/options/cni.go index 0019fd625..3959b2ca6 100644 --- a/daemon/options/cni.go +++ b/daemon/options/cni.go @@ -1,4 +1,5 @@ -/* Copyright 2024 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. diff --git a/daemon/options/options.go b/daemon/options/options.go index 0c7724d8b..50346ee51 100644 --- a/daemon/options/options.go +++ b/daemon/options/options.go @@ -1,5 +1,5 @@ /* - * Copyright 2024 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. diff --git a/daemon/options/secret_manager.go b/daemon/options/secret_manager.go index d33c112ec..1b5b1ac24 100644 --- a/daemon/options/secret_manager.go +++ b/daemon/options/secret_manager.go @@ -1,4 +1,5 @@ -/* Copyright 2024 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. diff --git a/depends/include/bpf_helper_defs_ext.h b/depends/include/bpf_helper_defs_ext.h index 2af4cbc69..bc798a8fe 100644 --- a/depends/include/bpf_helper_defs_ext.h +++ b/depends/include/bpf_helper_defs_ext.h @@ -1,18 +1,5 @@ -/* - * Copyright 2023 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. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * 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. - */ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ /* * Note: when compiling kmesh, the helper function IDs listed in this diff --git a/hack/copyright-check.sh b/hack/copyright-check.sh index 66dbdc957..8f81ff00e 100755 --- a/hack/copyright-check.sh +++ b/hack/copyright-check.sh @@ -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 @@ -84,7 +81,8 @@ function go_check_dir() { dir=$1 find $dir -type f -name "*.go" | while read file; do # echo $file - if ! echo $exclude_dirs | grep -q $(dirname $file); then + exclude_dirs=$(jq -r '.exclude_dirs[]' $ROOT_DIR/hack/copyright/copyright_scan_dir.json) + if ! echo $ROOT_DIR$exclude_dirs | grep -q $(dirname $file); then check_go_copyright $file fi done @@ -94,19 +92,24 @@ function c_check_dir() { dir=$1 find $dir -type f -name "*.c" -o -name "*.h" | while read file; do # echo $file - if ! echo $exclude_dirs | grep -q $(dirname $file); then + exclude_dirs=$(jq -r '.exclude_dirs[]' $ROOT_DIR/hack/copyright/copyright_scan_dir.json) + if ! echo $ROOT_DIR$exclude_dirs | grep -q $(dirname $file); then check_c_copyright $file fi done } function copyright_check() { + + go_dirs=$(jq -r '.go_dirs[]' $ROOT_DIR/hack/copyright/copyright_scan_dir.json) + c_dirs=$(jq -r '.c_dirs[]' $ROOT_DIR/hack/copyright/copyright_scan_dir.json) + for dir in ${go_dirs}; do - go_check_dir $dir + go_check_dir "$ROOT_DIR$dir" done for dir in ${c_dirs}; do - c_check_dir $dir + c_check_dir "$ROOT_DIR$dir" done } diff --git a/hack/copyright/copyright_scan_dir.json b/hack/copyright/copyright_scan_dir.json new file mode 100644 index 000000000..3e23bd566 --- /dev/null +++ b/hack/copyright/copyright_scan_dir.json @@ -0,0 +1,17 @@ +{ + "go_dirs": [ + "/pkg", + "/cniplugin", + "/ctl", + "/daemon", + "/test" + ], + "c_dirs": [ + "/bpf", + "/config", + "/depends", + "/kernel", + "/oncn-mda" + ], + "exclude_dirs": [] +} diff --git a/hack/gen-check.sh b/hack/gen-check.sh index 3195e7784..e48f58c91 100755 --- a/hack/gen-check.sh +++ b/hack/gen-check.sh @@ -5,4 +5,4 @@ if [[ -n $(git status --porcelain) ]]; then git diff echo "ERROR: Some files need to be updated, please run 'make gen' and include any changed files in your PR" exit 1 -fi \ No newline at end of file +fi diff --git a/kernel/ko_src/kmesh/defer_connect.c b/kernel/ko_src/kmesh/defer_connect.c index ef592543c..24eb200d0 100644 --- a/kernel/ko_src/kmesh/defer_connect.c +++ b/kernel/ko_src/kmesh/defer_connect.c @@ -1,12 +1,5 @@ -/* - * Copyright 2023 The Kmesh Authors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation - * Author: liuxin - * Create: 2022-08-24 - */ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ #include "../../../config/kmesh_marcos_def.h" #include diff --git a/kernel/ko_src/kmesh/defer_connect.h b/kernel/ko_src/kmesh/defer_connect.h index 445593bde..88d186f18 100644 --- a/kernel/ko_src/kmesh/defer_connect.h +++ b/kernel/ko_src/kmesh/defer_connect.h @@ -1,12 +1,5 @@ -/* - * Copyright 2023 The Kmesh Authors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation - * Author: liuxin - * Create: 2022-08-24 - */ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ #ifndef KMESH_DEFER_CONN_H #define KMESH_DEFER_CONN_H diff --git a/kernel/ko_src/kmesh/kmesh_main.c b/kernel/ko_src/kmesh/kmesh_main.c index 6c148b88f..7eeaf29b1 100644 --- a/kernel/ko_src/kmesh/kmesh_main.c +++ b/kernel/ko_src/kmesh/kmesh_main.c @@ -1,12 +1,5 @@ -/* - * Copyright 2023 The Kmesh Authors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation - * Author: liuxin - * Create: 2022-08-24 - */ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ #define pr_fmt(fmt) "Kmesh_main: " fmt diff --git a/kernel/ko_src/kmesh/kmesh_parse_http_1_1.c b/kernel/ko_src/kmesh/kmesh_parse_http_1_1.c index 491e795e0..bd1ee4a33 100644 --- a/kernel/ko_src/kmesh/kmesh_parse_http_1_1.c +++ b/kernel/ko_src/kmesh/kmesh_parse_http_1_1.c @@ -1,12 +1,6 @@ -/* - * Copyright 2023 The Kmesh Authors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation - * Author: liuxin - * Create: 2022-08-24 - */ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ + #include "kmesh_parse_http_1_1.h" #define LF (char)'\n' diff --git a/kernel/ko_src/kmesh/kmesh_parse_http_1_1.h b/kernel/ko_src/kmesh/kmesh_parse_http_1_1.h index 020fa735b..83d0c5041 100644 --- a/kernel/ko_src/kmesh/kmesh_parse_http_1_1.h +++ b/kernel/ko_src/kmesh/kmesh_parse_http_1_1.h @@ -1,12 +1,5 @@ -/* - * Copyright 2023 The Kmesh Authors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation - * Author: liuxin - * Create: 2022-08-24 - */ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ #ifndef KMESH_REGISTER_HTTP_1_1_H #define KMESH_REGISTER_HTTP_1_1_H diff --git a/kernel/ko_src/kmesh/kmesh_parse_protocol_data.c b/kernel/ko_src/kmesh/kmesh_parse_protocol_data.c index 3f9ca128e..7cbf9e091 100644 --- a/kernel/ko_src/kmesh/kmesh_parse_protocol_data.c +++ b/kernel/ko_src/kmesh/kmesh_parse_protocol_data.c @@ -1,12 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ + /* - * Copyright 2023 The Kmesh Authors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation * Author: liuxin * Create: 2022-08-24 */ + #include "kmesh_parse_protocol_data.h" struct rb_root __percpu *g_kmesh_data_root; diff --git a/kernel/ko_src/kmesh/kmesh_parse_protocol_data.h b/kernel/ko_src/kmesh/kmesh_parse_protocol_data.h index eaf75aa4c..5ce5be236 100644 --- a/kernel/ko_src/kmesh/kmesh_parse_protocol_data.h +++ b/kernel/ko_src/kmesh/kmesh_parse_protocol_data.h @@ -1,9 +1,7 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* Copyright Authors of Kmesh */ + /* - * Copyright 2023 The Kmesh Authors. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation * Author: liuxin * Create: 2022-08-24 */ diff --git a/pkg/utils/kernel_version.go b/pkg/utils/kernel_version.go index ed73a72a2..9a9063a76 100644 --- a/pkg/utils/kernel_version.go +++ b/pkg/utils/kernel_version.go @@ -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. @@ -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 ( diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go index 037bcdef9..987c3d095 100644 --- a/test/e2e/restart_test.go +++ b/test/e2e/restart_test.go @@ -2,7 +2,7 @@ // +build integ /* - * Copyright 2024 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.