Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: re-add licenses by SPDX identifier, mark shorthand aliases as deprecated #1560

Merged
merged 8 commits into from
Jan 24, 2025
12 changes: 6 additions & 6 deletions docs/api/restapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ This route will return all releases to display inside Nextcloud's apps admin are
"grep"
],
"phpVersionSpec": ">=5.6.0",
"platformVersionSpec": ">=9.0.0 <9.2.0",
"platformVersionSpec": ">=31.0.0 <33.0.0",
"rawPhpVersionSpec": ">=5.6",
"rawPlatformVersionSpec": ">=10 <=10",
"rawPlatformVersionSpec": ">=31 <=32",
"minIntSize": 64,
"isNightly": false,
"download": "https://github.com/owncloud/news/releases/download/8.8.0/news.tar.gz",
"created": "2016-06-25T16:08:56.796646Z",
"licenses": [
"agpl"
"AGPL-3.0-or-later"
],
"lastModified": "2016-06-25T16:49:25.319425Z",
"signature": "909377e1a695bbaa415c10ae087ae1cc48e88066d20a5a7a8beed149e9fad3d5",
Expand Down Expand Up @@ -572,15 +572,15 @@ This route will return all releases to display inside Nextcloud's apps admin are
"grep"
],
"phpVersionSpec": ">=5.6.0",
"platformVersionSpec": ">=9.0.0 <9.2.0",
"platformVersionSpec": ">=31.0.0 <33.0.0",
"rawPhpVersionSpec": ">=5.6",
"rawPlatformVersionSpec": ">=10 <=10",
"rawPlatformVersionSpec": ">=31 <=32",
"minIntSize": 64,
"isNightly": false,
"download": "https://github.com/owncloud/news/releases/download/8.8.0/news.tar.gz",
"created": "2016-06-25T16:08:56.796646Z",
"licenses": [
"agpl"
"AGPL-3.0-or-later"
],
"lastModified": "2016-06-25T16:49:25.319425Z",
"signature": "909377e1a695bbaa415c10ae087ae1cc48e88066d20a5a7a8beed149e9fad3d5",
Expand Down
28 changes: 23 additions & 5 deletions docs/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ A minimum valid **info.xml** would look like this:
<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>
<dependencies>
<nextcloud min-version="10"/>
<nextcloud min-version="31"/>
</dependencies>
</info>

