Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Bump char fields to maximum of 256 chars since description/summary fi…
…elds prevented apps from being uploaded
  • Loading branch information
Bernhard Posselt committed Aug 3, 2016
commit e43ba1df9a51ac1c8c9d1ebab9deebbfabbc170b
2 changes: 1 addition & 1 deletion docs/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ dependencies/lib
* can occur multiple times with different php extensions
* can contain a **min-version** attribute (maximum 3 digits separated by dots)
* can contain a **max-version** attribute (maximum 3 digits separated by dots)
dependencies/owncloud
dependencies/nextcloud
* required
* must contain a **min-version** attribute (maximum 3 digits separated by dots)
* can contain a **max-version** attribute (maximum 3 digits separated by dots)
Expand Down
4 changes: 2 additions & 2 deletions nextcloudappstore/core/api/v1/release/info.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,12 @@
maxOccurs="unbounded"/>
<xs:element name="lib" type="min-max-version" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="owncloud" type="owncloud" minOccurs="1"
<xs:element name="nextcloud" type="nextcloud" minOccurs="1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min === 0 ?

Copy link
Member Author

@BernhardPosselt BernhardPosselt Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimum version is required (also in core afaik)

provided owncloud tags are migrated to nextcloud tags, that way there will always be a nextcloud tag if set properly

maxOccurs="1"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="owncloud">
<xs:complexType name="nextcloud">
<xs:attribute name="min-version" type="version" use="required"/>
<xs:attribute name="max-version" type="version" use="optional"/>
</xs:complexType>
Expand Down
4 changes: 2 additions & 2 deletions nextcloudappstore/core/api/v1/release/info.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@
</xsl:otherwise>
</xsl:choose>
<platform-min-version type="min-version">
<xsl:value-of select="owncloud/@min-version"/>
<xsl:value-of select="nextcloud/@min-version"/>
</platform-min-version>
<platform-max-version type="max-version">
<xsl:value-of select="owncloud/@max-version"/>
<xsl:value-of select="nextcloud/@max-version"/>
</platform-max-version>

<php-extensions type="list">
Expand Down
45 changes: 44 additions & 1 deletion nextcloudappstore/core/api/v1/release/pre-info.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,50 @@
<xsl:copy-of select="database"/>
<xsl:copy-of select="command"/>
<xsl:copy-of select="lib"/>
<xsl:copy-of select="owncloud"/>
<xsl:copy-of select="nextcloud"/>
<xsl:if test="not(nextcloud)">
<xsl:variable name="min" select="owncloud/@min-version[.='9.0' or '9.1' or '9.2']"/>
<xsl:variable name="max" select="owncloud/@max-version[.='9.0' or '9.1' or '9.2']"/>
<!-- if someone knows a better way to do this in xslt 1.0 feel free to patch it :) -->
<xsl:if test="$min or $max">
<nextcloud>
<xsl:choose>
<xsl:when test="$min = '9.0'">
<xsl:attribute name="min-version">
<xsl:value-of select="$min"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$min = '9.1'">
<xsl:attribute name="min-version">
<xsl:value-of select="10"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$min = '9.2'">
<xsl:attribute name="min-version">
<xsl:value-of select="11"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="$max = '9.0'">
<xsl:attribute name="max-version">
<xsl:value-of select="$max"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$max = '9.1'">
<xsl:attribute name="max-version">
<xsl:value-of select="10"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$max = '9.2'">
<xsl:attribute name="max-version">
<xsl:value-of select="11"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</nextcloud>
</xsl:if>
</xsl:if>
</dependencies>
</xsl:template>
</xsl:stylesheet>
15 changes: 15 additions & 0 deletions nextcloudappstore/core/api/v1/tests/data/infoxmls/nextcloud.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../release/info.xsd">
<id>news</id>
<name>News</name>
<summary>An RSS/Atom feed reader</summary>
<description>An RSS/Atom feed reader</description>
<version>8.8.2</version>
<licence>agpl</licence>
<author>Bernhard Posselt</author>
<category>multimedia</category>
<dependencies>
<nextcloud min-version="10" max-version="11"/>
<owncloud min-version="9.0" max-version="9.1"/>
</dependencies>
</info>
14 changes: 14 additions & 0 deletions nextcloudappstore/core/api/v1/tests/data/infoxmls/transform.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../release/info.xsd">
<id>news</id>
<name>News</name>
<summary>An RSS/Atom feed reader</summary>
<description>An RSS/Atom feed reader</description>
<version>8.8.2</version>
<licence>agpl</licence>
<author>Bernhard Posselt</author>
<category>multimedia</category>
<dependencies>
<owncloud min-version="9.1" max-version="9.2"/>
</dependencies>
</info>
22 changes: 21 additions & 1 deletion nextcloudappstore/core/api/v1/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ def test_parse_minimal(self):
}}
self.assertDictEqual(expected, result)

def test_parse_minimal_transform(self):
xml = self._get_test_xml('data/infoxmls/transform.xml')
result = parse_app_metadata(xml, self.config.info_schema,
self.config.pre_info_xslt,
self.config.info_xslt)
min_version = result['app']['release']['platform_min_version']
max_version = result['app']['release']['platform_max_version']
self.assertEqual('10.0.0', min_version)
self.assertEqual('12.0.0', max_version)

def test_parse_minimal_nextcloud(self):
xml = self._get_test_xml('data/infoxmls/nextcloud.xml')
result = parse_app_metadata(xml, self.config.info_schema,
self.config.pre_info_xslt,
self.config.info_xslt)
min_version = result['app']['release']['platform_min_version']
max_version = result['app']['release']['platform_max_version']
self.assertEqual('10.0.0', min_version)
self.assertEqual('12.0.0', max_version)

def test_validate_schema(self):
xml = self._get_test_xml('data/infoxmls/invalid.xml')
with (self.assertRaises(InvalidAppMetadataXmlException)):
Expand Down Expand Up @@ -246,7 +266,7 @@ def test_map_data(self):
],
'php_max_version': '*',
'php_min_version': '5.6.0',
'platform_max_version': '9.2.0',
'platform_max_version': '11.0.0',
'platform_min_version': '9.0.0',
'shell_commands': [
{'shell_command': {'name': 'grep'}},
Expand Down