linux/tools/net/ynl/ynl-regen.sh
Jakub Kicinski 37d9df224d ynl: re-license uniformly under GPL-2.0 OR BSD-3-Clause
I was intending to make all the Netlink Spec code BSD-3-Clause
to ease the adoption but it appears that:
 - I fumbled the uAPI and used "GPL WITH uAPI note" there
 - it gives people pause as they expect GPL in the kernel
As suggested by Chuck re-license under dual. This gives us benefit
of full BSD freedom while fulfilling the broad "kernel is under GPL"
expectations.

Link: https://lore.kernel.org/all/20230304120108.05dd44c5@kernel.org/
Link: https://lore.kernel.org/r/20230306200457.3903854-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-03-07 13:44:30 -08:00

31 lines
777 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
TOOL=$(dirname $(realpath $0))/ynl-gen-c.py
force=
while [ ! -z "$1" ]; do
case "$1" in
-f ) force=yes; shift ;;
* ) echo "Unrecognized option '$1'"; exit 1 ;;
esac
done
KDIR=$(dirname $(dirname $(dirname $(dirname $(realpath $0)))))
files=$(git grep --files-with-matches '^/\* YNL-GEN \(kernel\|uapi\)')
for f in $files; do
# params: 0 1 2 3
# $YAML YNL-GEN kernel $mode
params=( $(git grep -B1 -h '/\* YNL-GEN' $f | sed 's@/\*\(.*\)\*/@\1@') )
if [ $f -nt ${params[0]} -a -z "$force" ]; then
echo -e "\tSKIP $f"
continue
fi
echo -e "\tGEN ${params[2]}\t$f"
$TOOL --mode ${params[2]} --${params[3]} --spec $KDIR/${params[0]} -o $f
done