1 |
commit: 57ad076b08d417bf5d2642131b76392a990f3c35 |
2 |
Author: Dirkjan Ochtman <dirkjan <AT> ochtman <DOT> nl> |
3 |
AuthorDate: Mon Jan 25 19:45:31 2016 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 3 06:55:53 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=57ad076b |
7 |
|
8 |
repoman: mandate use of python 2.7 or 3.2+ for simplicity |
9 |
|
10 |
pym/repoman/modules/scan/metadata/pkgmetadata.py | 78 +++++++++++------------- |
11 |
1 file changed, 36 insertions(+), 42 deletions(-) |
12 |
|
13 |
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py |
14 |
index cde2ba0..e8db92f 100644 |
15 |
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py |
16 |
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py |
17 |
@@ -158,54 +158,48 @@ class PkgMetadata(ScanBase, USEFlagChecks): |
18 |
self.muselist = frozenset(self.musedict) |
19 |
return False |
20 |
|
21 |
- if not hasattr(xml_parser, 'parser') or \ |
22 |
- sys.hexversion < 0x2070000 or \ |
23 |
- (sys.hexversion > 0x3000000 and sys.hexversion < 0x3020000): |
24 |
- # doctype is not parsed with python 2.6 or 3.1 |
25 |
- pass |
26 |
+ if "XML_DECLARATION" not in xml_info: |
27 |
+ self.qatracker.add_error( |
28 |
+ "metadata.bad", "%s/metadata.xml: " |
29 |
+ "xml declaration is missing on first line, " |
30 |
+ "should be '%s'" % (xpkg, metadata_xml_declaration)) |
31 |
else: |
32 |
- if "XML_DECLARATION" not in xml_info: |
33 |
+ xml_version, xml_encoding, xml_standalone = \ |
34 |
+ xml_info["XML_DECLARATION"] |
35 |
+ if xml_encoding is None or \ |
36 |
+ xml_encoding.upper() != metadata_xml_encoding: |
37 |
+ if xml_encoding is None: |
38 |
+ encoding_problem = "but it is undefined" |
39 |
+ else: |
40 |
+ encoding_problem = "not '%s'" % xml_encoding |
41 |
self.qatracker.add_error( |
42 |
"metadata.bad", "%s/metadata.xml: " |
43 |
- "xml declaration is missing on first line, " |
44 |
- "should be '%s'" % (xpkg, metadata_xml_declaration)) |
45 |
- else: |
46 |
- xml_version, xml_encoding, xml_standalone = \ |
47 |
- xml_info["XML_DECLARATION"] |
48 |
- if xml_encoding is None or \ |
49 |
- xml_encoding.upper() != metadata_xml_encoding: |
50 |
- if xml_encoding is None: |
51 |
- encoding_problem = "but it is undefined" |
52 |
- else: |
53 |
- encoding_problem = "not '%s'" % xml_encoding |
54 |
- self.qatracker.add_error( |
55 |
- "metadata.bad", "%s/metadata.xml: " |
56 |
- "xml declaration encoding should be '%s', %s" % |
57 |
- (xpkg, metadata_xml_encoding, encoding_problem)) |
58 |
+ "xml declaration encoding should be '%s', %s" % |
59 |
+ (xpkg, metadata_xml_encoding, encoding_problem)) |
60 |
|
61 |
- if "DOCTYPE" not in xml_info: |
62 |
- metadata_bad = True |
63 |
+ if "DOCTYPE" not in xml_info: |
64 |
+ metadata_bad = True |
65 |
+ self.qatracker.add_error( |
66 |
+ "metadata.bad", |
67 |
+ "%s/metadata.xml: %s" % (xpkg, "DOCTYPE is missing")) |
68 |
+ else: |
69 |
+ doctype_name, doctype_system, doctype_pubid = \ |
70 |
+ xml_info["DOCTYPE"] |
71 |
+ if doctype_system != metadata_dtd_uri: |
72 |
+ if doctype_system is None: |
73 |
+ system_problem = "but it is undefined" |
74 |
+ else: |
75 |
+ system_problem = "not '%s'" % doctype_system |
76 |
self.qatracker.add_error( |
77 |
- "metadata.bad", |
78 |
- "%s/metadata.xml: %s" % (xpkg, "DOCTYPE is missing")) |
79 |
- else: |
80 |
- doctype_name, doctype_system, doctype_pubid = \ |
81 |
- xml_info["DOCTYPE"] |
82 |
- if doctype_system != metadata_dtd_uri: |
83 |
- if doctype_system is None: |
84 |
- system_problem = "but it is undefined" |
85 |
- else: |
86 |
- system_problem = "not '%s'" % doctype_system |
87 |
- self.qatracker.add_error( |
88 |
- "metadata.bad", "%s/metadata.xml: " |
89 |
- "DOCTYPE: SYSTEM should refer to '%s', %s" % |
90 |
- (xpkg, metadata_dtd_uri, system_problem)) |
91 |
+ "metadata.bad", "%s/metadata.xml: " |
92 |
+ "DOCTYPE: SYSTEM should refer to '%s', %s" % |
93 |
+ (xpkg, metadata_dtd_uri, system_problem)) |
94 |
|
95 |
- if doctype_name != metadata_doctype_name: |
96 |
- self.qatracker.add_error( |
97 |
- "metadata.bad", "%s/metadata.xml: " |
98 |
- "DOCTYPE: name should be '%s', not '%s'" % |
99 |
- (xpkg, metadata_doctype_name, doctype_name)) |
100 |
+ if doctype_name != metadata_doctype_name: |
101 |
+ self.qatracker.add_error( |
102 |
+ "metadata.bad", "%s/metadata.xml: " |
103 |
+ "DOCTYPE: name should be '%s', not '%s'" % |
104 |
+ (xpkg, metadata_doctype_name, doctype_name)) |
105 |
|
106 |
# load USE flags from metadata.xml |
107 |
try: |