Expand All @@ -196,7 +196,7 @@ A full blown example would look like this (needs to be utf-8 encoded):
<description lang="en"># Description\nAn RSS/Atom feed reader</description>
<description lang="de"><![CDATA[# Beschreibung\nEine Nachrichten App, welche mit [RSS/Atom](https://en.wikipedia.org/wiki/RSS) umgehen kann]]></description>
<version>8.8.2</version>
<licence>agpl</licence>
<licence>AGPL-3.0-or-later</licence>
<author mail="[email protected]" homepage="http://example.com">Bernhard Posselt</author>
<author>Alessandro Cosentino</author>
<author>Jan-Christoph Borchardt</author>
Expand Down Expand Up @@ -226,7 +226,7 @@ A full blown example would look like this (needs to be utf-8 encoded):
<lib>curl</lib>
<lib>SimpleXML</lib>
<lib>iconv</lib>
<nextcloud min-version="9" max-version="10"/>
<nextcloud min-version="31" max-version="32"/>
</dependencies>
<background-jobs>
<job>OCA\DAV\CardDAV\Sync\SyncJob</job>
Expand Down 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)
edward-ly marked this conversation as resolved.
Show resolved Hide resolved

author
* required
* can occur multiple times with different authors
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ usability.

The basic ideas that form the foundation of the store include:

* Be free and open: The App Store is available under the AGPLv3 or later which offers a strong copyleft so developers can profit from changes made in other versions
* Be free and open: The App Store is available under the AGPL-3.0-or-later license which offers strong copyleft so developers can profit from changes made in other versions

* Be easy to use: The App Store should be easy to use and be built in a way that users can quickly discover the most loved apps. Registration should be as easy as possible and connect users and developers by using e.g. GitHub or BitBucket logins

Expand Down
10 changes: 10 additions & 0 deletions nextcloudappstore/api/v1/release/info.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@

<xs:simpleType name="licence">
<xs:restriction base="xs:string">
<!-- Requires Nextcloud minVersion >= 31 -->
<xs:enumeration value="AGPL-3.0-only"/>
edward-ly marked this conversation as resolved.
Show resolved Hide resolved
<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
4 changes: 2 additions & 2 deletions nextcloudappstore/api/v1/tests/data/infoxmls/app_api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<name>AppAPI Skeleton2</name>
<description>Testing info.xml</description>
<version>2.0.0</version>
<licence>AGPL</licence>
<licence>AGPL-3.0-or-later</licence>
edward-ly marked this conversation as resolved.
Show resolved Hide resolved
<author>Andrey Borysenko</author>
<category>tools</category>
<bugs>https://github.com/cloud-py-api/nc_py_api/issues</bugs>
<dependencies>
<nextcloud min-version="28" max-version="28"/>
<nextcloud min-version="31" max-version="31"/>
</dependencies>
<documentation>
<developer>https://cloud-py-api.github.io/nc_py_api/</developer>
Expand Down
4 changes: 2 additions & 2 deletions nextcloudappstore/api/v1/tests/data/infoxmls/fullimport.xml
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>
edward-ly marked this conversation as resolved.
Show resolved Hide resolved

<!-- multiple authors are possible, mail and homepage field are optional -->
<author mail="[email protected]" homepage="http://example.com"> Bernhard Posselt</author>
Expand Down Expand Up @@ -66,7 +66,7 @@
<lib>iconv</lib>

<!-- version numbers will be padded to three digits with 0 (min-version) and 2^64 (max-version) -->
<nextcloud min-version="9" max-version="10"/>
<nextcloud min-version="31" max-version="32"/>
</dependencies>

<!-- further elements to test if parser ignores non defined fields -->
Expand Down
4 changes: 2 additions & 2 deletions nextcloudappstore/api/v1/tests/data/infoxmls/minimal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<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>
edward-ly marked this conversation as resolved.
Show resolved Hide resolved
<author>Bernhard Posselt</author>
<category>multimedia</category>
<bugs>https://github.com/nextcloud/news/issues</bugs>
<dependencies>
<nextcloud min-version="11" max-version="12"/>
<nextcloud min-version="31" max-version="32"/>
</dependencies>
</info>
10 changes: 5 additions & 5 deletions nextcloudappstore/api/v1/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ 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": "*",
"php_min_version": "*",
"raw_php_max_version": "*",
"raw_php_min_version": "*",
"platform_max_version": "13.0.0",
"platform_min_version": "11.0.0",
"raw_platform_max_version": "12",
"raw_platform_min_version": "11",
"platform_max_version": "33.0.0",
"platform_min_version": "31.0.0",
"raw_platform_max_version": "32",
"raw_platform_min_version": "31",
"shell_commands": [],
"version": "8.8.2",
},
Expand Down
14 changes: 7 additions & 7 deletions nextcloudappstore/api/v1/tests/test_release_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def test_import_minimal(self):
release = app.releases.all()[0]
self.assertEqual(settings.CERTIFICATE_DIGEST, release.signature_digest)
self.assertEqual("8.8.2", release.version)
self.assertEqual(">=11.0.0,<13.0.0", release.platform_version_spec)
self.assertEqual(">=31.0.0,<33.0.0", release.platform_version_spec)
self.assertEqual("*", release.php_version_spec)
self.assertEqual(">=11,<=12", release.raw_platform_version_spec)
self.assertEqual(">=31,<=32", release.raw_platform_version_spec)
self.assertEqual("*", release.raw_php_version_spec)
self.assertEqual(32, release.min_int_size)
self._assert_all_empty(release, ["signature", "download"])
Expand All @@ -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 @@ -269,13 +269,13 @@ def test_full(self):
release = app.releases.all()[0]
self.assertEqual(settings.CERTIFICATE_DIGEST, release.signature_digest)
self.assertEqual("2.0.0", release.version)
self.assertEqual(">=28.0.0,<29.0.0", release.platform_version_spec)
self.assertEqual(">=31.0.0,<32.0.0", release.platform_version_spec)
self.assertEqual("*", release.php_version_spec)
self.assertEqual(">=28,<=28", release.raw_platform_version_spec)
self.assertEqual(">=31,<=31", release.raw_platform_version_spec)
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