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.  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]: spdx#392 (comment)
[2]: spdx#392 (comment)
  • Loading branch information
wking committed Jan 12, 2018
1 parent 0e6a10d commit aaa6190
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions schema/ListedLicense.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<complexType name="ExceptionType" mixed="true">
<choice minOccurs="1" maxOccurs="unbounded">
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/>
<element name="obsoletedBy" type="tns:obsoletedByType">
<element name="notes" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1"/>
<element name="titleText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
<element name="copyrightText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
Expand All @@ -38,6 +39,7 @@
<complexType name="LicenseType" mixed="true">
<choice minOccurs="1" maxOccurs="unbounded">
<element name="crossRefs" type="tns:crossRefsType" minOccurs="0" maxOccurs="1"/>
<element name="obsoletedBy" type="tns:obsoletedByType">
<element name="notes" type="tns:formattedFixedTextType" minOccurs="0" maxOccurs="1"/>
<element name="standardLicenseHeader" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
<element name="titleText" type="tns:formattedAltTextType" minOccurs="0" maxOccurs="1"/>
Expand All @@ -61,6 +63,9 @@
<element name="crossRef" type="string" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="obsoletedByType" mixed="True">
<attribute name="expression" type="string" />
</complexType>
<complexType name="altType" mixed="true">
<group ref="tns:formattedFixedTextGroup" minOccurs="0" maxOccurs="unbounded"/>
<attribute name="name" type="string" use="required" />
Expand Down

0 comments on commit aaa6190

Please sign in to comment.