summaryrefslogtreecommitdiff
blob: be4ce2073e44ab86fa442d42942ed9113bc821d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
	<xs:element name='repositories'>
		<xs:complexType>
			<xs:choice minOccurs='0' maxOccurs='unbounded'>
				<xs:element name='repo' type='repoType'/>
			</xs:choice>
			<xs:attribute name='version' fixed='1.0' use='required'/>
		</xs:complexType>
		<xs:key name='repoKey'>
			<xs:selector xpath='repo'/>
			<xs:field xpath='name'/>
		</xs:key>
		<xs:unique name='descUniquityConstraint'>
			<xs:selector xpath='description'/>
			<xs:field xpath='@lang'/>
		</xs:unique>
		<xs:unique name='longDescUniquityConstraint'>
			<xs:selector xpath='longdescription'/>
			<xs:field xpath='@lang'/>
		</xs:unique>
		<xs:unique name='homepageSingleConstraint'>
			<xs:selector xpath='homepage'/>
			<xs:field xpath='@fake-only-once'/>
		</xs:unique>
	</xs:element>

	<xs:complexType name='repoType'>
		<xs:choice minOccurs='0' maxOccurs='unbounded'>
			<xs:element name='name' type='repoNameType'/>
			<xs:element name='description' type='descriptionType'/>
			<xs:element name='longdescription' type='descriptionType'/>
			<xs:element name='homepage' type='urlOnceType'/>
			<xs:element name='owner' type='ownerType'/>
			<xs:element name='source' type='sourceType'/>
			<xs:element name='feed' type='urlType'/>
		</xs:choice>
		<xs:attribute name='priority' type='xs:integer'/>
		<xs:attribute name='quality' type='repoQualityAttrType'
			use='required'/>
		<xs:attribute name='status' type='repoStatusAttrType'
			use='required'/>
	</xs:complexType>

	<xs:simpleType name='repoNameType'>
		<xs:restriction base='xs:token'>
			<!-- PMS 3.1.5 Repository Name -->
			<!-- note: this doesn't enforce 'not look like a version'
				 rule -->
			<xs:pattern value='[A-Za-z0-9_][A-Za-z0-9_-]*'/>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name='descriptionType'>
		<xs:simpleContent>
			<xs:extension base='xs:token'>
				<xs:attribute name='lang' type='xs:language' default='en'/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:complexType name='ownerType'>
		<xs:sequence>
			<xs:element name='email' type='emailType'
				minOccurs='1' maxOccurs='1'/>
			<xs:element name='name' type='xs:token'
				minOccurs='0' maxOccurs='1'/>
		</xs:sequence>
		<xs:attribute name='type' type='ownerTypeAttrType'
			use='required'/>
	</xs:complexType>

	<xs:complexType name='sourceType'>
		<xs:simpleContent>
			<xs:extension base='urlType'>
				<xs:attribute name='type' type='sourceTypeAttrType'
					use='required'/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<!-- attributes -->
	<xs:simpleType name='repoQualityAttrType'>
		<xs:restriction base='xs:token'>
			<xs:enumeration value='core'/>
			<xs:enumeration value='stable'/>
			<xs:enumeration value='testing'/>
			<xs:enumeration value='experimental'/>
			<xs:enumeration value='graveyard'/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name='repoStatusAttrType'>
		<xs:restriction base='xs:token'>
			<xs:enumeration value='official'/>
			<xs:enumeration value='unofficial'/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name='ownerTypeAttrType'>
		<xs:restriction base='xs:token'>
			<xs:enumeration value='person'/>
			<xs:enumeration value='project'/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name='sourceTypeAttrType'>
		<xs:restriction base='xs:token'>
			<xs:enumeration value='bzr'/>
			<xs:enumeration value='cvs'/>
			<xs:enumeration value='darcs'/>
			<xs:enumeration value='git'/>
			<xs:enumeration value='mercurial'/>
			<xs:enumeration value='rsync'/>
			<xs:enumeration value='svn'/>
			<xs:enumeration value='tar'/>
		</xs:restriction>
	</xs:simpleType>

	<!-- generic types -->
	<xs:simpleType name='emailType'>
		<xs:restriction base='xs:token'>
			<!-- minimal safe regex -->
			<xs:pattern value="[^@]+@[^.]+\..+"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name='urlType'>
		<xs:restriction base='xs:token'>
			<!-- TODO: something better? -->
			<xs:pattern value="[^:\s]+:\S+"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name='urlOnceType'>
		<xs:simpleContent>
			<xs:extension base="urlType">
				<xs:attribute name='fake-only-once'
					fixed='there can be at most one element of this type'/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
</xs:schema>