Skip to content

Commit d63b6ac

Browse files
committed
schema/ListedLicense: Add obsoletedBy to licenses and exceptions
From [1]: As a result, a number of licenses formerly included in the SPDX License List have been deprecated as licenses, and correct usage employs the License Expression Syntax as of v2.0. So the sole reason for the deprecations seems to be "there's a better way to say that now". Telling people "use an expression instead" is less useful than saying "use this expression instead: $SOME_EXPRESSION". This commit updates the schema to allow us to recommend replacements. Consumers can use logic like: 1. Parse a license expression to extract the short identifiers. 2. Look up obsoletedBy entries for the short identifiers. 3. If any obsoletedBy has an 'expression' attribute that matches the source, the value of that obsoletedBy is the recommended replacement for that expression. Otherwise, the value of the obsoletedBy without an expression attribute is the recommended replacement for the short identifier. For example, the expression: GPL-2.0+ WITH GCC-exception-2.0 could be parsed to either of the following short license identifiers: * GPL-2.0+, in which case there would be a single obsoletedBy with no expression attribute: <obsoletedBy>GPL-2.0-or-later</obsoletedBy> So the recommended replacement for GPL-2.0+ would be GPL-2.0-or-later. * GPL-2.0, in which case there would be two obsoletedBy values: <obsoletedBy>GPL-2.0-only</obsoletedBy> <obsoletedBy expression="GPL-2.0+">GPL-2.0-or-later</obsoletedBy> The one with an 'expression' attribute set to 'GPL-2.0+' matches the source, so the recommended replacement for GPL-2.0+ is GPL-2.0-or-later. The presence of an obsoletedBy element is sufficient to mark a license/expression obsolete (as is the presence of an deprecatedVersion attribute), so I'm in favor of dropping isDeprecated to stay DRY. However, removing isDeprecated (from this repository, we would still supply it in license-list-data) has proven contentious for reasons I don't understand. This commit punts on the removal for now [2]. [1]: #392 (comment) [2]: #392 (comment)
1 parent 0061b49 commit d63b6ac

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

schema/ListedLicense.xsd

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
</documentation>
4343
</annotation>
4444
<all>
45+
<element name="obsoletedBy" type="tns:obsoletedByType" />
4546
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/>
4647
<element name="notes" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1"/>
4748
<element name="text" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
@@ -61,6 +62,7 @@
6162
</documentation>
6263
</annotation>
6364
<all>
65+
<element name="obsoletedBy" type="tns:obsoletedByType" />
6466
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/>
6567
<element name="notes" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1">
6668
<annotation>
@@ -165,6 +167,57 @@
165167
</element>
166168
</sequence>
167169
</complexType>
170+
<complexType name="obsoletedByType" mixed="true">
171+
<annotation>
172+
<documentation xml:lang="en">
173+
<xhtml:p>
174+
<xhtml:code>obsoletedByType</xhtml:code> represents a recommended replacement for license expressions containing a given license or exception. The algorithm for determining the recommended replacement in the context of a given license expression is:
175+
</xhtml:p>
176+
<xhtml:ol>
177+
<xhtml:li>Parse the license expression to extract the short identifiers.</xhtml:li>
178+
<xhtml:li>Look up <xhtml:code>obsoletedBy</xhtml:code> entries for the short identifiers.</xhtml:li>
179+
<xhtml:li>If any <xhtml:code>obsoletedBy</xhtml:code> has an <xhtml:code>expression</xhtml:code> attribute that matches the source, the value of that <xhtml:code>obsoletedBy</xhtml:code> is the recommended replacement for that expression. Otherwise, the value of the <xhtml:code>obsoletedBy</xhtml:code> without an expression attribute is the recommended replacement for the short identifier.</xhtml:li>
180+
</xhtml:ol>
181+
<xhtml:p>
182+
For example, the expression <xhtml:code>GPL-2.0+ WITH GCC-exception-2.0</xhtml:code> could be parsed to either of the following short license identifiers:
183+
</xhtml:p>
184+
<xhtml:ul>
185+
<xhtml:li>
186+
<xhtml:p>
187+
<xhtml:code>GPL-2.0+</xhtml:code>, in which case there would be a single <xhtml:code>obsoletedBy</xhtml:code> with no <xhtml:code>expression</xhtml:code> attribute:
188+
</xhtml:p>
189+
<xhtml:p>
190+
<xhtml:code>&lt;obsoletedBy&gt;GPL-2.0-or-later&lt;/obsoletedBy&gt;</xhtml:code>
191+
</xhtml:p>
192+
<xhtml:p>
193+
So the recommended replacement for <xhtml:code>GPL-2.0+</xhtml:code> would be <xhtml:code>GPL-2.0-or-later</xhtml:code>.
194+
</xhtml:p>
195+
</xhtml:li>
196+
<xhtml:li>
197+
<xhtml:p>
198+
<xhtml:code>GPL-2.0</xhtml:code>, in which case there would be two <xhtml:code>obsoletedBy</xhtml:code> elements:
199+
</xhtml:p>
200+
<xhtml:p>
201+
<xhtml:code>&lt;obsoletedBy&gt;GPL-2.0-only&lt;/obsoletedBy&gt;</xhtml:code><xhtml:br/>
202+
<xhtml:code>&lt;obsoletedBy expression="GPL-2.0+"&gt;GPL-2.0-or-later&lt;/obsoletedBy&gt;</xhtml:code>
203+
</xhtml:p>
204+
<xhtml:p>
205+
The element with <xhtml:code>expression="GPL-2.0+"</xhtml:code> matches the initial license expression, so the recommended replacement for <xhtml:code>GPL-2.0+</xhtml:code> is <xhtml:code>GPL-2.0-or-later</xhtml:code>.
206+
</xhtml:p>
207+
</xhtml:li>
208+
</xhtml:ul>
209+
</documentation>
210+
</annotation>
211+
<attribute name="expression" type="string">
212+
<annotation>
213+
<documentation xml:lang="en">
214+
<xhtml:p>
215+
<xhtml:code>expression</xhtml:code> is the license expression which is obsoleted by the expression contained by the element. Defaults to the bare identifier.
216+
</xhtml:p>
217+
</documentation>
218+
</annotation>
219+
</attribute>
220+
</complexType>
168221
<complexType name="altType" mixed="true">
169222
<annotation>
170223
<documentation xml:lang="en">

0 commit comments

Comments
 (0)