Skip to content

Commit

Permalink
Merge pull request #932 from yuluo-yx/0929-yuluo/add-license-check
Browse files Browse the repository at this point in the history
infra(ci): update copyright check ci
  • Loading branch information
kmesh-bot authored Oct 8, 2024
2 parents bff5b9a + dc26806 commit 1fb823f
Show file tree
Hide file tree
Showing 25 changed files with 73 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Run Copyright-check
run : |
make ./hack/copyright-check.sh
make copyright-check
- name: Build Kmesh
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion cniplugin/main.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
*/
Expand Down
17 changes: 2 additions & 15 deletions config/kmesh_marcos_def.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion daemon/main.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion daemon/manager/manager.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion daemon/manager/version/version.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion daemon/options/bpf.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 2 additions & 1 deletion daemon/options/bypass.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 2 additions & 1 deletion daemon/options/cni.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion daemon/options/options.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 2 additions & 1 deletion daemon/options/secret_manager.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
17 changes: 2 additions & 15 deletions depends/include/bpf_helper_defs_ext.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 10 additions & 7 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 @@ -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
Expand All @@ -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
}

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": []
}
2 changes: 1 addition & 1 deletion hack/gen-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
fi
11 changes: 2 additions & 9 deletions kernel/ko_src/kmesh/defer_connect.c
Original file line number Diff line number Diff line change
@@ -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 <linux/init.h>
Expand Down
11 changes: 2 additions & 9 deletions kernel/ko_src/kmesh/defer_connect.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 2 additions & 9 deletions kernel/ko_src/kmesh/kmesh_main.c
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 3 additions & 9 deletions kernel/ko_src/kmesh/kmesh_parse_http_1_1.c
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
11 changes: 2 additions & 9 deletions kernel/ko_src/kmesh/kmesh_parse_http_1_1.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions kernel/ko_src/kmesh/kmesh_parse_protocol_data.c
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
8 changes: 3 additions & 5 deletions kernel/ko_src/kmesh/kmesh_parse_protocol_data.h
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
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
2 changes: 1 addition & 1 deletion test/e2e/restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1fb823f

Please sign in to comment.