Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [RFC] SPDX-2.0 license mapping in the repository
Date: Wed, 09 Nov 2022 16:36:12
Message-Id: 39d3ea1735ec2e5c1f1237348a6361511e482cda.camel@gentoo.org
1 Hi, everyone.
2
3 TL;DR: I'd like to propose adding metadata/spdx-license.conf using
4 the following format:
5
6 <spdx-expr> = <ebuild-expr>
7
8 where <spdx-expr> is a SPDX-2.0 license identifier, optionally followed
9 by "+", optionally followed by "WITH" and an exception identifier,
10 and <ebuild-expr> is the corresponding ebuild-style LICENSE field value.
11
12
13 This has been proposed in bug 706472 [1], as an effort to aid converting
14 from the more commonly used SPDX-2.0 identifiers (used e.g. by Cargo) to
15 Gentoo licenses. Right now an inline mapping for them is used e.g. by
16 cargo-ebuild [2].
17
18 Besides maintaining a basic mapping of licenses, there are two main
19 challenges to be overcome here:
20
21 1. SPDX-2.0 using "WITH" operator to combine licenses with exceptions,
22 whereas Gentoo uses combined files for that, e.g. "Apache-2.0 WITH LLVM-
23 exception" corresponds to Gentoo "Apache-2.0-with-LLVM-exceptions").
24
25 2. SPDX-2.0 using "+" operator to indicate "or later" for most of
26 the licenses (except for GNU licenses, that have explicit "*-or-later"
27 variant, whereas Gentoo only features "or later" variants of specific
28 licenses.
29
30 I think the best approach here is to include both "+" and "WITH ..."
31 explicitly in the key, and to allow the RHS to specify an arbitrary
32 Gentoo license expression. Therefore, e.g. the file would specify:
33
34 Apache-1.1 = Apache-1.1
35 Apache-2.0 = Apache-2.0
36 Apache-2.0 WITH LLVM-exception = Apache-2.0-with-LLVM-exceptions
37 Apache-1.1+ = || ( Apache-1.1 Apache-2.0 )
38
39 Then, SPDX (sub)expressions would be mapped the following way:
40
41 a. plain "Apache-x.y" would be mapped to "Apache-x.y"
42
43 b. "Apache-2.0 WITH LLVM-exception" would be mapped to the appropriate
44 license
45
46 c. "Apache-2.0 WITH ..." any other exception would remain unmatched
47
48 d. "Apache-1.1+" would map to the OR-expression for all matching
49 licenses
50
51 e. "Apache-2.0+" would not be listed explicitly, the tool could fall
52 back to "Apache-2.0" then (assuming we don't have any later version)
53
54
55 WDYT?
56
57
58 [1] https://bugs.gentoo.org/706472
59 [2] https://github.com/gentoo/cargo-ebuild/blob/master/src/license.rs#L3
60
61 --
62 Best regards,
63 Michał Górny

Replies