split checksums/hashes out to their own include file

This commit is contained in:
brent s. 2019-12-12 22:26:08 -05:00
parent f3c5026e28
commit 17ff011a39
7 changed files with 104 additions and 87 deletions

View File

@ -236,4 +236,10 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_aif_script">
<xs:sequence>
<xs:element name="script" type="t_net_generic_resource" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

</xs:schema>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:include schemaLocation="./std.xsd"/>
<xs:include schemaLocation="./net.xsd"/>

<xs:simpleType name="t_cksum_algo">
<!-- Geared towards python. -->
<!-- tuple(sorted(list(hashlib.algorithms_available.union(set(('adler32', 'crc32')))))) -->
<xs:restriction base="xs:string">
<xs:enumeration value="adler32"/>
<xs:enumeration value="blake2b"/>
<xs:enumeration value="blake2s"/>
<xs:enumeration value="crc32"/>
<xs:enumeration value="md4"/>
<xs:enumeration value="md5"/>
<xs:enumeration value="md5-sha1"/>
<xs:enumeration value="mdc2"/>
<xs:enumeration value="ripemd160"/>
<xs:enumeration value="sha1"/>
<xs:enumeration value="sha224"/>
<xs:enumeration value="sha256"/>
<xs:enumeration value="sha384"/>
<xs:enumeration value="sha3_224"/>
<xs:enumeration value="sha3_256"/>
<xs:enumeration value="sha3_384"/>
<xs:enumeration value="sha3_512"/>
<xs:enumeration value="sha512"/>
<xs:enumeration value="sha512_224"/>
<xs:enumeration value="sha512_256"/>
<xs:enumeration value="shake_128"/>
<xs:enumeration value="shake_256"/>
<xs:enumeration value="sm3"/>
<xs:enumeration value="whirlpool"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_cksum_file">
<xs:simpleContent>
<xs:extension base="t_net_generic_resource">
<xs:attribute name="hashType" use="required" type="t_cksum_algo"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="t_cksum_hash">
<xs:simpleContent>
<xs:extension base="t_std_nonempty">
<xs:attribute name="hashType" use="required" type="t_cksum_algo"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="t_cksum_verify">
<xs:sequence>
<xs:element name="checksum" minOccurs="0" maxOccurs="unbounded" type="t_cksum_hash"/>
<xs:element name="checksumFile" minOccurs="0" maxOccurs="unbounded" type="t_cksum_file"/>
</xs:sequence>
</xs:complexType>

</xs:schema>

View File

@ -9,7 +9,7 @@
<xs:complexType name="t_gpg_keys">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="keyID" minOccurs="0" maxOccurs="unbounded" type="t_gpg_key_id"/>
<xs:element name="keyFile" minOccurs="0" maxOccurs="unbounded" type="t_std_uri"/>
<xs:element name="keyFile" minOccurs="0" maxOccurs="unbounded" type="t_net_generic_resource"/>
</xs:choice>
</xs:complexType>

@ -40,7 +40,8 @@
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="signature" minOccurs="0" maxOccurs="unbounded" type="t_gpg_sig"/>
<xs:element name="signatureFile" minOccurs="0" maxOccurs="unbounded" type="t_std_uri"/>
<xs:element name="signatureFile" minOccurs="0" maxOccurs="unbounded"
type="t_net_generic_resource"/>
</xs:choice>
</xs:complexType>
<xs:unique name="uniq_gpg_sig">

View File

@ -57,12 +57,34 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_net_ftp_resource">
<xs:simpleContent>
<xs:extension base="t_std_uri">
<xs:attribute name="user" type="t_std_nonempty" use="optional" default="anonymous"/>
<xs:attribute name="password" type="t_std_nonempty" use="optional"/>
<!-- This should be handled in-application by looking at the scheme in the URI itself. -->
<!-- <xs:attribute name="startTLS" type="xs:boolean" use="optional" default="false"/> -->
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="t_net_generic_resource">
<xs:simpleContent>
<xs:extension base="t_std_uri">
<xs:attribute name="user" type="t_std_nonempty" use="optional"/>
<xs:attribute name="password" type="t_std_nonempty" use="optional"/><!-- If FTP & none, "anonymous" -->
<!-- This should be handled in-application by looking at the scheme in the URI itself. -->
<!-- <xs:attribute name="startTLS" type="xs:boolean" use="optional" default="false"/> --><!-- FTP -->
<xs:attribute name="authType" type="t_net_authselect" use="optional" default="none"/><!-- HTTP(S) -->
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="t_net_http_resource">
<xs:simpleContent>
<xs:extension base="t_std_uri">
<xs:attribute name="user" type="t_std_nonempty" use="optional"/>
<xs:attribute name="password" type="t_std_nonempty" use="optional"/>
<xs:attribute name="realm" type="t_std_nonempty" use="optional"/>
<xs:attribute name="authtype" type="t_net_authselect" use="optional" default="none"/>
</xs:extension>
</xs:simpleContent>

