Skip to content

Commit

Permalink
First step of updating the copyright dates
Browse files Browse the repository at this point in the history
Add a script "update-copyright.sh" that automatically updates the
copyright dates, which was mostly copied from Ronan's PR KhronosGroup#339.
Manually change the copyright line for a few files that don't follow
our regular pattern.

The file "copyright-ccby.txt" seems to be copied from the Vulkan repo.
I think we don't even use it, but the copyright notice listed
"Khronos Group" instead of "The Khronos Goup".  I replaced this file
with the latest version from the Vulkan repo, which has the corrected
name.
  • Loading branch information
gmlueck committed Jan 4, 2024
1 parent 55e878f commit 2230593
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 The Khronos Group, Inc.
# Copyright 2021-2023 The Khronos Group, Inc.
# SPDX-License-Identifier: Apache-2.0

# CI to build asciidoctor spec targets, on push or manually
Expand Down
2 changes: 1 addition & 1 deletion adoc/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2011-2022 The Khronos Group, Inc.
# Copyright 2011-2023 The Khronos Group, Inc.
#
# SPDX-License-Identifier: Apache-2.0

Expand Down
5 changes: 2 additions & 3 deletions adoc/config/copyright-ccby.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Copyright (c) 2011-2021 Khronos Group, Inc. This work is licensed under a
http://creativecommons.org/licenses/by/4.0/[Creative Commons
Attribution 4.0 International License].
Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0
2 changes: 1 addition & 1 deletion adoc/scripts/doctransformer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 The Khronos Group Inc.
# Copyright 2023-2023 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0

Expand Down
42 changes: 42 additions & 0 deletions adoc/scripts/update-copyright.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /bin/bash
# Copyright 2024-2024 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0

# Run this script at the beginning of the year to update the copyright dates
# on all the source files. Run it from the root of the repo. The script only
# updates copyright dates in the following forms:
#
# Copyright <begin-date>-<end-date> The Khronos Group
# Copyright (c) <begin-date>-<end-date> The Khronos Group
#
# And it only updates the <end-date> if the original value is the previous year
# (i.e. last year, assuming you run the script at the beginning of the year).
#
# We intentionally do not update copyright notices from other companies.
#
# The script also performs a check for Khronos copyright notices that do not
# follow either of the patterns above. If any such notices are found, they are
# printed to stdout. These lines should be examined and modified manually.

thisyear=`date +%Y`
lastyear=`expr $thisyear - 1`

function update_code() {
file_name="$1"
# Update the copyright dates and names
sed -i \
-e "s/Copyright\\( (c)\\)\\? \\([12][0-9][0-9][0-9]\\)-$lastyear The Khronos Group/Copyright\\1 \\2-$thisyear The Khronos Group/g" \
"$file_name"
}

git ls-files | while read -r f ; do
update_code "$f"

# See if the file contains a Khronos copyright that was not updated.
# We skip the file for this script because the sed expression above causes
# a false report.
if [ "$f" != "adoc/scripts/update-copyright.sh" ]; then
grep -iH 'copyright.*khronos' "$f" | grep -v "[12][0-9][0-9][0-9]-$thisyear"
fi
done

0 comments on commit 2230593

Please sign in to comment.