From 5db7da2bedb54581e8293c878db70b58f7d3e9d8 Mon Sep 17 00:00:00 2001 From: rbanka1 Date: Wed, 8 Jan 2025 15:32:49 +0100 Subject: [PATCH 1/2] Added license checker based on https://github.com/pmem/pmemstream/tree/master/utils/check_license Changes for this repository: - update dates - file exceptions --- .github/workflows/reusable_checks.yml | 8 + include/umf.h | 2 +- include/umf/memory_pool_ops.h | 2 +- include/umf/memtarget.h | 2 +- include/umf/pools/pool_jemalloc.h | 2 +- include/umf/pools/pool_scalable.h | 2 +- scripts/check_license/check_headers.sh | 177 +++++++++++++++++++++++ scripts/check_license/file-exceptions.sh | 34 +++++ src/ctl/ctl.c | 4 +- src/libumf.def | 2 +- src/libumf.map | 2 +- src/libumf.rc.in | 4 +- src/memory_pool_internal.h | 2 +- src/memory_provider_get_last_failed.c | 2 +- src/memory_provider_internal.h | 2 +- src/memspaces/memspace_numa.c | 2 +- src/memtargets/memtarget_numa.h | 2 +- src/pool/pool_disjoint.cpp | 2 +- src/proxy_lib/proxy_lib.rc.in | 4 +- src/utils/utils_common.h | 2 +- src/utils/utils_posix_concurrency.c | 2 +- src/utils/utils_windows_concurrency.c | 2 +- src/utils/utils_windows_math.c | 2 +- test/common/pool_trace.c | 2 +- test/common/test_helpers.c | 2 +- test/malloc_compliance_tests.cpp | 2 +- test/poolFixtures.hpp | 2 +- test/pools/jemalloc_pool.cpp | 2 +- test/pools/pool_base_alloc.cpp | 2 +- test/pools/scalable_pool.cpp | 2 +- test/provider_os_memory.cpp | 2 +- 31 files changed, 250 insertions(+), 31 deletions(-) create mode 100755 scripts/check_license/check_headers.sh create mode 100755 scripts/check_license/file-exceptions.sh diff --git a/.github/workflows/reusable_checks.yml b/.github/workflows/reusable_checks.yml index 6298b9883..de28161a5 100644 --- a/.github/workflows/reusable_checks.yml +++ b/.github/workflows/reusable_checks.yml @@ -52,6 +52,14 @@ jobs: - name: Check Python formatting run: cmake --build build --target black-format-check + - name: Run check-license + run: | + ./scripts/check_license/check_headers.sh . "Apache-2.0 WITH LLVM-exception" -v + + - name: Run copyright-format + run: | + ./scripts/check_license/check_headers.sh . "Apache-2.0 WITH LLVM-exception" -d + - name: Run a spell check uses: crate-ci/typos@b63f421581dce830bda2f597a678cb7776b41877 # v1.18.2 with: diff --git a/include/umf.h b/include/umf.h index 3e2d82799..57bebef8a 100644 --- a/include/umf.h +++ b/include/umf.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/include/umf/memory_pool_ops.h b/include/umf/memory_pool_ops.h index 67afdd166..829f49fb7 100644 --- a/include/umf/memory_pool_ops.h +++ b/include/umf/memory_pool_ops.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/include/umf/memtarget.h b/include/umf/memtarget.h index d74947f14..55ca30919 100644 --- a/include/umf/memtarget.h +++ b/include/umf/memtarget.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/include/umf/pools/pool_jemalloc.h b/include/umf/pools/pool_jemalloc.h index c30df6509..5974e6440 100644 --- a/include/umf/pools/pool_jemalloc.h +++ b/include/umf/pools/pool_jemalloc.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/include/umf/pools/pool_scalable.h b/include/umf/pools/pool_scalable.h index 072169b68..1915ad0b7 100644 --- a/include/umf/pools/pool_scalable.h +++ b/include/umf/pools/pool_scalable.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/scripts/check_license/check_headers.sh b/scripts/check_license/check_headers.sh new file mode 100755 index 000000000..d68b0891b --- /dev/null +++ b/scripts/check_license/check_headers.sh @@ -0,0 +1,177 @@ +#!/usr/bin/env bash + # Copyright (C) 2016-2024 Intel Corporation + # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. + # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# check-headers.sh - check copyright and license in source files + +SELF=$0 + +function usage() { + echo "Usage: $SELF [-h|-v|-a|-d]" + echo " -h, --help this help message" + echo " -v, --verbose verbose mode" + echo " -a, --all check all files (only modified files are checked by default)" + echo " -d, --update_dates change Copyright dates in all analyzed files (rather not use with -a)" +} + +if [ "$#" -lt 2 ]; then + usage >&2 + exit 2 +fi + +SOURCE_ROOT=$1 +shift +LICENSE=$1 +shift + +PATTERN=`mktemp` +TMP=`mktemp` +TMP2=`mktemp` +TEMPFILE=`mktemp` +rm -f $PATTERN $TMP $TMP2 + +if [ "$1" == "-h" -o "$1" == "--help" ]; then + usage + exit 0 +fi + +export GIT="git -C ${SOURCE_ROOT}" +$GIT rev-parse || exit 1 + +if [ -f $SOURCE_ROOT/.git/shallow ]; then + SHALLOW_CLONE=1 + echo + echo "Warning: This is a shallow clone. Checking dates in copyright headers" + echo " will be skipped in case of files that have no history." + echo +else + SHALLOW_CLONE=0 +fi + +VERBOSE=0 +CHECK_ALL=0 +UPDATE_DATES=0 +while [ "$1" != "" ]; do + case $1 in + -v|--verbose) + VERBOSE=1 + ;; + -a|--all) + CHECK_ALL=1 + ;; + -d|--update_dates) + UPDATE_DATES=1 + ;; + esac + shift +done + +if [ $CHECK_ALL -eq 0 ]; then + CURRENT_COMMIT=$($GIT log --pretty=%H -1) + MERGE_BASE=$($GIT merge-base HEAD origin/master 2>/dev/null) + [ -z $MERGE_BASE ] && \ + MERGE_BASE=$($GIT log --pretty="%cN:%H" | grep GitHub | head -n1 | cut -d: -f2) + [ -z $MERGE_BASE -o "$CURRENT_COMMIT" = "$MERGE_BASE" ] && \ + CHECK_ALL=1 +fi + +if [ $CHECK_ALL -eq 1 ]; then + echo "INFO: Checking copyright headers of all files..." + GIT_COMMAND="ls-tree -r --name-only HEAD" +else + echo "INFO: Checking copyright headers of modified files only..." + GIT_COMMAND="diff --name-only $MERGE_BASE $CURRENT_COMMIT" +fi + +FILES=$($GIT $GIT_COMMAND | ${SOURCE_ROOT}/scripts/check_license/file-exceptions.sh) + +RV=0 +for file in $FILES ; do + if [ $VERBOSE -eq 1 ]; then + echo "Checking file: $file" + fi + # The src_path is a path which should be used in every command except git. + # git is called with -C flag so filepaths should be relative to SOURCE_ROOT + src_path="${SOURCE_ROOT}/$file" + [ ! -f $src_path ] && continue + # ensure that file is UTF-8 encoded + ENCODING=`file -b --mime-encoding $src_path` + iconv -f $ENCODING -t "UTF-8" $src_path > $TEMPFILE + + if ! grep -q "SPDX-License-Identifier: $LICENSE" $src_path; then + echo >&2 "error: no $LICENSE SPDX tag in file: $src_path" + RV=1 + fi + + if [ $SHALLOW_CLONE -eq 0 ]; then + $GIT log --no-merges --format="%ai %aE" -- $file | sort > $TMP + else + # mark the grafted commits (commits with no parents) + $GIT log --no-merges --format="%ai %aE grafted-%p-commit" -- $file | sort > $TMP + fi + + # skip checking dates for non-Intel commits + [[ ! $(tail -n1 $TMP) =~ "@intel.com" ]] && continue + + # skip checking dates for new files + [ $(cat $TMP | wc -l) -le 1 ] && continue + + # grep out the grafted commits (commits with no parents) + # and skip checking dates for non-Intel commits + grep -v -e "grafted--commit" $TMP | grep -e "@intel.com" > $TMP2 + + [ $(cat $TMP2 | wc -l) -eq 0 ] && continue + + FIRST=`head -n1 $TMP2` + LAST=` tail -n1 $TMP2` + + YEARS=$(sed ' +/.*Copyright (C) \+.*[0-9-]\+ Intel Corporation/!d +s/.*Copyright (C) \([0-9]\+\)-\([0-9]\+\).*/\1-\2/ +s/.*Copyright (C) \([0-9]\+\).*/\1/' "$src_path") + if [ -z "$YEARS" ]; then + echo >&2 "No copyright years in $src_path" + RV=1 + continue + fi + + HEADER_FIRST=`echo $YEARS | cut -d"-" -f1` + HEADER_LAST=` echo $YEARS | cut -d"-" -f2` + + COMMIT_FIRST=`echo $FIRST | cut -d"-" -f1` + COMMIT_LAST=` echo $LAST | cut -d"-" -f1` + + if [ "$COMMIT_FIRST" != "" -a "$COMMIT_LAST" != "" ]; then + if [[ -n "$COMMIT_FIRST" && -n "$COMMIT_LAST" ]]; then + if [[ $COMMIT_FIRST -eq $COMMIT_LAST ]]; then + NEW=$COMMIT_LAST + else + NEW=$COMMIT_FIRST-$COMMIT_LAST + fi + + if [[ "$YEARS" == "$NEW" ]]; then + continue + else + if [[ ${UPDATE_DATES} -eq 1 ]]; then + sed -i "s/Copyright ${YEARS}/Copyright ${NEW}/g" "${src_path}" + else + echo "$file:1: error: wrong copyright date: (is: $YEARS, should be: $NEW)" >&2 + RV=1 + fi + fi + fi + else + echo "error: unknown commit dates in file: $file" >&2 + RV=1 + fi +done +rm -f $TMP $TMP2 $TEMPFILE + +# check if error found +if [ $RV -eq 0 ]; then + echo "Copyright headers are OK." +else + echo "Error(s) in copyright headers found!" >&2 +fi +exit $RV diff --git a/scripts/check_license/file-exceptions.sh b/scripts/check_license/file-exceptions.sh new file mode 100755 index 000000000..144e4b65b --- /dev/null +++ b/scripts/check_license/file-exceptions.sh @@ -0,0 +1,34 @@ +#!/bin/sh -e +# Copyright (C) 2025 Intel Corporation +# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# You can add an exception file +# list for license and copyright check +grep -v -E -e 'benchmark/ubench.h' \ + -e 'ChangeLog' \ + -e 'CODEOWNERS$' \ + -e 'docs/assets/.*' \ + -e 'docs/config/conf.py' \ + -e 'docs/config/Doxyfile' \ + -e 'include/umf/proxy_lib_new_delete.h' \ + -e 'LICENSE.TXT' \ + -e 'scripts/assets/images/.*' \ + -e 'src/uthash/.*' \ + -e 'src/uthash/utlist.h' \ + -e 'src/uthash/uthash.h' \ + -e 'test/supp/.*' \ + -e '.clang-format$' \ + -e '.cmake-format$' \ + -e '.cmake.in$' \ + -e '.gitignore' \ + -e '.json$' \ + -e '.mailmap' \ + -e '.md$' \ + -e '.patch$' \ + -e '.rst$' \ + -e '.spellcheck-conf.toml' \ + -e '.trivyignore' \ + -e '.txt$' \ + -e '.xml$' \ + -e '.yml$' diff --git a/src/ctl/ctl.c b/src/ctl/ctl.c index d54e8390e..4db11ac21 100644 --- a/src/ctl/ctl.c +++ b/src/ctl/ctl.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2016-2024 Intel Corporation + * Copyright (C) 2016-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -9,7 +9,7 @@ // This file was originally under following license: // SPDX-License-Identifier: BSD-3-Clause -/* Copyright 2016-2024, Intel Corporation */ +/* Copyright 2024, Intel Corporation */ /* * ctl.c -- implementation of the interface for examination and modification of diff --git a/src/libumf.def b/src/libumf.def index 5d1c5047f..d4c8bb777 100644 --- a/src/libumf.def +++ b/src/libumf.def @@ -1,5 +1,5 @@ ;;;; Begin Copyright Notice -; Copyright (C) 2024 Intel Corporation +; Copyright (C) 2023-2025 Intel Corporation ; Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ;;;; End Copyright Notice diff --git a/src/libumf.map b/src/libumf.map index d604dd64e..ff6348e22 100644 --- a/src/libumf.map +++ b/src/libumf.map @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2023-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/libumf.rc.in b/src/libumf.rc.in index 7aba79e7e..8ee85d626 100644 --- a/src/libumf.rc.in +++ b/src/libumf.rc.in @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Intel Corporation +// Copyright (C) 2024-2025 Intel Corporation // // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -51,7 +51,7 @@ BEGIN VALUE "CompanyName", "Intel Corporation\0" VALUE "FileDescription", "Unified Memory Framework (UMF) library\0" VALUE "FileVersion", _UMF_VERSION "\0" - VALUE "LegalCopyright", "Copyright 2024, Intel Corporation. All rights reserved.\0" + VALUE "LegalCopyright", "Copyright 2024-2025, Intel Corporation. All rights reserved.\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "umf.dll\0" VALUE "ProductName", "Unified Memory Framework (UMF)\0" diff --git a/src/memory_pool_internal.h b/src/memory_pool_internal.h index e556ace21..ab3378163 100644 --- a/src/memory_pool_internal.h +++ b/src/memory_pool_internal.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/memory_provider_get_last_failed.c b/src/memory_provider_get_last_failed.c index 9434eea97..09bd075e1 100644 --- a/src/memory_provider_get_last_failed.c +++ b/src/memory_provider_get_last_failed.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/memory_provider_internal.h b/src/memory_provider_internal.h index 60955e0fb..0b7f45f80 100644 --- a/src/memory_provider_internal.h +++ b/src/memory_provider_internal.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/memspaces/memspace_numa.c b/src/memspaces/memspace_numa.c index 0028e394d..83e65fc29 100644 --- a/src/memspaces/memspace_numa.c +++ b/src/memspaces/memspace_numa.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/memtargets/memtarget_numa.h b/src/memtargets/memtarget_numa.h index 2d3e3fd70..6659d045e 100644 --- a/src/memtargets/memtarget_numa.h +++ b/src/memtargets/memtarget_numa.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/pool/pool_disjoint.cpp b/src/pool/pool_disjoint.cpp index e0298b43d..0390f5375 100644 --- a/src/pool/pool_disjoint.cpp +++ b/src/pool/pool_disjoint.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/proxy_lib/proxy_lib.rc.in b/src/proxy_lib/proxy_lib.rc.in index dce151ec3..f0497fb40 100644 --- a/src/proxy_lib/proxy_lib.rc.in +++ b/src/proxy_lib/proxy_lib.rc.in @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Intel Corporation +// Copyright (C) 2024-2025 Intel Corporation // // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -51,7 +51,7 @@ BEGIN VALUE "CompanyName", "Intel Corporation\0" VALUE "FileDescription", "Unified Memory Framework (UMF) proxy library\0" VALUE "FileVersion", _UMF_VERSION "\0" - VALUE "LegalCopyright", "Copyright 2024, Intel Corporation. All rights reserved.\0" + VALUE "LegalCopyright", "Copyright 2024-2025, Intel Corporation. All rights reserved.\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "umf_proxy.dll\0" VALUE "ProductName", "Unified Memory Framework (UMF)\0" diff --git a/src/utils/utils_common.h b/src/utils/utils_common.h index 9ef2b3cf1..6af5a08d9 100644 --- a/src/utils/utils_common.h +++ b/src/utils/utils_common.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/utils/utils_posix_concurrency.c b/src/utils/utils_posix_concurrency.c index fcf04ed95..531e09c10 100644 --- a/src/utils/utils_posix_concurrency.c +++ b/src/utils/utils_posix_concurrency.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/utils/utils_windows_concurrency.c b/src/utils/utils_windows_concurrency.c index 696f4523b..e2cc574a9 100644 --- a/src/utils/utils_windows_concurrency.c +++ b/src/utils/utils_windows_concurrency.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/src/utils/utils_windows_math.c b/src/utils/utils_windows_math.c index 07c4c9978..cd21ae696 100644 --- a/src/utils/utils_windows_math.c +++ b/src/utils/utils_windows_math.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/test/common/pool_trace.c b/test/common/pool_trace.c index 29329f31c..d8b7522ea 100644 --- a/test/common/pool_trace.c +++ b/test/common/pool_trace.c @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/test/common/test_helpers.c b/test/common/test_helpers.c index 71f018d0f..d69ca3535 100644 --- a/test/common/test_helpers.c +++ b/test/common/test_helpers.c @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // This file contains tests for UMF pool API diff --git a/test/malloc_compliance_tests.cpp b/test/malloc_compliance_tests.cpp index 06e3b5dd7..b91bde1f6 100644 --- a/test/malloc_compliance_tests.cpp +++ b/test/malloc_compliance_tests.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/test/poolFixtures.hpp b/test/poolFixtures.hpp index 6f54fe114..bd97ac1fa 100644 --- a/test/poolFixtures.hpp +++ b/test/poolFixtures.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/test/pools/jemalloc_pool.cpp b/test/pools/jemalloc_pool.cpp index 042841fc4..86784d919 100644 --- a/test/pools/jemalloc_pool.cpp +++ b/test/pools/jemalloc_pool.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/test/pools/pool_base_alloc.cpp b/test/pools/pool_base_alloc.cpp index ec07a7c2f..752d9f01e 100644 --- a/test/pools/pool_base_alloc.cpp +++ b/test/pools/pool_base_alloc.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/test/pools/scalable_pool.cpp b/test/pools/scalable_pool.cpp index 51cc02030..ce55923d9 100644 --- a/test/pools/scalable_pool.cpp +++ b/test/pools/scalable_pool.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/test/provider_os_memory.cpp b/test/provider_os_memory.cpp index 4c81b84f9..9544a6fed 100644 --- a/test/provider_os_memory.cpp +++ b/test/provider_os_memory.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Intel Corporation +// Copyright (C) 2023-2025 Intel Corporation // Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception From b229a346f36bca356aa2985c798978597c722532 Mon Sep 17 00:00:00 2001 From: rbanka1 Date: Thu, 9 Jan 2025 10:43:28 +0100 Subject: [PATCH 2/2] Added a condition to check the validity of the starting date and some fixes Changes for this commit: - adding a condition to check the validity of the starting date - broken pipe fix - updating date fix --- .github/workflows/reusable_checks.yml | 4 -- CMakeLists.txt | 2 +- scripts/check_license/check_headers.sh | 80 +++++++++++++++--------- scripts/check_license/file-exceptions.sh | 5 +- src/pool/CMakeLists.txt | 2 +- 5 files changed, 56 insertions(+), 37 deletions(-) diff --git a/.github/workflows/reusable_checks.yml b/.github/workflows/reusable_checks.yml index de28161a5..6e700cec1 100644 --- a/.github/workflows/reusable_checks.yml +++ b/.github/workflows/reusable_checks.yml @@ -56,10 +56,6 @@ jobs: run: | ./scripts/check_license/check_headers.sh . "Apache-2.0 WITH LLVM-exception" -v - - name: Run copyright-format - run: | - ./scripts/check_license/check_headers.sh . "Apache-2.0 WITH LLVM-exception" -d - - name: Run a spell check uses: crate-ci/typos@b63f421581dce830bda2f597a678cb7776b41877 # v1.18.2 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 495c70de3..58b189ce1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2022-2024 Intel Corporation +# Copyright (C) 2022-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/scripts/check_license/check_headers.sh b/scripts/check_license/check_headers.sh index d68b0891b..aeb90e7a2 100755 --- a/scripts/check_license/check_headers.sh +++ b/scripts/check_license/check_headers.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash - # Copyright (C) 2016-2024 Intel Corporation - # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. - # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Copyright (C) 2016-2025 Intel Corporation +# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # check-headers.sh - check copyright and license in source files @@ -68,10 +68,10 @@ while [ "$1" != "" ]; do done if [ $CHECK_ALL -eq 0 ]; then - CURRENT_COMMIT=$($GIT log --pretty=%H -1) - MERGE_BASE=$($GIT merge-base HEAD origin/master 2>/dev/null) + CURRENT_COMMIT=$($GIT --no-pager log --pretty=%H -1) + MERGE_BASE=$($GIT merge-base HEAD origin/main 2>/dev/null) [ -z $MERGE_BASE ] && \ - MERGE_BASE=$($GIT log --pretty="%cN:%H" | grep GitHub | head -n1 | cut -d: -f2) + MERGE_BASE=$($GIT --no-pager log --pretty="%cN:%H" | grep GitHub 2>/dev/null | head -n1 | cut -d: -f2) [ -z $MERGE_BASE -o "$CURRENT_COMMIT" = "$MERGE_BASE" ] && \ CHECK_ALL=1 fi @@ -127,7 +127,7 @@ for file in $FILES ; do LAST=` tail -n1 $TMP2` YEARS=$(sed ' -/.*Copyright (C) \+.*[0-9-]\+ Intel Corporation/!d +/.*Copyright (C) [0-9-]\+ Intel Corporation/!d s/.*Copyright (C) \([0-9]\+\)-\([0-9]\+\).*/\1-\2/ s/.*Copyright (C) \([0-9]\+\).*/\1/' "$src_path") if [ -z "$YEARS" ]; then @@ -142,29 +142,49 @@ s/.*Copyright (C) \([0-9]\+\).*/\1/' "$src_path") COMMIT_FIRST=`echo $FIRST | cut -d"-" -f1` COMMIT_LAST=` echo $LAST | cut -d"-" -f1` - if [ "$COMMIT_FIRST" != "" -a "$COMMIT_LAST" != "" ]; then - if [[ -n "$COMMIT_FIRST" && -n "$COMMIT_LAST" ]]; then - if [[ $COMMIT_FIRST -eq $COMMIT_LAST ]]; then - NEW=$COMMIT_LAST - else - NEW=$COMMIT_FIRST-$COMMIT_LAST - fi - - if [[ "$YEARS" == "$NEW" ]]; then - continue - else - if [[ ${UPDATE_DATES} -eq 1 ]]; then - sed -i "s/Copyright ${YEARS}/Copyright ${NEW}/g" "${src_path}" - else - echo "$file:1: error: wrong copyright date: (is: $YEARS, should be: $NEW)" >&2 - RV=1 - fi - fi - fi - else - echo "error: unknown commit dates in file: $file" >&2 - RV=1 - fi + if [ "$COMMIT_FIRST" != "" -a "$COMMIT_LAST" != "" ]; then + if [ "$COMMIT_FIRST" -lt "$HEADER_FIRST" ]; then + RV=1 + fi + + if [[ -n "$COMMIT_FIRST" && -n "$COMMIT_LAST" ]]; then + if [[ $HEADER_FIRST -le $COMMIT_FIRST ]]; then + if [[ $HEADER_LAST -eq $COMMIT_LAST ]]; then + continue + else + NEW="$HEADER_FIRST-$COMMIT_LAST" + if [[ ${UPDATE_DATES} -eq 1 ]]; then + echo "Updating copyright date in $src_path: $YEARS -> $NEW" + sed -i "s/Copyright (C) ${YEARS}/Copyright (C) ${NEW}/g" "${src_path}" + else + echo "$file:1: error: wrong copyright date: (is: $YEARS, should be: $NEW)" >&2 + RV=1 + fi + fi + else + if [[ $COMMIT_FIRST -eq $COMMIT_LAST ]]; then + NEW=$COMMIT_LAST + else + NEW=$COMMIT_FIRST-$COMMIT_LAST + fi + + if [[ "$YEARS" == "$NEW" ]]; then + continue + else + if [[ ${UPDATE_DATES} -eq 1 ]]; then + echo "Updating copyright date in $src_path: $YEARS -> $NEW" + sed -i "s/Copyright (C) ${YEARS}/Copyright (C) ${NEW}/g" "${src_path}" + else + echo "$file:1: error: wrong copyright date: (is: $YEARS, should be: $NEW)" >&2 + RV=1 + fi + fi + fi + fi + else + echo "error: unknown commit dates in file: $file" >&2 + RV=1 + fi done rm -f $TMP $TMP2 $TEMPFILE diff --git a/scripts/check_license/file-exceptions.sh b/scripts/check_license/file-exceptions.sh index 144e4b65b..5a12443d9 100755 --- a/scripts/check_license/file-exceptions.sh +++ b/scripts/check_license/file-exceptions.sh @@ -13,11 +13,15 @@ grep -v -E -e 'benchmark/ubench.h' \ -e 'docs/config/Doxyfile' \ -e 'include/umf/proxy_lib_new_delete.h' \ -e 'LICENSE.TXT' \ + -e 'licensing/third-party-programs.txt' \ -e 'scripts/assets/images/.*' \ + -e 'scripts/qemu/requirements.txt' \ -e 'src/uthash/.*' \ -e 'src/uthash/utlist.h' \ -e 'src/uthash/uthash.h' \ + -e 'test/ctl/config.txt' \ -e 'test/supp/.*' \ + -e 'third_party/requirements.txt' \ -e '.clang-format$' \ -e '.cmake-format$' \ -e '.cmake.in$' \ @@ -29,6 +33,5 @@ grep -v -E -e 'benchmark/ubench.h' \ -e '.rst$' \ -e '.spellcheck-conf.toml' \ -e '.trivyignore' \ - -e '.txt$' \ -e '.xml$' \ -e '.yml$' diff --git a/src/pool/CMakeLists.txt b/src/pool/CMakeLists.txt index 17be932a4..f54e70185 100644 --- a/src/pool/CMakeLists.txt +++ b/src/pool/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2023 Intel Corporation +# Copyright (C) 2023-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception