Whamcloud - gitweb
LU-16707 scripts: update license-status 15/50515/5
authorTimothy Day <timday@amazon.com>
Tue, 4 Apr 2023 02:42:05 +0000 (02:42 +0000)
committerOleg Drokin <green@whamcloud.com>
Fri, 19 May 2023 07:06:55 +0000 (07:06 +0000)
Improve license-status script to parse SPDX text and
to only look at files tracked by git. This will make
it easier to track which files still need SPDX.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I4ece6c7af6133d3e6fa0771dbf49bc511c5f853c
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50515
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
contrib/scripts/license-status [new file with mode: 0755]
lustre/scripts/Makefile.am
lustre/scripts/license-status [deleted file]

diff --git a/contrib/scripts/license-status b/contrib/scripts/license-status
new file mode 100755 (executable)
index 0000000..0001baa
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-only
+
+#
+# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# contrib/scripts/license-status
+#
+# Display the license status of files in the current directory
+#
+# Author: Gordon Matzigkeit <gord@fig.org>, 2001-09-27
+# Author: Timothy Day <timday@amazon.com>, 2023-04-03
+#
+
+for file in $(git ls-tree -r HEAD --name-only); do
+       if head -20 "$file" | egrep -e 'SPDX' > /dev/null; then
+               license="$(grep SPDX $file | awk '{ print $3; exit; }')"
+               printf "%-10s %-15s %-s\n" "SPDX" "$license" "$file"
+       elif head -20 "$file" | egrep -e 'GNU General Public License' > /dev/null; then
+               printf "%-10s %-15s %-s\n" "guess" "gpled" "$file"
+       elif head -20 "$file" | egrep -e '\([Cc]\)' > /dev/null; then
+               printf "%-10s %-15s %-s\n" "guess" "copyright" "$file"
+       else
+               printf "%-10s %-15s %-s\n" "guess" "unknown" "$file"
+       fi
+done | sort
index cdba9b2..1c1a109 100644 (file)
@@ -88,7 +88,7 @@ endif
 
 endif # UTILS
 
-EXTRA_DIST = license-status lustre_rmmod ldev lc_mon lhbadm \
+EXTRA_DIST = lustre_rmmod ldev lc_mon lhbadm \
             lc_servip lustre_routes_config lustre_routes_conversion \
             $(addsuffix .in,$(genscripts)) lfs_migrate lustre_req_history \
             lustre lsvcgss lc_common haconfig Lustre.ha_v2 dkms.mkconf \
diff --git a/lustre/scripts/license-status b/lustre/scripts/license-status
deleted file mode 100755 (executable)
index 5fbd486..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh
-# license-status - Display the status of files in the current directory
-# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-#
-# Gordon Matzigkeit <gord@fig.org>, 2001-09-27
-
-for f in `find . -type f | sort`; do
- case "$f" in
- *~ | *.orig | *.gz | */config.* | *.o | \
- */CVS/* | */.cvsignore | */.depfiles/* | \
- */COPYING | */ChangeLog)
-  continue
-  ;;
- esac
-
- if head -20 "$f" | egrep -e 'GNU' > /dev/null; then
-  echo "gpled $f"
- elif head -20 "$f" | egrep -e '\([Cc]\)' > /dev/null; then
-  echo "copyrighted $f"
- else
-  echo "bare $f"
- fi
-done | sort