Allow to specify supported architectures in appinfo.xml
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
364b96d5b9
commit
04eb1bb949
|
@ -64,6 +64,7 @@ class DependencyAnalyzer {
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_merge(
|
return array_merge(
|
||||||
|
$this->analyzeArchitecture($dependencies),
|
||||||
$this->analyzePhpVersion($dependencies),
|
$this->analyzePhpVersion($dependencies),
|
||||||
$this->analyzeDatabases($dependencies),
|
$this->analyzeDatabases($dependencies),
|
||||||
$this->analyzeCommands($dependencies),
|
$this->analyzeCommands($dependencies),
|
||||||
|
@ -174,6 +175,29 @@ class DependencyAnalyzer {
|
||||||
return $missing;
|
return $missing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function analyzeArchitecture(array $dependencies) {
|
||||||
|
$missing = [];
|
||||||
|
if (!isset($dependencies['architecture'])) {
|
||||||
|
return $missing;
|
||||||
|
}
|
||||||
|
|
||||||
|
$supportedArchitectures = $dependencies['architecture'];
|
||||||
|
if (empty($supportedArchitectures)) {
|
||||||
|
return $missing;
|
||||||
|
}
|
||||||
|
if (!is_array($supportedArchitectures)) {
|
||||||
|
$supportedArchitectures = [$supportedArchitectures];
|
||||||
|
}
|
||||||
|
$supportedArchitectures = array_map(function ($architecture) {
|
||||||
|
return $this->getValue($architecture);
|
||||||
|
}, $supportedArchitectures);
|
||||||
|
$currentArchitecture = $this->platform->getArchitecture();
|
||||||
|
if (!in_array($currentArchitecture, $supportedArchitectures, true)) {
|
||||||
|
$missing[] = (string)$this->l->t('The following architectures are supported: %s', [implode(', ', $supportedArchitectures)]);
|
||||||
|
}
|
||||||
|
return $missing;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $dependencies
|
* @param array $dependencies
|
||||||
* @return array
|
* @return array
|
||||||
|
|
|
@ -97,4 +97,8 @@ class Platform {
|
||||||
$repo = new PlatformRepository();
|
$repo = new PlatformRepository();
|
||||||
return $repo->findLibrary($name);
|
return $repo->findLibrary($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getArchitecture(): string {
|
||||||
|
return php_uname('m');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,10 @@
|
||||||
<xs:selector xpath="dependencies/database"/>
|
<xs:selector xpath="dependencies/database"/>
|
||||||
<xs:field xpath="."/>
|
<xs:field xpath="."/>
|
||||||
</xs:unique>
|
</xs:unique>
|
||||||
|
<xs:unique name="uniqueArchitecture">
|
||||||
|
<xs:selector xpath="dependencies/architecture"/>
|
||||||
|
<xs:field xpath="."/>
|
||||||
|
</xs:unique>
|
||||||
<xs:unique name="uniqueLib">
|
<xs:unique name="uniqueLib">
|
||||||
<xs:selector xpath="dependencies/lib"/>
|
<xs:selector xpath="dependencies/lib"/>
|
||||||
<xs:field xpath="."/>
|
<xs:field xpath="."/>
|
||||||
|
@ -552,6 +556,8 @@
|
||||||
maxOccurs="1"/>
|
maxOccurs="1"/>
|
||||||
<xs:element name="nextcloud" type="nextcloud" minOccurs="1"
|
<xs:element name="nextcloud" type="nextcloud" minOccurs="1"
|
||||||
maxOccurs="1"/>
|
maxOccurs="1"/>
|
||||||
|
<xs:element name="architecture" type="architecture" minOccurs="0"
|
||||||
|
maxOccurs="unbounded"/>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
||||||
|
@ -613,6 +619,15 @@
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
|
|
||||||
|
<xs:simpleType name="architecture">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="x86"/>
|
||||||
|
<xs:enumeration value="x86_64"/>
|
||||||
|
<xs:enumeration value="aarch"/>
|
||||||
|
<xs:enumeration value="aarch64"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
|
||||||
<xs:complexType name="repair-steps">
|
<xs:complexType name="repair-steps">
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="pre-migration" type="steps" minOccurs="0"
|
<xs:element name="pre-migration" type="steps" minOccurs="0"
|
||||||
|
|
Loading…
Reference in New Issue