View File

@ -10,54 +10,6 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_std_cksum">
<xs:simpleContent>
<xs:extension base="t_std_nonempty">
<xs:attribute name="hashType" use="required" type="t_std_cksum_hashtypes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="t_std_cksum_file">
<xs:simpleContent>
<xs:extension base="t_std_uri">
<xs:attribute name="hashType" use="required" type="t_std_cksum_hashtypes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:simpleType name="t_std_cksum_hashtypes">
<!-- Geared towards python. -->
<!-- tuple(sorted(list(hashlib.algorithms_available.union(set(('adler32', 'crc32')))))) -->
<xs:restriction base="xs:string">
<xs:enumeration value="adler32"/>
<xs:enumeration value="blake2b"/>
<xs:enumeration value="blake2s"/>
<xs:enumeration value="crc32"/>
<xs:enumeration value="md4"/>
<xs:enumeration value="md5"/>
<xs:enumeration value="md5-sha1"/>
<xs:enumeration value="mdc2"/>
<xs:enumeration value="ripemd160"/>
<xs:enumeration value="sha1"/>
<xs:enumeration value="sha224"/>
<xs:enumeration value="sha256"/>
<xs:enumeration value="sha384"/>
<xs:enumeration value="sha3_224"/>
<xs:enumeration value="sha3_256"/>
<xs:enumeration value="sha3_384"/>
<xs:enumeration value="sha3_512"/>
<xs:enumeration value="sha512"/>
<xs:enumeration value="sha512_224"/>
<xs:enumeration value="sha512_256"/>
<xs:enumeration value="shake_128"/>
<xs:enumeration value="shake_256"/>
<xs:enumeration value="sm3"/>
<xs:enumeration value="whirlpool"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_std_cmdopts">
<xs:simpleContent>
<xs:extension base="xs:string">
@ -84,11 +36,4 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_std_verify_cksum">
<xs:sequence>
<xs:element name="checksum" minOccurs="0" maxOccurs="unbounded" type="t_std_cksum"/>
<xs:element name="checksumFile" minOccurs="0" maxOccurs="unbounded" type="t_std_cksum_file"/>
</xs:sequence>
</xs:complexType>

</xs:schema>

View File

@ -4,7 +4,7 @@
attributeFormDefault="unqualified">

<xs:include schemaLocation="./gpg.xsd"/>
<xs:include schemaLocation="./std.xsd"/>
<xs:include schemaLocation="./cksum.xsd"/>
<xs:simpleType name="t_sys_diskfmt">
<xs:restriction base="xs:token">
@ -20,7 +20,7 @@
<xs:choice minOccurs="1" maxOccurs="2">
<xs:element name="gpg" minOccurs="0" maxOccurs="1" type="t_gpg_verify">
</xs:element>
<xs:element name="hash" minOccurs="0" maxOccurs="1" type="t_std_verify_cksum"/>
<xs:element name="hash" minOccurs="0" maxOccurs="1" type="t_cksum_verify"/>
</xs:choice>
</xs:complexType>


View File

@ -16,7 +16,7 @@
<xs:element name="bootstrap" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="tarball" minOccurs="1" maxOccurs="1" type="t_std_uri"/>
<xs:element name="tarball" minOccurs="1" maxOccurs="1" type="t_net_generic_resource"/>
<xs:element name="verify" minOccurs="0" maxOccurs="1" type="t_sys_verifyfile"/>
</xs:all>
</xs:complexType>
@ -271,32 +271,11 @@
<!--- BEGIN SCRIPTS -->
<xs:element name="scripts" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="pre" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="script" minOccurs="1" maxOccurs="unbounded"
type="t_net_http_resource"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="post" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="script" minOccurs="1" maxOccurs="unbounded"
type="t_net_http_resource"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pkg" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="script" minOccurs="1" maxOccurs="unbounded"
type="t_net_http_resource"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="pre" minOccurs="0" maxOccurs="unbounded" type="t_aif_script"/>
<xs:element name="pkg" minOccurs="0" maxOccurs="unbounded" type="t_aif_script"/>
<xs:element name="post" minOccurs="0" maxOccurs="unbounded" type="t_aif_script"/>
</xs:choice>
</xs:complexType>
</xs:element>
<!-- END SCRIPTS -->