From: Timothy Day Date: Tue, 4 Apr 2023 02:42:05 +0000 (+0000) Subject: LU-16707 scripts: update license-status X-Git-Tag: 2.15.56~69 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F50515%2F5;p=fs%2Flustre-release.git LU-16707 scripts: update license-status 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 Change-Id: I4ece6c7af6133d3e6fa0771dbf49bc511c5f853c Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50515 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- diff --git a/contrib/scripts/license-status b/contrib/scripts/license-status new file mode 100755 index 0000000..0001baa --- /dev/null +++ b/contrib/scripts/license-status @@ -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 , 2001-09-27 +# Author: Timothy Day , 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 diff --git a/lustre/scripts/Makefile.am b/lustre/scripts/Makefile.am index cdba9b2..1c1a1096 100644 --- a/lustre/scripts/Makefile.am +++ b/lustre/scripts/Makefile.am @@ -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 index 5fbd486..0000000 --- a/lustre/scripts/license-status +++ /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 , 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