summaryrefslogtreecommitdiffstats
path: root/Utilities
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-27 15:54:38 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-27 19:04:28 (GMT)
commitb7180cfee503d9b86f9e516c9e02a4272a3ac380 (patch)
treef9d8493fa38b9e00c4d27bf6083c00ad589aabd2 /Utilities
parent7feb4eccec51d7a3815cd21dd53974bc9115547e (diff)
downloadCMake-b7180cfee503d9b86f9e516c9e02a4272a3ac380.zip
CMake-b7180cfee503d9b86f9e516c9e02a4272a3ac380.tar.gz
CMake-b7180cfee503d9b86f9e516c9e02a4272a3ac380.tar.bz2
Utilities/Scripts: Add temporary script to filter license notices
Add a script to replace our previous per-source license notices with a much simpler notice. This will be used in a following commit and then removed.
Diffstat (limited to 'Utilities')
-rwxr-xr-xUtilities/Scripts/filter-notices.bash49
1 files changed, 49 insertions, 0 deletions
diff --git a/Utilities/Scripts/filter-notices.bash b/Utilities/Scripts/filter-notices.bash
new file mode 100755
index 0000000..d4ac823
--- /dev/null
+++ b/Utilities/Scripts/filter-notices.bash
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+
+# Filter scripts.
+
+regex='#=====================*
+(# CMake - Cross Platform Makefile Generator
+)?(# Copyright.*
+)*#
+# Distributed under the OSI-approved BSD License \(the "License"\);
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=====================*(
+# \(To distribute this file outside of CMake, substitute the full
+# License text for the above reference.\))?
++'
+files="$(git ls-files -- | egrep -v ' ' | xargs pcregrep -M -l "$regex")"
+
+
+if test "x$files" != "x"; then
+ sed -i '1 i# Distributed under the OSI-approved BSD 3-Clause License. See accompanying\
+# file Copyright.txt or https://cmake.org/licensing for details.\
+
+' $files
+
+ perl -i -0pe "s/$regex//" -- $files
+fi
+
+# Filter C and C++ sources.
+
+regex='\/\*=======================*(
+ .*)+
+
+ Distributed under the OSI-approved BSD License \(the "License"\);
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+=======================*\*\/
++'
+
+notice='\/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https:\/\/cmake.org\/licensing for details. *\/
+'
+
+git ls-files -z -- | grep -z -v 'Source/kwsys' | xargs -0 perl -i -0pe "s/$regex/$notice/g"