Skip to content

Commit

Permalink
Merge branch 'oneapi-src:main' into addDocker
Browse files Browse the repository at this point in the history
  • Loading branch information
rbanka1 authored Jan 14, 2025
2 parents 0d602d9 + bf8d0d8 commit bfb7e5e
Show file tree
Hide file tree
Showing 33 changed files with 271 additions and 33 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/reusable_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ 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 a spell check
uses: crate-ci/typos@b63f421581dce830bda2f597a678cb7776b41877 # v1.18.2
with:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion include/umf.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/umf/memory_pool_ops.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/umf/memtarget.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/umf/pools/pool_jemalloc.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/umf/pools/pool_scalable.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
197 changes: 197 additions & 0 deletions scripts/check_license/check_headers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
#!/usr/bin/env bash
# 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

SELF=$0

function usage() {
echo "Usage: $SELF <source_root_path> <license_tag> [-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 --no-pager log --pretty=%H -1)
MERGE_BASE=$($GIT merge-base HEAD origin/main 2>/dev/null)
[ -z $MERGE_BASE ] && \
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

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 [ "$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

# 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
37 changes: 37 additions & 0 deletions scripts/check_license/file-exceptions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/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 '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$' \
-e '.gitignore' \
-e '.json$' \
-e '.mailmap' \
-e '.md$' \
-e '.patch$' \
-e '.rst$' \
-e '.spellcheck-conf.toml' \
-e '.trivyignore' \
-e '.xml$' \
-e '.yml$'
4 changes: 2 additions & 2 deletions src/ctl/ctl.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/libumf.def
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/libumf.map
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/libumf.rc.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/memory_pool_internal.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/memory_provider_get_last_failed.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/memory_provider_internal.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/memspaces/memspace_numa.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/memtargets/memtarget_numa.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/pool/pool_disjoint.cpp
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading

0 comments on commit bfb7e5e

Please sign in to comment.