Skip to content

Commit

Permalink
schema/ListedLicense: Add obsoletedBy to licenses and exceptions
Browse files Browse the repository at this point in the history
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.  The recommended
consumer algorithm is documented in the schema annotation.

The maxOccurs="unbounded" value shows up in an XSD 1.1 spec example
[2], and both minOccurs and maxOccurs must be set explicitly for
obsoletedBy to override the defaults (1 for both attributes [3]).

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
[4].

[1]: spdx#392 (comment)
[2]: https://www.w3.org/TR/xmlschema11-1/#all-mg
[3]: https://www.w3.org/TR/xmlschema11-1/#declare-element
[4]: spdx#392 (comment)
  • Loading branch information
wking committed Jan 30, 2018
1 parent 0061b49 commit c78a736
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions schema/ListedLicense.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
</documentation>
</annotation>
<all>
<element name="obsoletedBy" type="tns:obsoletedByType" minOccurs="0" maxOccurs="unbounded" />
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/>
<element name="notes" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1"/>
<element name="text" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
Expand All @@ -61,6 +62,7 @@
</documentation>
</annotation>
<all>
<element name="obsoletedBy" type="tns:obsoletedByType" minOccurs="0" maxOccurs="unbounded" />
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/>
<element name="notes" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1">
<annotation>
Expand Down Expand Up @@ -165,6 +167,57 @@
</element>
</sequence>
</complexType>
<complexType name="obsoletedByType" mixed="true">
<annotation>
<documentation xml:lang="en">
<xhtml:p>
<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:
</xhtml:p>
<xhtml:ol>
<xhtml:li>Parse the license expression to extract the short identifiers.</xhtml:li>
<xhtml:li>Look up <xhtml:code>obsoletedBy</xhtml:code> entries for the short identifiers.</xhtml:li>
<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>
</xhtml:ol>
<xhtml:p>
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:
</xhtml:p>
<xhtml:ul>
<xhtml:li>
<xhtml:p>
<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:
</xhtml:p>
<xhtml:p>
<xhtml:code>&lt;obsoletedBy&gt;GPL-2.0-or-later&lt;/obsoletedBy&gt;</xhtml:code>
</xhtml:p>
<xhtml:p>
So the recommended replacement for <xhtml:code>GPL-2.0+</xhtml:code> would be <xhtml:code>GPL-2.0-or-later</xhtml:code>.
</xhtml:p>
</xhtml:li>
<xhtml:li>
<xhtml:p>
<xhtml:code>GPL-2.0</xhtml:code>, in which case there would be two <xhtml:code>obsoletedBy</xhtml:code> elements:
</xhtml:p>
<xhtml:p>
<xhtml:code>&lt;obsoletedBy&gt;GPL-2.0-only&lt;/obsoletedBy&gt;</xhtml:code><xhtml:br/>
<xhtml:code>&lt;obsoletedBy expression="GPL-2.0+"&gt;GPL-2.0-or-later&lt;/obsoletedBy&gt;</xhtml:code>
</xhtml:p>
<xhtml:p>
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>.
</xhtml:p>
</xhtml:li>
</xhtml:ul>
</documentation>
</annotation>
<attribute name="expression" type="string">
<annotation>
<documentation xml:lang="en">
<xhtml:p>
<xhtml:code>expression</xhtml:code> is the license expression which is obsoleted by the expression contained by the element. Defaults to the bare identifier.
</xhtml:p>
</documentation>
</annotation>
</attribute>
</complexType>
<complexType name="altType" mixed="true">
<annotation>
<documentation xml:lang="en">
Expand Down

0 comments on commit c78a736

Please sign in to comment.