Skip to contentSkip to conversation

ynl: another license adjustment

PATCH Applied Jakub Kicinski 3 participants 6 messages Mar 15, 2023 – Mar 17, 2023

Subsystems (5)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

cover ynl: another license adjustment

Hopefully the last adjustment to the licensing of the specs. I'm still the author so should be fine to do this.

Jakub Kicinski (3):
tools: ynl: make definitions optional again
ynl: broaden the license even more
ynl: make the tooling check the license

 Documentation/netlink/genetlink-c.yaml        |  2 +-
 Documentation/netlink/genetlink-legacy.yaml   |  2 +-
 Documentation/netlink/genetlink.yaml          |  2 +-
 Documentation/netlink/specs/ethtool.yaml      |  2 +-
 Documentation/netlink/specs/fou.yaml          |  2 +-
 Documentation/netlink/specs/netdev.yaml       |  2 +-
 Documentation/userspace-api/netlink/specs.rst |  3 ++-
 include/uapi/linux/fou.h                      |  2 +-
 include/uapi/linux/netdev.h                   |  2 +-
 net/core/netdev-genl-gen.c                    |  2 +-
 net/core/netdev-genl-gen.h                    |  2 +-
 net/ipv4/fou_nl.c                             |  2 +-
 net/ipv4/fou_nl.h                             |  2 +-
 tools/include/uapi/linux/netdev.h             |  2 +-
 tools/net/ynl/lib/nlspec.py                   | 11 ++++++++++-
 tools/net/ynl/ynl-gen-c.py                    | 15 ++++++++-------
 16 files changed, 33 insertions(+), 22 deletions(-)
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 1/3 tools: ynl: make definitions optional again

definitions are optional, commit in question breaks cli for ethtool.

Fixes 6517a60b0307 ("tools: ynl: move the enum classes to shared code")
---
 tools/net/ynl/lib/nlspec.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/net/ynl/lib/nlspec.py +2 -1
index 960a356e8225..e01a72d06638 100644
@@ -387,7 +387,8 @@ jsonschema = None
     def resolve(self):
         self.resolve_up(super())
 
-        for elem in self.yaml['definitions']:
+        definitions = self.yaml.get('definitions', [])
+        for elem in definitions:
             if elem['type'] == 'enum' or elem['type'] == 'flags':
                 self.consts[elem['name']] = self.new_enum(elem)
             else:
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH 2/3 ynl: broaden the license even more

In reply to Jakub Kicinski

I relicensed Netlink spec code to GPL-2.0 OR BSD-3-Clause but we still put a slightly different license on the uAPI header than the rest of the code. Use the Linux-syscall-note on all the specs and all generated code. It's moot for kernel code, but should not hurt. This way the licenses match everywhere.

Cc Chuck Lever <[email protected]>
Fixes 37d9df224d1e ("ynl: re-license uniformly under GPL-2.0 OR BSD-3-Clause")
---
 Documentation/netlink/genetlink-c.yaml        | 2 +-
 Documentation/netlink/genetlink-legacy.yaml   | 2 +-
 Documentation/netlink/genetlink.yaml          | 2 +-
 Documentation/netlink/specs/ethtool.yaml      | 2 +-
 Documentation/netlink/specs/fou.yaml          | 2 +-
 Documentation/netlink/specs/netdev.yaml       | 2 +-
 Documentation/userspace-api/netlink/specs.rst | 3 ++-
 include/uapi/linux/fou.h                      | 2 +-
 include/uapi/linux/netdev.h                   | 2 +-
 net/core/netdev-genl-gen.c                    | 2 +-
 net/core/netdev-genl-gen.h                    | 2 +-
 net/ipv4/fou_nl.c                             | 2 +-
 net/ipv4/fou_nl.h                             | 2 +-
 tools/include/uapi/linux/netdev.h             | 2 +-
 tools/net/ynl/ynl-gen-c.py                    | 8 ++++----
 15 files changed, 19 insertions(+), 18 deletions(-)
Documentation/netlink/genetlink-c.yaml +1 -1
index f082a5ad7cf1..5c3642b3f802 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 %YAML 1.2
 ---
 $id: http://kernel.org/schemas/netlink/genetlink-c.yaml#
Documentation/netlink/genetlink-legacy.yaml +1 -1
index c6b8c77f7d12..5e98c6d2b9aa 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 %YAML 1.2
 ---
 $id: http://kernel.org/schemas/netlink/genetlink-legacy.yaml#
