Skip to content

Commit

Permalink
feat: re-add licenses by SPDX identifier, mark shorthand aliases as d…
Browse files Browse the repository at this point in the history
…eprecated

Signed-off-by: Edward Ly <[email protected]>
  • Loading branch information
edward-ly committed Jan 7, 2025
1 parent 9d4e781 commit deadf1d
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 9 deletions.
20 changes: 19 additions & 1 deletion docs/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,25 @@ version
* must be a `semantic version <http://semver.org/>`_ without build metadata, e.g. 9.0.1 or 9.1.0-alpha.1
licence
* required
* must contain **agpl**, **mpl*** and/or **apache** as the only valid values. These refer to the AGPLv3, MPL 2.0 and Apache License 2.0
* can occur multiple times with different licenses
* must contain one of the following licenses (see the `SPDX License List <https://spdx.org/licenses/>`_ for details):

* **AGPL-3.0-only**
* **AGPL-3.0-or-later**
* **Apache-2.0**
* **GPL-3.0-only**
* **GPL-3.0-or-later**
* **MIT**
* **MPL-2.0**

* (deprecated) the following shorthand aliases are also used:

* **agpl** (AGPL-3.0)
* **apache** (Apache-2.0)
* **gpl3** (GPL-3.0)
* **mit** (MIT)
* **mpl** (MPL-2.0)

author
* required
* can occur multiple times with different authors
Expand Down
9 changes: 9 additions & 0 deletions nextcloudappstore/api/v1/release/info.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,15 @@

<xs:simpleType name="licence">
<xs:restriction base="xs:string">
<xs:enumeration value="AGPL-3.0-only"/>
<xs:enumeration value="AGPL-3.0-or-later"/>
<xs:enumeration value="Apache-2.0"/>
<xs:enumeration value="GPL-3.0-only"/>
<xs:enumeration value="GPL-3.0-or-later"/>
<xs:enumeration value="MIT"/>
<xs:enumeration value="MPL-2.0"/>

<!-- Deprecated -->
<xs:enumeration value="agpl"/>
<xs:enumeration value="mit"/>
<xs:enumeration value="mpl"/>
Expand Down
16 changes: 15 additions & 1 deletion nextcloudappstore/api/v1/release/pre-info.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@
<xsl:copy-of select="version"/>
<xsl:for-each select="licence">
<licence>
<xsl:value-of select="translate(., $uppercase, $lowercase)"/>
<!--
convert deprecated shorthand aliases to full SPDX identifiers where possible,
leave agpl/gpl3 aliases as is for now (A/GPL-3.0 are also deprecated and thus not added to list of valid licenses)
-->
<xsl:variable name="licenseAlias" select="translate(., $uppercase, $lowercase)"/>
<xsl:choose>
<xsl:when test="$licenseAlias = 'agpl'">agpl</xsl:when>
<xsl:when test="$licenseAlias = 'apache'">Apache-2.0</xsl:when>
<xsl:when test="$licenseAlias = 'gpl3'">gpl3</xsl:when>
<xsl:when test="$licenseAlias = 'mit'">MIT</xsl:when>
<xsl:when test="$licenseAlias = 'mpl'">MPL-2.0</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</licence>
</xsl:for-each>
<xsl:copy-of select="author"/>
Expand Down
2 changes: 1 addition & 1 deletion nextcloudappstore/api/v1/tests/data/infoxmls/app_api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>AppAPI Skeleton2</name>
<description>Testing info.xml</description>
<version>2.0.0</version>
<licence>AGPL</licence>
<licence>AGPL-3.0-or-later</licence>
<author>Andrey Borysenko</author>
<category>tools</category>
<bugs>https://github.com/cloud-py-api/nc_py_api/issues</bugs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<version>8.8.2</version>

<!-- only the AGPL license is possible -->
<licence>agpl</licence>
<licence>AGPL-3.0-or-later</licence>

<!-- multiple authors are possible, mail and homepage field are optional -->
<author mail="[email protected]" homepage="http://example.com"> Bernhard Posselt</author>
Expand Down
2 changes: 1 addition & 1 deletion nextcloudappstore/api/v1/tests/data/infoxmls/minimal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<summary>An RSS/Atom feed reader</summary>
<description>An RSS/Atom feed reader</description>
<version>8.8.2</version>
<licence>agpl</licence>
<licence>AGPL-3.0-or-later</licence>
<author>Bernhard Posselt</author>
<category>multimedia</category>
<bugs>https://github.com/nextcloud/news/issues</bugs>
Expand Down
2 changes: 1 addition & 1 deletion nextcloudappstore/api/v1/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_parse_minimal(self):
"donations": [],
"release": {
"databases": [],
"licenses": [{"license": {"id": "agpl"}}],
"licenses": [{"license": {"id": "AGPL-3.0-or-later"}}],
"min_int_size": 32,
"php_extensions": [],
"php_max_version": "*",
Expand Down
6 changes: 3 additions & 3 deletions nextcloudappstore/api/v1/tests/test_release_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_import_minimal(self):
self.assertEqual(0, release.shell_commands.count())
self.assertEqual(0, release.shell_commands.count())
self.assertEqual(1, release.licenses.count())
self.assertEqual("agpl", release.licenses.all()[0].id)
self.assertEqual("AGPL-3.0-or-later", release.licenses.all()[0].id)
self.assertEqual(None, release.aa_is_system)

def test_full(self):
Expand Down Expand Up @@ -230,7 +230,7 @@ def test_import_minimal(self):
self.assertEqual(0, release.php_extensions.count())
self.assertEqual(0, release.databases.count())
self.assertEqual(0, release.shell_commands.count())
self.assertEqual("mit", release.licenses.all()[0].id)
self.assertEqual("MIT", release.licenses.all()[0].id)
self.assertEqual(False, release.aa_is_system)
self.assertEqual(1, release.deploy_methods.count())
all_scopes = release.api_scopes.all()
Expand Down Expand Up @@ -275,7 +275,7 @@ def test_full(self):
self.assertEqual("*", release.raw_php_version_spec)
self._assert_all_empty(release, ["signature", "download"])
self.assertEqual(1, release.licenses.count())
self.assertEqual("agpl", release.licenses.all()[0].id)
self.assertEqual("AGPL-3.0-or-later", release.licenses.all()[0].id)
self.assertEqual(True, release.aa_is_system)
self.assertEqual(1, release.deploy_methods.count())
all_scopes = release.api_scopes.all()
Expand Down
49 changes: 49 additions & 0 deletions nextcloudappstore/core/fixtures/licenses.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,53 @@
[
{
"model": "core.license",
"pk": "AGPL-3.0-only",
"fields": {
"name": "GNU Affero General Public License v3.0 only"
}
},
{
"model": "core.license",
"pk": "AGPL-3.0-or-later",
"fields": {
"name": "GNU Affero General Public License v3.0 or later"
}
},
{
"model": "core.license",
"pk": "Apache-2.0",
"fields": {
"name": "Apache License 2.0"
}
},
{
"model": "core.license",
"pk": "GPL-3.0-only",
"fields": {
"name": "GNU General Public License v3.0 only"
}
},
{
"model": "core.license",
"pk": "GPL-3.0-or-later",
"fields": {
"name": "GNU General Public License v3.0 or later"
}
},
{
"model": "core.license",
"pk": "MIT",
"fields": {
"name": "MIT License"
}
},
{
"model": "core.license",
"pk": "MPL-2.0",
"fields": {
"name": "Mozilla Public License 2.0"
}
},
{
"model": "core.license",
"pk": "agpl",
Expand Down

0 comments on commit deadf1d

Please sign in to comment.