Skip to content

Commit 7020bfa

Browse files
committed
TEST v1
1 parent fb766d3 commit 7020bfa

File tree

5 files changed

+41
-18
lines changed

5 files changed

+41
-18
lines changed

.github/workflows/reusable_checks.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ jobs:
5656
run: |
5757
bash ./check_license/check-headers.sh ./ "Apache-2.0 WITH LLVM-exception" -v
5858
59+
- name: Run copyright-format
60+
run: |
61+
bash ./check_license/check-headers.sh ./ "Apache-2.0 WITH LLVM-exception" -d
62+
5963
- name: Run a spell check
6064
uses: crate-ci/typos@b63f421581dce830bda2f597a678cb7776b41877 # v1.18.2
6165
with:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022-2024 Intel Corporation
1+
# Copyright (C) 2023-2024 Intel Corporation
22
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

check_license/check-headers.sh

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
2-
# SPDX-License-Identifier: BSD-3-Clause
3-
# Copyright 2016-2022, Intel Corporation
2+
# Copyright (C) 2024 Intel Corporation
3+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
45

56
# check-headers.sh - check copyright and license in source files
67

@@ -83,7 +84,7 @@ else
8384
GIT_COMMAND="diff --name-only $MERGE_BASE $CURRENT_COMMIT"
8485
fi
8586

86-
FILES=$($GIT $GIT_COMMAND | \
87+
FILES=$($GIT $GIT_COMMAND | ${SOURCE_ROOT}/check_license/file-exceptions.sh | \
8788
grep -E -e '*\.[chs]$' -e '*\.[ch]pp$' -e '*\.sh$' -e '*\.py$' \
8889
-e 'TEST*' -e 'Makefile*' -e 'CMakeLists.txt$' -e '*\.cmake$' \
8990
-e '*\.link$' -e '*\.map$' -e '*\.Dockerfile$' -e 'LICENSE$' \
@@ -130,10 +131,10 @@ for file in $FILES ; do
130131
FIRST=`head -n1 $TMP2`
131132
LAST=` tail -n1 $TMP2`
132133

133-
YEARS=`sed '
134-
/Copyright [0-9-]\+.*, Intel Corporation/!d
135-
s/.*Copyright \([0-9]\+\)-\([0-9]\+\),.*/\1-\2/
136-
s/.*Copyright \([0-9]\+\),.*/\1-\1/' $src_path`
134+
YEARS=$(sed '
135+
/.*Copyright (C) \+.*[0-9-]\+ Intel Corporation/!d
136+
s/.*Copyright (C) \([0-9]\+\)-\([0-9]\+\).*/\1-\2/
137+
s/.*Copyright (C) \([0-9]\+\).*/\1/' "$src_path")
137138
if [ -z "$YEARS" ]; then
138139
echo >&2 "No copyright years in $src_path"
139140
RV=1
@@ -146,21 +147,25 @@ s/.*Copyright \([0-9]\+\),.*/\1-\1/' $src_path`
146147
COMMIT_FIRST=`echo $FIRST | cut -d"-" -f1`
147148
COMMIT_LAST=` echo $LAST | cut -d"-" -f1`
148149
if [ "$COMMIT_FIRST" != "" -a "$COMMIT_LAST" != "" ]; then
149-
if [ $HEADER_LAST -lt $COMMIT_LAST ]; then
150-
if [ $HEADER_FIRST -lt $COMMIT_FIRST ]; then
151-
COMMIT_FIRST=$HEADER_FIRST
150+
if [[ -n "$COMMIT_FIRST" && -n "$COMMIT_LAST" ]]; then
151+
if [[ $HEADER_FIRST -lt $COMMIT_FIRST ]]; then
152+
HEADER_FIRST=$COMMIT_FIRST
152153
fi
153154
COMMIT_LAST=`date +%G`
154-
if [ $COMMIT_FIRST -eq $COMMIT_LAST ]; then
155+
if [[ $COMMIT_FIRST -eq $COMMIT_LAST ]]; then
155156
NEW=$COMMIT_LAST
156157
else
157158
NEW=$COMMIT_FIRST-$COMMIT_LAST
158159
fi
159-
if [ ${UPDATE_DATES} -eq 1 ]; then
160-
sed -i "s/Copyright ${YEARS}/Copyright ${NEW}/g" "${src_path}"
161-
else
162-
echo "$file:1: error: wrong copyright date: (is: $YEARS, should be: $NEW)" >&2
163-
RV=1
160+
if [[ "$YEARS" == "$NEW" ]]; then
161+
echo "No change needed: $YEARS"
162+
else
163+
if [[ ${UPDATE_DATES} -eq 1 ]]; then
164+
sed -i "s/Copyright ${YEARS}/Copyright ${NEW}/g" "${src_path}"
165+
else
166+
echo "$file:1: error: wrong copyright date: (is: $YEARS, should be: $NEW)" >&2
167+
RV=1
168+
fi
164169
fi
165170
fi
166171
else

check_license/file-exceptions.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh -e
2+
# Copyright (C) 2024 Intel Corporation
3+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
# You can add an exception file
7+
grep -v -E -e 'src\topology.c'

src/base_alloc/base_alloc_global.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
1+
/*
2+
*
3+
* Copyright (C) 2024 Intel Corporation
4+
*
5+
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
6+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
*
8+
*/
29

310
#include <assert.h>
411
#include <stdio.h>

0 commit comments

Comments
 (0)