1 |
Brian Dolbec: |
2 |
> On Sun, 1 May 2016 18:38:50 -0700 |
3 |
> Brian Dolbec <dolsen@g.o> wrote: |
4 |
> |
5 |
>> On Sun, 1 May 2016 21:08:47 -0400 |
6 |
>> Göktürk Yüksek <gokturk@××××××××××.edu> wrote: |
7 |
>> |
8 |
>>> Check for: |
9 |
>>> - type attribute in <maintainer/> |
10 |
>>> - name attribute in <slots/> |
11 |
>>> - name attribute in <flag/> |
12 |
>>> - type attribute for <remote-id/> |
13 |
>>> |
14 |
>>> Signed-off-by: Göktürk Yüksek <gokturk@××××××××××.edu> |
15 |
>>> --- |
16 |
>>> xml-test/missing-attributes/metadata.xml | 23 |
17 |
>>> ++++++++++++++++++++++ .../missing-attributes-0.1.ebuild |
18 |
>>> | 13 ++++++++++++ 2 files changed, 36 insertions(+) |
19 |
>>> create mode 100644 xml-test/missing-attributes/metadata.xml |
20 |
>>> create mode 100644 |
21 |
>>> xml-test/missing-attributes/missing-attributes-0.1.ebuild |
22 |
>>> |
23 |
>>> diff --git a/xml-test/missing-attributes/metadata.xml |
24 |
>>> b/xml-test/missing-attributes/metadata.xml new file mode 100644 |
25 |
>>> index 0000000..cf51afd |
26 |
>>> --- /dev/null |
27 |
>>> +++ b/xml-test/missing-attributes/metadata.xml |
28 |
>>> @@ -0,0 +1,23 @@ |
29 |
>>> +<?xml version="1.0" encoding="UTF-8"?> |
30 |
>>> +<!DOCTYPE pkgmetadata SYSTEM |
31 |
>>> "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> |
32 |
>>> + <!-- Missing attribute "type" --> |
33 |
>>> + <maintainer> |
34 |
>>> + <email>foodev@g.o</email> |
35 |
>>> + </maintainer> |
36 |
>>> + <slots> |
37 |
>>> + <!-- Missing attribute "name" --> |
38 |
>>> + <slot>Bar slot</slot> |
39 |
>>> + </slots> |
40 |
>>> + <use> |
41 |
>>> + <!-- Missing attribute "name" --> |
42 |
>>> + <flag>Baz flag</flag> |
43 |
>>> + </use> |
44 |
>>> + <upstream> |
45 |
>>> + <!-- Missing attribute "type" --> |
46 |
>>> + <remote-id>gentoo/gen-b0rk</remote-id> |
47 |
>>> + </upstream> |
48 |
>>> + <longdescription> |
49 |
>>> + Tests for mandatory attributes for various tags |
50 |
>>> + </longdescription> |
51 |
>>> +</pkgmetadata> |
52 |
>>> diff --git |
53 |
>>> a/xml-test/missing-attributes/missing-attributes-0.1.ebuild |
54 |
>>> b/xml-test/missing-attributes/missing-attributes-0.1.ebuild new file |
55 |
>>> mode 100644 index 0000000..5733009 --- /dev/null |
56 |
>>> +++ b/xml-test/missing-attributes/missing-attributes-0.1.ebuild |
57 |
>>> @@ -0,0 +1,13 @@ |
58 |
>>> +# Copyright 1999-2016 Gentoo Foundation |
59 |
>>> +# Distributed under the terms of the GNU General Public License v2 |
60 |
>>> +# $Id$ |
61 |
>>> + |
62 |
>>> +EAPI=6 |
63 |
>>> + |
64 |
>>> +DESCRIPTION="Missing various mandatory attributes in the metadata" |
65 |
>>> +HOMEPAGE="https://wiki.gentoo.org/wiki/GLEP:68" |
66 |
>>> +SRC_URI="" |
67 |
>>> + |
68 |
>>> +LICENSE="HPND" |
69 |
>>> +SLOT="0" |
70 |
>>> +KEYWORDS="~amd64" |
71 |
>> |
72 |
>> Thank you, push it please :) |
73 |
>> |
74 |
> |
75 |
> Am I getting this correct? There are 4 errors in this metadata.xml? |
76 |
> |
77 |
> If that is the case, I am getting only 1 error reported for both 2.2.28 |
78 |
> and the master branch code. |
79 |
> |
80 |
> master branch code: |
81 |
> |
82 |
> brian@professor-x ~/Dev/git/gen-b0rk/xml-test $ repom full |
83 |
> |
84 |
> RepoMan scours the neighborhood... |
85 |
> metadata.bad [fatal] 1 |
86 |
> xml-test/missing-attributes/metadata.xml: missing 'name' attribute |
87 |
> for 'flag' tag metadata.missing [fatal] 1 |
88 |
> xml-test/missing/metadata.xml |
89 |
> |
90 |
> Note: use --include-dev (-d) to check dependencies for 'dev' profiles |
91 |
> |
92 |
> Please fix these important QA issues first. |
93 |
> RepoMan sez: "Make your QA payment on time and you'll never see the |
94 |
> likes of me." |
95 |
> |
96 |
> |
97 |
> |
98 |
> Portage-2.2.28 release: |
99 |
> |
100 |
> brian@professor-x ~/Dev/git/gen-b0rk/xml-test $ repoman full |
101 |
> |
102 |
> RepoMan scours the neighborhood... |
103 |
> metadata.bad [fatal] 1 |
104 |
> xml-test/missing-attributes/metadata.xml: missing 'name' attribute |
105 |
> for 'flag' tag metadata.missing [fatal] 1 |
106 |
> xml-test/missing/metadata.xml |
107 |
> |
108 |
> Note: use --include-dev (-d) to check dependencies for 'dev' profiles |
109 |
> |
110 |
> Please fix these important QA issues first. |
111 |
> RepoMan sez: "Make your QA payment on time and you'll never see the |
112 |
> likes of me." |
113 |
> |
114 |
> brian@professor-x ~/Dev/git/gen-b0rk/xml-test $ |
115 |
> |
116 |
> |
117 |
|
118 |
xmllint seems to catch 3 out of 4 for DTD and all 4 for xsd: |
119 |
|
120 |
$ xmllint --nonet --noout --dtdvalid /usr/portage/distfiles/metadata.dtd |
121 |
metadata.xml |
122 |
metadata.xml:10: element slot: validity error : Element slot does not |
123 |
carry attribute name |
124 |
metadata.xml:14: element flag: validity error : Element flag does not |
125 |
carry attribute name |
126 |
metadata.xml:18: element remote-id: validity error : Element remote-id |
127 |
does not carry attribute type |
128 |
Document metadata.xml does not validate against |
129 |
/usr/portage/distfiles/metadata.dtd |
130 |
|
131 |
$ xmllint --nonet --noout --schema /usr/portage/distfiles/metadata.xsd |
132 |
metadata.xml |
133 |
metadata.xml:5: element maintainer: Schemas validity error : Element |
134 |
'maintainer': The attribute 'type' is required but missing. |
135 |
metadata.xml:10: element slot: Schemas validity error : Element 'slot': |
136 |
The attribute 'name' is required but missing. |
137 |
metadata.xml:14: element flag: Schemas validity error : Element 'flag': |
138 |
The attribute 'name' is required but missing. |
139 |
metadata.xml:18: element remote-id: Schemas validity error : Element |
140 |
'remote-id': The attribute 'type' is required but missing. |
141 |
metadata.xml fails to validate |
142 |
|
143 |
If I supply <flag name="baz"> and run repom again, it prints all the errors: |
144 |
|
145 |
$ repom full |
146 |
|
147 |
RepoMan scours the neighborhood... |
148 |
!!! metadata.xml is invalid: |
149 |
!!! |
150 |
/home/gokturk/stuff/gen-b0rk/xml-test/missing-attributes/metadata.xml:5: |
151 |
element maintainer: Schemas validity error : Element 'maintainer': The |
152 |
attribute 'type' is required but missing. |
153 |
!!! |
154 |
/home/gokturk/stuff/gen-b0rk/xml-test/missing-attributes/metadata.xml:10: element |
155 |
slot: Schemas validity error : Element 'slot': The attribute 'name' is |
156 |
required but missing. |
157 |
!!! |
158 |
/home/gokturk/stuff/gen-b0rk/xml-test/missing-attributes/metadata.xml:18: element |
159 |
remote-id: Schemas validity error : Element 'remote-id': The attribute |
160 |
'type' is required but missing. |
161 |
!!! |
162 |
/home/gokturk/stuff/gen-b0rk/xml-test/missing-attributes/metadata.xml |
163 |
fails to validate |
164 |
metadata.bad [fatal] 1 |
165 |
xml-test/missing-attributes/metadata.xml |
166 |
metadata.warning 1 |
167 |
xml-test/missing-attributes/metadata.xml: unused local |
168 |
USE-description: 'baz' |
169 |
|
170 |
Note: use --include-dev (-d) to check dependencies for 'dev' profiles |
171 |
|
172 |
Please fix these important QA issues first. |
173 |
RepoMan sez: "Make your QA payment on time and you'll never see the |
174 |
likes of me." |
175 |
|
176 |
I am looking at the code and looks like there's an early fail in |
177 |
pkgmetadata.py: |
178 |
|
179 |
93 try: |
180 |
94 _metadata_xml = xml.etree.ElementTree.parse( |
181 |
95 _unicode_encode( |
182 |
96 os.path.join(checkdir, "metadata.xml"), |
183 |
97 encoding=_encodings['fs'], errors='strict'), |
184 |
98 parser=xml_parser) |
185 |
99 except (ExpatError, SyntaxError, EnvironmentError) as e: |
186 |
100 metadata_bad = True |
187 |
101 self.qatracker.add_error("metadata.bad", "%s/metadata.xml: %s" % |
188 |
(xpkg, e)) |
189 |
|
190 |
I do not know why there's a difference in behavior. If it early-fails |
191 |
for missing name in <flag>, it should behave the same for missing name |
192 |
in <slot>. I'll dig into it more when I have time. |