Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 4/4] tests: Include metadata.xsd for repoman tests
Date: Sun, 17 Apr 2016 08:07:18
Message-Id: 1460880389-13222-5-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 0/4] GLEP 67 + XML Schema, rebased against repoman by "Michał Górny"
1 ---
2 .travis.yml | 4 +-
3 MANIFEST.in | 2 +-
4 cnf/metadata.dtd | 102 ------
5 cnf/metadata.xsd | 547 +++++++++++++++++++++++++++++++
6 pym/portage/tests/repoman/test_simple.py | 8 +-
7 5 files changed, 554 insertions(+), 109 deletions(-)
8 delete mode 100644 cnf/metadata.dtd
9 create mode 100644 cnf/metadata.xsd
10
11 diff --git a/.travis.yml b/.travis.yml
12 index b662d94..5213fee 100644
13 --- a/.travis.yml
14 +++ b/.travis.yml
15 @@ -8,8 +8,8 @@ python:
16 script:
17 - ./setup.py test
18 - ./setup.py install --root=/tmp/install-root
19 - # prevent repoman tests from trying to fetch metadata.dtd
20 + # prevent repoman tests from trying to fetch metadata.xsd
21 - mkdir -p /tmp/install-root/usr/lib/portage/cnf
22 - - cp cnf/metadata.dtd /tmp/install-root/usr/lib/portage/cnf/
23 + - cp cnf/metadata.xsd /tmp/install-root/usr/lib/portage/cnf/
24 - sudo rsync -a /tmp/install-root/. /
25 - python -b -Wd -m portage.tests.runTests
26 diff --git a/MANIFEST.in b/MANIFEST.in
27 index d65c874..2178460 100644
28 --- a/MANIFEST.in
29 +++ b/MANIFEST.in
30 @@ -12,7 +12,7 @@ include cnf/make.conf.example.*
31
32 # extra files for tests
33 include .portage_not_installed
34 -include cnf/metadata.dtd
35 +include cnf/metadata.xsd
36
37 # extra scripts
38 include misc/*
39 diff --git a/cnf/metadata.dtd b/cnf/metadata.dtd
40 deleted file mode 100644
41 index ff2649c..0000000
42 --- a/cnf/metadata.dtd
43 +++ /dev/null
44 @@ -1,102 +0,0 @@
45 -<!ELEMENT packages ( pkgmetadata* )>
46 -
47 -<!-- Metadata for a category -->
48 -<!ELEMENT catmetadata ( (longdescription)* )>
49 -<!ATTLIST catmetadata pkgname CDATA "">
50 -
51 -<!-- Metadata for a package -->
52 -<!ELEMENT pkgmetadata ( (herd|maintainer|natural-name|longdescription|use|upstream)* )>
53 -<!ATTLIST pkgmetadata pkgname CDATA "">
54 -
55 - <!-- One tag for each herd this package is assigned to. -->
56 - <!ELEMENT herd (#PCDATA)>
57 -
58 - <!-- One tag for each maintainer of a package, multiple allowed-->
59 - <!ELEMENT maintainer ( email, (description| name)* )>
60 -
61 - <!-- Natural name for package, example: LibreOffice (for app-office/libreoffice) -->
62 - <!ELEMENT natural-name (#PCDATA) >
63 -
64 - <!-- A long description of the package in freetext-->
65 - <!ELEMENT longdescription (#PCDATA|pkg|cat)* >
66 -
67 - <!-- The changelog of the package-->
68 - <!-- Please note that #PCDATA is mentioned only for the upstream changelog
69 - element, where the content is a URL. This is due to limitations of the DTD -->
70 - <!ELEMENT changelog (#PCDATA|change)* >
71 - <!-- The changelog contains various "changes"-->
72 - <!ELEMENT change (date,(developer|version|description|file|contributor|bug)*) >
73 - <!ELEMENT date (#PCDATA) >
74 - <!-- The date of the change, in "YYYY-MM-DD" format -->
75 - <!ELEMENT developer (name?,email) >
76 - <!-- The developer that made the change. The email is required, name
77 - is optional-->
78 - <!ELEMENT version (#PCDATA) >
79 - <!--version of the packages involved (one tag per version)-->
80 - <!ELEMENT file (#PCDATA) ><!-- one tag per file touched -->
81 - <!ELEMENT contributor (name?,email?) >
82 - <!-- A reference to a user that helped in causing this change.
83 - There should at least be a name or email address included.
84 - Email is preferred -->
85 - <!ELEMENT bug (#PCDATA) >
86 - <!-- bug-id of a bug fixed by this change, multiple allowed. The
87 - format of this is a number or alias for a bug. NOT including a
88 - # character -->
89 -
90 - <!-- description of what this USE flag does for this package -->
91 - <!ELEMENT use (flag)* >
92 - <!ELEMENT flag (#PCDATA|pkg|cat)* >
93 - <!-- name attribute holds the name of the USE flag -->
94 - <!ATTLIST flag name CDATA #REQUIRED >
95 -
96 - <!-- upstream metadata information (maintainers, upstream docs,..) -->
97 - <!ELEMENT upstream (maintainer|changelog|doc|bugs-to|remote-id)* >
98 - <!-- Due to the limitation of DTD this will also allow a status
99 - attribute for the package maintainer element. Please note that
100 - the usage of the status attribute is nevertheless _only_ allowed
101 - in the upstream maintainer element. -->
102 - <!ATTLIST maintainer status (active|inactive|unknown) "unknown" >
103 - <!-- URL where the location of the upstream documentation can be found -->
104 - <!ELEMENT doc (#PCDATA)>
105 - <!ATTLIST doc lang CDATA "C" >
106 - <!-- location where to report bugs
107 - (may also be an email address prefixed with mailto:) -->
108 - <!ELEMENT bugs-to (#PCDATA)>
109 - <!-- specify a type of package identification tracker -->
110 - <!ELEMENT remote-id (#PCDATA)>
111 - <!ATTLIST remote-id type (bitbucket|cpan|cpan-module|cpe|cran|ctan|freecode|freshmeat|github|gitorious|google-code|launchpad|pear|pecl|pypi|rubyforge|rubygems|sourceforge|sourceforge-jp|vim) #REQUIRED>
112 -
113 - <!-- category/package information for cross-linking in descriptions
114 - and useflag descriptions -->
115 - <!ELEMENT pkg (#PCDATA) >
116 - <!ELEMENT cat (#PCDATA) >
117 -
118 -<!-- Common attributes -->
119 -
120 -<!-- the lang attribute, specifies the language of this tag. This is
121 - only useful for descriptions of various kinds. If a tag with this
122 - attribute is included there must be a description in the default
123 - language "C" or "en", which is equivalent -->
124 - <!ATTLIST description lang CDATA "C" >
125 - <!ATTLIST longdescription lang CDATA "C" >
126 - <!ATTLIST use lang CDATA "C" >
127 -
128 -<!-- The restrict attribute, this attribute specifies restrictions on
129 - the applicability of tags on versions. The format of this attribute is
130 - equal to the format of DEPEND lines in ebuilds. There is one special
131 - value though: restrict="*". A tag that specifies this only applies if
132 - there are no other tags that apply.
133 -
134 - For required tags, there must be either an unrestricted version, or a
135 - version that is default restricted. -->
136 - <!ATTLIST herd restrict CDATA #IMPLIED >
137 - <!ATTLIST maintainer restrict CDATA #IMPLIED >
138 - <!ATTLIST longdescription restrict CDATA #IMPLIED >
139 - <!ATTLIST flag restrict CDATA #IMPLIED >
140 -
141 -
142 -
143 -<!-- standard parts -->
144 -<!ELEMENT email (#PCDATA) ><!-- an email address -->
145 -<!ELEMENT name (#PCDATA) ><!-- the name of a person (maintainer, contributor)-->
146 -<!ELEMENT description (#PCDATA) ><!-- A description of a maintainer or change-->
147 diff --git a/cnf/metadata.xsd b/cnf/metadata.xsd
148 new file mode 100644
149 index 0000000..0ead09e
150 --- /dev/null
151 +++ b/cnf/metadata.xsd
152 @@ -0,0 +1,547 @@
153 +<?xml version='1.0' encoding='UTF-8'?>
154 +
155 +<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
156 + <!-- top-level variants -->
157 + <xs:element name='pkgmetadata' type='pkgMetadataType'>
158 + <!-- note: restrict uniquity rules are simplified
159 + the spec says: one for each matched package
160 + we can only do: one for each restrict rule -->
161 + <xs:unique name='longDescUniquityConstraint'>
162 + <xs:selector xpath='longdescription'/>
163 + <xs:field xpath='@lang'/>
164 + <xs:field xpath='@restrict'/>
165 + </xs:unique>
166 + <xs:unique name='maintainerUniquityConstraint'>
167 + <xs:selector xpath='maintainer'/>
168 + <xs:field xpath='email'/>
169 + <xs:field xpath='@restrict'/>
170 + </xs:unique>
171 + <xs:unique name='slotsUniquityConstraint'>
172 + <xs:selector xpath='slots'/>
173 + <xs:field xpath='@lang'/>
174 + </xs:unique>
175 + <xs:unique name='upstreamSingleConstraint'>
176 + <xs:selector xpath='upstream'/>
177 + <xs:field xpath='@fake-only-once'/>
178 + </xs:unique>
179 + <xs:unique name='useUniquityConstraint'>
180 + <xs:selector xpath='use'/>
181 + <xs:field xpath='@lang'/>
182 + </xs:unique>
183 + </xs:element>
184 + <xs:element name='catmetadata' type='catMetadataType'>
185 + <xs:unique name='catLongDescUniquityConstraint'>
186 + <xs:selector xpath='longdescription'/>
187 + <xs:field xpath='@lang'/>
188 + </xs:unique>
189 + </xs:element>
190 +
191 + <!-- global elements -->
192 + <xs:complexType name='pkgMetadataType'>
193 + <xs:choice minOccurs='0' maxOccurs='unbounded'>
194 + <xs:element name='longdescription' type='longDescType'/>
195 + <xs:element name='maintainer' type='maintainerType'>
196 + <xs:unique name='maintainerDescUniquityConstraint'>
197 + <xs:selector xpath='description'/>
198 + <xs:field xpath='@lang'/>
199 + </xs:unique>
200 + </xs:element>
201 + <xs:element name='slots' type='slotsType'>
202 + <xs:unique name='slotUniquityConstraint'>
203 + <xs:selector xpath='slot'/>
204 + <xs:field xpath='@name'/>
205 + </xs:unique>
206 + <xs:unique name='subslotsSingleConstraint'>
207 + <xs:selector xpath='subslots'/>
208 + <xs:field xpath='@fake-only-once'/>
209 + </xs:unique>
210 + </xs:element>
211 + <xs:element name='upstream' type='upstreamType'>
212 + <xs:unique name='bugsToSingleConstraint'>
213 + <xs:selector xpath='bugs-to'/>
214 + <xs:field xpath='@fake-only-once'/>
215 + </xs:unique>
216 + <xs:unique name='changelogSingleConstraint'>
217 + <xs:selector xpath='changelog'/>
218 + <xs:field xpath='@fake-only-once'/>
219 + </xs:unique>
220 + <!-- prevent accidentally repeating the same remote -->
221 + <xs:unique name='upstreamRemoteIdRepetitionConstraint'>
222 + <xs:selector xpath='remote-id'/>
223 + <xs:field xpath='@type'/>
224 + <xs:field xpath='.'/>
225 + </xs:unique>
226 + <xs:unique name='upstreamDocUniquityConstraint'>
227 + <xs:selector xpath='doc'/>
228 + <xs:field xpath='@lang'/>
229 + </xs:unique>
230 + </xs:element>
231 + <xs:element name='use' type='useType'>
232 + <xs:unique name='flagUniquityConstraint'>
233 + <xs:selector xpath='flag'/>
234 + <xs:field xpath='@name'/>
235 + <xs:field xpath='@restrict'/>
236 + </xs:unique>
237 + </xs:element>
238 + </xs:choice>
239 + </xs:complexType>
240 +
241 + <xs:complexType name='catMetadataType'>
242 + <xs:choice minOccurs='0' maxOccurs='unbounded'>
243 + <xs:element name='longdescription' type='catLongDescType'/>
244 + </xs:choice>
245 + </xs:complexType>
246 +
247 + <!-- the huge <upstream/> structure -->
248 + <xs:complexType name='upstreamType'>
249 + <xs:choice minOccurs='0' maxOccurs='unbounded'>
250 + <xs:element name='maintainer' type='upstreamMaintainerType'>
251 + <xs:unique name='upstreamMaintainerUniquityConstraint'>
252 + <xs:selector xpath='maintainer'/>
253 + <xs:field xpath='name'/>
254 + </xs:unique>
255 + </xs:element>
256 + <xs:element name='changelog' type='urlOnceType'/>
257 + <xs:element name='doc' type='upstreamDocType'/>
258 + <xs:element name='bugs-to' type='urlOnceType'/>
259 + <xs:element name='remote-id' type='upstreamRemoteIdType'/>
260 + </xs:choice>
261 + <xs:attribute name='fake-only-once'
262 + fixed='there can be at most one &lt;upstream/&gt; element'/>
263 + </xs:complexType>
264 +
265 + <!-- maintainer in two variants -->
266 + <xs:complexType name='maintainerType'>
267 + <xs:all>
268 + <xs:element name='email' type='emailType'
269 + minOccurs='1'/>
270 + <xs:element name='name' type='xs:token'
271 + minOccurs='0'/>
272 + <xs:element name='description' type='maintainerDescType'
273 + minOccurs='0'/>
274 + </xs:all>
275 + <xs:attribute name='type' type='maintainerTypeAttrType'
276 + use='required'/>
277 + <xs:attribute name='restrict' type='restrictAttrType'/>
278 + </xs:complexType>
279 +
280 + <xs:simpleType name='maintainerTypeAttrType'>
281 + <xs:restriction base='xs:token'>
282 + <xs:enumeration value='person'/>
283 + <xs:enumeration value='project'/>
284 + </xs:restriction>
285 + </xs:simpleType>
286 +
287 + <xs:complexType name='upstreamMaintainerType'>
288 + <xs:all>
289 + <xs:element name='email' type='emailType'
290 + minOccurs='0'/>
291 + <xs:element name='name' type='xs:token'
292 + minOccurs='0'/>
293 + </xs:all>
294 + <xs:attribute name='status' type='upstreamMaintainerStatusAttrType'
295 + default='unknown'/>
296 + </xs:complexType>
297 +
298 + <xs:simpleType name='upstreamMaintainerStatusAttrType'>
299 + <xs:restriction base='xs:token'>
300 + <xs:enumeration value='active'/>
301 + <xs:enumeration value='inactive'/>
302 + <xs:enumeration value='unknown'/>
303 + </xs:restriction>
304 + </xs:simpleType>
305 +
306 + <xs:complexType name='maintainerDescType'>
307 + <xs:simpleContent>
308 + <xs:extension base="xs:token">
309 + <xs:attribute name='lang' type='langAttrType' default='en'/>
310 + </xs:extension>
311 + </xs:simpleContent>
312 + </xs:complexType>
313 +
314 + <!-- long description -->
315 + <xs:complexType name='longDescType' mixed='true'>
316 + <xs:choice minOccurs='0' maxOccurs='unbounded'>
317 + <xs:element name='pkg' type='pkgType'/>
318 + <xs:element name='cat' type='catType'/>
319 + </xs:choice>
320 + <xs:attribute name='lang' type='langAttrType' default='en'/>
321 + <xs:attribute name='restrict' type='restrictAttrType'/>
322 + </xs:complexType>
323 +
324 + <xs:complexType name='catLongDescType' mixed='true'>
325 + <xs:choice minOccurs='0' maxOccurs='unbounded'>
326 + <xs:element name='pkg' type='pkgType'/>
327 + <xs:element name='cat' type='catType'/>
328 + </xs:choice>
329 + <xs:attribute name='lang' type='langAttrType' default='en'/>
330 + </xs:complexType>
331 +
332 + <!-- slots -->
333 + <xs:complexType name='slotsType'>
334 + <xs:choice minOccurs='0' maxOccurs='unbounded'>
335 + <xs:element name='slot' type='slotType'/>
336 + <xs:element name='subslots' type='tokenOnceType'/>
337 + </xs:choice>
338 + <xs:attribute name='lang' type='langAttrType' default='en'/>
339 + </xs:complexType>
340 +
341 + <xs:complexType name='slotType'>
342 + <xs:simpleContent>
343 + <xs:extension base="xs:token">
344 + <xs:attribute name='name' type='slotNameAttrType'
345 + use='required'/>
346 + </xs:extension>
347 + </xs:simpleContent>
348 + </xs:complexType>
349 +
350 + <xs:simpleType name='slotNameAttrType'>
351 + <xs:restriction base='xs:token'>
352 + <!-- PMS 3.1.3 Slot Names + special value '*' -->
353 + <xs:pattern value="[A-Za-z0-9_][A-Za-z0-9+_.-]*|[*]"/>
354 + </xs:restriction>
355 + </xs:simpleType>
356 +
357 + <!-- use flags -->
358 + <xs:complexType name='useType'>
359 + <xs:choice minOccurs='0' maxOccurs='unbounded'>
360 + <xs:element name='flag' type='flagType'/>
361 + </xs:choice>
362 + <xs:attribute name='lang' type='langAttrType' default='en'/>
363 + </xs:complexType>
364 +
365 + <xs:complexType name='flagType' mixed='true'>
366 + <xs:choice minOccurs='0' maxOccurs='unbounded'>
367 + <xs:element name='cat' type='catType'/>
368 + <xs:element name='pkg' type='pkgType'/>
369 + </xs:choice>
370 + <xs:attribute name='name' type='flagNameAttrType'
371 + use='required'/>
372 + <xs:attribute name='restrict' type='restrictAttrType'
373 + default=''/>
374 + </xs:complexType>
375 +
376 + <xs:simpleType name='flagNameAttrType'>
377 + <xs:restriction base='xs:token'>
378 + <!-- PMS 3.1.4 USE Flag Names -->
379 + <xs:pattern value="[A-Za-z0-9][A-Za-z0-9+_@-]*"/>
380 + </xs:restriction>
381 + </xs:simpleType>
382 +
383 + <!-- upstream-specific types -->
384 + <xs:complexType name='upstreamDocType'>
385 + <xs:simpleContent>
386 + <xs:extension base="urlType">
387 + <xs:attribute name='lang' type='langAttrType' default='en'/>
388 + </xs:extension>
389 + </xs:simpleContent>
390 + </xs:complexType>
391 +
392 + <xs:complexType name='upstreamRemoteIdType'>
393 + <xs:simpleContent>
394 + <xs:extension base="xs:token">
395 + <xs:attribute name='type' type='upstreamRemoteIdTypeAttrType'
396 + use='required'/>
397 + </xs:extension>
398 + </xs:simpleContent>
399 + </xs:complexType>
400 +
401 + <xs:simpleType name='upstreamRemoteIdTypeAttrType'>
402 + <xs:restriction base='xs:token'>
403 + <xs:enumeration value='bitbucket'/>
404 + <xs:enumeration value='cpan'/>
405 + <xs:enumeration value='cpan-module'/>
406 + <xs:enumeration value='cpe'/>
407 + <xs:enumeration value='cran'/>
408 + <xs:enumeration value='ctan'/>
409 + <xs:enumeration value='freecode'/>
410 + <xs:enumeration value='freshmeat'/>
411 + <xs:enumeration value='github'/>
412 + <xs:enumeration value='gitlab'/>
413 + <xs:enumeration value='gitorious'/>
414 + <xs:enumeration value='google-code'/>
415 + <xs:enumeration value='launchpad'/>
416 + <xs:enumeration value='pear'/>
417 + <xs:enumeration value='pecl'/>
418 + <xs:enumeration value='pypi'/>
419 + <xs:enumeration value='rubyforge'/>
420 + <xs:enumeration value='rubygems'/>
421 + <xs:enumeration value='sourceforge'/>
422 + <xs:enumeration value='sourceforge-jp'/>
423 + <xs:enumeration value='vim'/>
424 + </xs:restriction>
425 + </xs:simpleType>
426 +
427 + <!-- creepy mixed-text types -->
428 + <xs:simpleType name='catType'>
429 + <xs:restriction base='xs:token'>
430 + <!-- PMS 3.1.1 Category Names -->
431 + <xs:pattern value="[A-Za-z0-9_][A-Za-z0-9+_.-]*"/>
432 + </xs:restriction>
433 + </xs:simpleType>
434 + <xs:simpleType name='pkgType'>
435 + <xs:restriction base='xs:token'>
436 + <!-- PMS 3.1.1 Category Names + 3.1.2 Package Names -->
437 + <!-- note: this does not enforce the 'anything matching
438 + the version syntax' requirement -->
439 + <xs:pattern
440 + value="[A-Za-z0-9_][A-Za-z0-9+_.-]*/[A-Za-z0-9_][A-Za-z0-9+_-]*"/>
441 + </xs:restriction>
442 + </xs:simpleType>
443 +
444 + <!-- common attributes -->
445 + <xs:simpleType name='langAttrType'>
446 + <xs:restriction base='xs:token'>
447 + <!-- ISO 639-1 language codes -->
448 + <xs:enumeration value='aa'/>
449 + <xs:enumeration value='ab'/>
450 + <xs:enumeration value='ae'/>
451 + <xs:enumeration value='af'/>
452 + <xs:enumeration value='ak'/>
453 + <xs:enumeration value='am'/>
454 + <xs:enumeration value='an'/>
455 + <xs:enumeration value='ar'/>
456 + <xs:enumeration value='as'/>
457 + <xs:enumeration value='av'/>
458 + <xs:enumeration value='ay'/>
459 + <xs:enumeration value='az'/>
460 + <xs:enumeration value='ba'/>
461 + <xs:enumeration value='be'/>
462 + <xs:enumeration value='bg'/>
463 + <xs:enumeration value='bh'/>
464 + <xs:enumeration value='bi'/>
465 + <xs:enumeration value='bm'/>
466 + <xs:enumeration value='bn'/>
467 + <xs:enumeration value='bo'/>
468 + <xs:enumeration value='bo'/>
469 + <xs:enumeration value='br'/>
470 + <xs:enumeration value='bs'/>
471 + <xs:enumeration value='ca'/>
472 + <xs:enumeration value='ce'/>
473 + <xs:enumeration value='ch'/>
474 + <xs:enumeration value='co'/>
475 + <xs:enumeration value='cr'/>
476 + <xs:enumeration value='cs'/>
477 + <xs:enumeration value='cs'/>
478 + <xs:enumeration value='cu'/>
479 + <xs:enumeration value='cv'/>
480 + <xs:enumeration value='cy'/>
481 + <xs:enumeration value='cy'/>
482 + <xs:enumeration value='da'/>
483 + <xs:enumeration value='de'/>
484 + <xs:enumeration value='de'/>
485 + <xs:enumeration value='dv'/>
486 + <xs:enumeration value='dz'/>
487 + <xs:enumeration value='ee'/>
488 + <xs:enumeration value='el'/>
489 + <xs:enumeration value='el'/>
490 + <xs:enumeration value='en'/>
491 + <xs:enumeration value='eo'/>
492 + <xs:enumeration value='es'/>
493 + <xs:enumeration value='et'/>
494 + <xs:enumeration value='eu'/>
495 + <xs:enumeration value='eu'/>
496 + <xs:enumeration value='fa'/>
497 + <xs:enumeration value='fa'/>
498 + <xs:enumeration value='ff'/>
499 + <xs:enumeration value='fi'/>
500 + <xs:enumeration value='fj'/>
501 + <xs:enumeration value='fo'/>
502 + <xs:enumeration value='fr'/>
503 + <xs:enumeration value='fr'/>
504 + <xs:enumeration value='fy'/>
505 + <xs:enumeration value='ga'/>
506 + <xs:enumeration value='ga'/>
507 + <xs:enumeration value='Ga'/>
508 + <xs:enumeration value='gd'/>
509 + <xs:enumeration value='gl'/>
510 + <xs:enumeration value='gn'/>
511 + <xs:enumeration value='gu'/>
512 + <xs:enumeration value='gv'/>
513 + <xs:enumeration value='ha'/>
514 + <xs:enumeration value='he'/>
515 + <xs:enumeration value='hi'/>
516 + <xs:enumeration value='ho'/>
517 + <xs:enumeration value='hr'/>
518 + <xs:enumeration value='ht'/>
519 + <xs:enumeration value='hu'/>
520 + <xs:enumeration value='hy'/>
521 + <xs:enumeration value='hy'/>
522 + <xs:enumeration value='hz'/>
523 + <xs:enumeration value='ia'/>
524 + <xs:enumeration value='id'/>
525 + <xs:enumeration value='ie'/>
526 + <xs:enumeration value='ig'/>
527 + <xs:enumeration value='ii'/>
528 + <xs:enumeration value='ik'/>
529 + <xs:enumeration value='io'/>
530 + <xs:enumeration value='is'/>
531 + <xs:enumeration value='is'/>
532 + <xs:enumeration value='it'/>
533 + <xs:enumeration value='iu'/>
534 + <xs:enumeration value='ja'/>
535 + <xs:enumeration value='jv'/>
536 + <xs:enumeration value='ka'/>
537 + <xs:enumeration value='ka'/>
538 + <xs:enumeration value='kg'/>
539 + <xs:enumeration value='ki'/>
540 + <xs:enumeration value='kj'/>
541 + <xs:enumeration value='kk'/>
542 + <xs:enumeration value='kl'/>
543 + <xs:enumeration value='km'/>
544 + <xs:enumeration value='kn'/>
545 + <xs:enumeration value='ko'/>
546 + <xs:enumeration value='kr'/>
547 + <xs:enumeration value='ks'/>
548 + <xs:enumeration value='ku'/>
549 + <xs:enumeration value='kv'/>
550 + <xs:enumeration value='kw'/>
551 + <xs:enumeration value='ky'/>
552 + <xs:enumeration value='la'/>
553 + <xs:enumeration value='lb'/>
554 + <xs:enumeration value='lg'/>
555 + <xs:enumeration value='li'/>
556 + <xs:enumeration value='ln'/>
557 + <xs:enumeration value='lo'/>
558 + <xs:enumeration value='lt'/>
559 + <xs:enumeration value='lu'/>
560 + <xs:enumeration value='lv'/>
561 + <xs:enumeration value='mg'/>
562 + <xs:enumeration value='mh'/>
563 + <xs:enumeration value='mi'/>
564 + <xs:enumeration value='mi'/>
565 + <xs:enumeration value='mk'/>
566 + <xs:enumeration value='mk'/>
567 + <xs:enumeration value='ml'/>
568 + <xs:enumeration value='mn'/>
569 + <xs:enumeration value='mr'/>
570 + <xs:enumeration value='ms'/>
571 + <xs:enumeration value='ms'/>
572 + <xs:enumeration value='mt'/>
573 + <xs:enumeration value='my'/>
574 + <xs:enumeration value='my'/>
575 + <xs:enumeration value='na'/>
576 + <xs:enumeration value='nb'/>
577 + <xs:enumeration value='nd'/>
578 + <xs:enumeration value='ne'/>
579 + <xs:enumeration value='ng'/>
580 + <xs:enumeration value='nl'/>
581 + <xs:enumeration value='nl'/>
582 + <xs:enumeration value='nn'/>
583 + <xs:enumeration value='no'/>
584 + <xs:enumeration value='nr'/>
585 + <xs:enumeration value='nv'/>
586 + <xs:enumeration value='ny'/>
587 + <xs:enumeration value='oc'/>
588 + <xs:enumeration value='oj'/>
589 + <xs:enumeration value='om'/>
590 + <xs:enumeration value='or'/>
591 + <xs:enumeration value='os'/>
592 + <xs:enumeration value='pa'/>
593 + <xs:enumeration value='pi'/>
594 + <xs:enumeration value='pl'/>
595 + <xs:enumeration value='ps'/>
596 + <xs:enumeration value='pt'/>
597 + <xs:enumeration value='qu'/>
598 + <xs:enumeration value='rm'/>
599 + <xs:enumeration value='rn'/>
600 + <xs:enumeration value='ro'/>
601 + <xs:enumeration value='ro'/>
602 + <xs:enumeration value='ru'/>
603 + <xs:enumeration value='rw'/>
604 + <xs:enumeration value='sa'/>
605 + <xs:enumeration value='sc'/>
606 + <xs:enumeration value='sd'/>
607 + <xs:enumeration value='se'/>
608 + <xs:enumeration value='sg'/>
609 + <xs:enumeration value='si'/>
610 + <xs:enumeration value='sk'/>
611 + <xs:enumeration value='sk'/>
612 + <xs:enumeration value='sl'/>
613 + <xs:enumeration value='sm'/>
614 + <xs:enumeration value='sn'/>
615 + <xs:enumeration value='so'/>
616 + <xs:enumeration value='sq'/>
617 + <xs:enumeration value='sq'/>
618 + <xs:enumeration value='sr'/>
619 + <xs:enumeration value='ss'/>
620 + <xs:enumeration value='st'/>
621 + <xs:enumeration value='su'/>
622 + <xs:enumeration value='sv'/>
623 + <xs:enumeration value='sw'/>
624 + <xs:enumeration value='ta'/>
625 + <xs:enumeration value='te'/>
626 + <xs:enumeration value='tg'/>
627 + <xs:enumeration value='th'/>
628 + <xs:enumeration value='ti'/>
629 + <xs:enumeration value='tk'/>
630 + <xs:enumeration value='tl'/>
631 + <xs:enumeration value='tn'/>
632 + <xs:enumeration value='to'/>
633 + <xs:enumeration value='tr'/>
634 + <xs:enumeration value='ts'/>
635 + <xs:enumeration value='tt'/>
636 + <xs:enumeration value='tw'/>
637 + <xs:enumeration value='ty'/>
638 + <xs:enumeration value='ug'/>
639 + <xs:enumeration value='uk'/>
640 + <xs:enumeration value='ur'/>
641 + <xs:enumeration value='uz'/>
642 + <xs:enumeration value='ve'/>
643 + <xs:enumeration value='vi'/>
644 + <xs:enumeration value='vo'/>
645 + <xs:enumeration value='wa'/>
646 + <xs:enumeration value='wo'/>
647 + <xs:enumeration value='xh'/>
648 + <xs:enumeration value='yi'/>
649 + <xs:enumeration value='yo'/>
650 + <xs:enumeration value='za'/>
651 + <xs:enumeration value='zh'/>
652 + <xs:enumeration value='zh'/>
653 + <xs:enumeration value='zu'/>
654 + </xs:restriction>
655 + </xs:simpleType>
656 +
657 + <xs:simpleType name='restrictAttrType'>
658 + <xs:restriction base='xs:token'>
659 + <!-- simplified package dependency syntax -->
660 + <!-- note: 'pure' package atom is technically valid too
661 + but not really meaningful -->
662 + <xs:pattern
663 + value="(([&lt;&gt;]=?|[=~])[A-Za-z0-9_][A-Za-z0-9+_.-]*/[A-Za-z0-9_][A-Za-z0-9+_-]*-[0-9]+(\.[0-9]+)*[a-z]?((_alpha|_beta|_pre|_rc|_p)[0-9]*)*(-r[0-9]+)?\*?)?"/>
664 + </xs:restriction>
665 + </xs:simpleType>
666 +
667 + <!-- generic types -->
668 + <xs:simpleType name='emailType'>
669 + <xs:restriction base='xs:token'>
670 + <!-- minimal safe regex -->
671 + <xs:pattern value="[^@]+@[^.]+\..+"/>
672 + </xs:restriction>
673 + </xs:simpleType>
674 +
675 + <xs:complexType name='tokenOnceType'>
676 + <xs:simpleContent>
677 + <xs:extension base="xs:token">
678 + <xs:attribute name='fake-only-once'
679 + fixed='there can be at most one element of this type'/>
680 + </xs:extension>
681 + </xs:simpleContent>
682 + </xs:complexType>
683 +
684 + <xs:simpleType name='urlType'>
685 + <xs:restriction base='xs:token'>
686 + <!-- TODO: something better? -->
687 + <xs:pattern value="(mailto:[^@]+@[^.]+\..+|https?://.+)"/>
688 + </xs:restriction>
689 + </xs:simpleType>
690 +
691 + <xs:complexType name='urlOnceType'>
692 + <xs:simpleContent>
693 + <xs:extension base="urlType">
694 + <xs:attribute name='fake-only-once'
695 + fixed='there can be at most one element of this type'/>
696 + </xs:extension>
697 + </xs:simpleContent>
698 + </xs:complexType>
699 +</xs:schema>
700 diff --git a/pym/portage/tests/repoman/test_simple.py b/pym/portage/tests/repoman/test_simple.py
701 index 720560b..6a79761 100644
702 --- a/pym/portage/tests/repoman/test_simple.py
703 +++ b/pym/portage/tests/repoman/test_simple.py
704 @@ -128,7 +128,7 @@ class SimpleRepomanTestCase(TestCase):
705 }
706 licenses = ["GPL-2"]
707 arch_list = ["x86"]
708 - metadata_dtd = os.path.join(PORTAGE_BASE_PATH, "cnf/metadata.dtd")
709 + metadata_xsd = os.path.join(PORTAGE_BASE_PATH, "cnf/metadata.xsd")
710 metadata_xml_files = (
711 (
712 "dev-libs/A",
713 @@ -269,9 +269,9 @@ class SimpleRepomanTestCase(TestCase):
714 # involving canonical vs. non-canonical paths.
715 test_repo_symlink = os.path.join(eroot, "test_repo_symlink")
716 os.symlink(test_repo_location, test_repo_symlink)
717 - metadata_dtd_dest = os.path.join(test_repo_location, 'metadata/dtd/metadata.dtd')
718 - os.makedirs(os.path.dirname(metadata_dtd_dest))
719 - os.symlink(metadata_dtd, metadata_dtd_dest)
720 + metadata_xsd_dest = os.path.join(test_repo_location, 'metadata/xml-schema/metadata.xsd')
721 + os.makedirs(os.path.dirname(metadata_xsd_dest))
722 + os.symlink(metadata_xsd, metadata_xsd_dest)
723
724 if debug:
725 # The subprocess inherits both stdout and stderr, for
726 --
727 2.8.1