Documentation/netlink/genetlink.yaml +1 -1
index b2d56ab9e615..d35dcd6f8d82 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 %YAML 1.2
 ---
 $id: http://kernel.org/schemas/netlink/genetlink-legacy.yaml#
Documentation/netlink/specs/ethtool.yaml +1 -1
index 18ecb7d90cbe..4727c067e2ba 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 
 name: ethtool
 
Documentation/netlink/specs/fou.yaml +1 -1
index cff104288723..3e13826a3fdf 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 
 name: fou
 
Documentation/netlink/specs/netdev.yaml +1 -1
index 753e5914a8b7..b99e7ffef7a1 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 
 name: netdev
 
Documentation/userspace-api/netlink/specs.rst +2 -1
index 2122e0c4a399..a22442ba1d30 100644
@@ -24,7 +24,8 @@ YAML specifications can be found under ``Documentation/netlink/specs/``
 This document describes details of the schema.
 See :doc:`intro-specs` for a practical starting guide.
 
-All specs must be licensed under ``GPL-2.0-only OR BSD-3-Clause``
+All specs must be licensed under
+``((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)``
 to allow for easy adoption in user space code.
 
 Compatibility levels
include/uapi/linux/fou.h +1 -1
index 5041c3598493..b5cd3e7b3775 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause */
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
 /* Do not edit directly, auto-generated from: */
 /*	Documentation/netlink/specs/fou.yaml */
 /* YNL-GEN uapi header */
include/uapi/linux/netdev.h +1 -1
index ed134fbdfd32..639524b59930 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause */
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
 /* Do not edit directly, auto-generated from: */
 /*	Documentation/netlink/specs/netdev.yaml */
 /* YNL-GEN uapi header */
net/core/netdev-genl-gen.c +1 -1
index 9e10802587fc..3abab70d66dd 100644
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 /* Do not edit directly, auto-generated from: */
 /*	Documentation/netlink/specs/netdev.yaml */
 /* YNL-GEN kernel source */
net/core/netdev-genl-gen.h +1 -1
index 2c5fc7d1e8a7..74d74fc23167 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
 /* Do not edit directly, auto-generated from: */
 /*	Documentation/netlink/specs/netdev.yaml */
 /* YNL-GEN kernel header */
net/ipv4/fou_nl.c +1 -1
index 5c14fe030eda..6c37c4f98cca 100644
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 /* Do not edit directly, auto-generated from: */
 /*	Documentation/netlink/specs/fou.yaml */
 /* YNL-GEN kernel source */
net/ipv4/fou_nl.h +1 -1
index 58b1e1ed4b3b..dbd0780a5d34 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
 /* Do not edit directly, auto-generated from: */
 /*	Documentation/netlink/specs/fou.yaml */
 /* YNL-GEN kernel header */
tools/include/uapi/linux/netdev.h +1 -1
index ed134fbdfd32..639524b59930 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause */
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
 /* Do not edit directly, auto-generated from: */
 /*	Documentation/netlink/specs/netdev.yaml */
 /* YNL-GEN uapi header */
tools/net/ynl/ynl-gen-c.py +4 -4
index d47376f19de7..3b4d03a50fc1 100755
@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
-# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 
 import argparse
 import collections
@@ -2068,12 +2068,12 @@ _C_KW = {
 
     _, spec_kernel = find_kernel_root(args.spec)
     if args.mode == 'uapi':
-        cw.p('/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause */')
+        cw.p('/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */')
     else:
         if args.header:
-            cw.p('/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */')
+            cw.p('/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */')
         else:
-            cw.p('// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause')
+            cw.p('// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)')
     cw.p("/* Do not edit directly, auto-generated from: */")
     cw.p(f"/*\t{spec_kernel} */")
     cw.p(f"/* YNL-GEN {args.mode} {'header' if args.header else 'source'} */")
Signature · 1 line
2.39.2
author maintainer
#3 lore raw

PATCH 3/3 ynl: make the tooling check the license

In reply to Jakub Kicinski

The (only recently documented) expectation is that all specs are under a certain license, but we don't actually enforce it. What's worse we then go ahead and assume the license was right, outputting the expected license into generated files.

Cc Chuck Lever <[email protected]>
Fixes 37d9df224d1e ("ynl: re-license uniformly under GPL-2.0 OR BSD-3-Clause")
---
 tools/net/ynl/lib/nlspec.py |  8 ++++++++
 tools/net/ynl/ynl-gen-c.py  | 13 +++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)
tools/net/ynl/lib/nlspec.py +8 -0
index e01a72d06638..d04450c2a44a 100644
@@ -274,6 +274,7 @@ jsonschema = None
 
     Attributes:
         proto     protocol type (e.g. genetlink)
+        license   spec license (loaded from an SPDX tag on the spec)
 
         attr_sets  dict of attribute sets
         msgs       dict of all messages (index by name)
@@ -283,6 +284,13 @@ jsonschema = None
     """
     def __init__(self, spec_path, schema_path=None):
         with open(spec_path, "r") as stream:
+            prefix = '# SPDX-License-Identifier: '
+            first = stream.readline().strip()
+            if not first.startswith(prefix):
+                raise Exception('SPDX license tag required in the spec')
+            self.license = first[len(prefix):]
+
+            stream.seek(0)
             spec = yaml.safe_load(stream)
 
         self._resolution_list = []
tools/net/ynl/ynl-gen-c.py +7 -6
index 3b4d03a50fc1..c16671a02621 100755
@@ -2059,6 +2059,10 @@ _C_KW = {
 
     try:
         parsed = Family(args.spec)
+        if parsed.license != '((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)':
+            print('Spec license:', parsed.license)
+            print('License must be: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)')
+            os.sys.exit(1)
     except yaml.YAMLError as exc:
         print(exc)
         os.sys.exit(1)
@@ -2067,13 +2071,10 @@ _C_KW = {
     cw = CodeWriter(BaseNlLib(), out_file)
 
     _, spec_kernel = find_kernel_root(args.spec)
-    if args.mode == 'uapi':
-        cw.p('/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */')
+    if args.mode == 'uapi' or args.header:
+        cw.p(f'/* SPDX-License-Identifier: {parsed.license} */')
     else:
-        if args.header:
-            cw.p('/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */')
-        else:
-            cw.p('// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)')
+        cw.p(f'// SPDX-License-Identifier: {parsed.license}')
     cw.p("/* Do not edit directly, auto-generated from: */")
     cw.p(f"/*\t{spec_kernel} */")
     cw.p(f"/* YNL-GEN {args.mode} {'header' if args.header else 'source'} */")
Signature · 1 line
2.39.2
Reviewed-by on the v1 series
#4 lore raw
In reply to Jakub Kicinski
Quoted 21 lines · Jakub Kicinski

Hopefully the last adjustment to the licensing of the specs. I'm still the author so should be fine to do this.

Jakub Kicinski (3):
tools: ynl: make definitions optional again
ynl: broaden the license even more
ynl: make the tooling check the license

Documentation/netlink/genetlink-c.yaml        |  2 +-
Documentation/netlink/genetlink-legacy.yaml   |  2 +-
Documentation/netlink/genetlink.yaml          |  2 +-
Documentation/netlink/specs/ethtool.yaml      |  2 +-
Documentation/netlink/specs/fou.yaml          |  2 +-
Documentation/netlink/specs/netdev.yaml       |  2 +-
Documentation/userspace-api/netlink/specs.rst |  3 ++-
include/uapi/linux/fou.h                      |  2 +-
include/uapi/linux/netdev.h                   |  2 +-
Quoted 8 lines
net/core/netdev-genl-gen.c                    |  2 +-
net/core/netdev-genl-gen.h                    |  2 +-
net/ipv4/fou_nl.c                             |  2 +-
net/ipv4/fou_nl.h                             |  2 +-
tools/include/uapi/linux/netdev.h             |  2 +-
tools/net/ynl/lib/nlspec.py                   | 11 ++++++++++-
tools/net/ynl/ynl-gen-c.py                    | 15 ++++++++-------
16 files changed, 33 insertions(+), 22 deletions(-)

--
Chuck Lever

#5 lore raw
In reply to Jakub Kicinski
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 15 Mar 2023 16:03:48 -0700 you wrote:

Hopefully the last adjustment to the licensing of the specs. I'm still the author so should be fine to do this.

Jakub Kicinski (3):
tools: ynl: make definitions optional again
ynl: broaden the license even more
ynl: make the tooling check the license

[...]

Here is the summary with links:
- [net,1/3] tools: ynl: make definitions optional again

    https://git.kernel.org/netdev/net/c/054abb515f34
  - [net,2/3] ynl: broaden the license even more
    https://git.kernel.org/netdev/net/c/4e16b6a748df
  - [net,3/3] ynl: make the tooling check the license
    https://git.kernel.org/netdev/net/c/cfab77c0b545

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html