1 |
commit: 2e31efca2bdc9a8b423ae035c95cf0e4b33ba0d5 |
2 |
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org> |
3 |
AuthorDate: Thu Jul 26 23:31:44 2012 +0000 |
4 |
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua> |
5 |
CommitDate: Thu Jul 26 23:31:44 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=2e31efca |
7 |
|
8 |
Add more properties to glsa parser |
9 |
|
10 |
--- |
11 |
.../libs/package_info/generic_metadata/glsa.py | 21 ++++++++++++++++++++ |
12 |
1 files changed, 21 insertions(+), 0 deletions(-) |
13 |
|
14 |
diff --git a/gpackages/libs/package_info/generic_metadata/glsa.py b/gpackages/libs/package_info/generic_metadata/glsa.py |
15 |
index 91616e7..570aeb8 100644 |
16 |
--- a/gpackages/libs/package_info/generic_metadata/glsa.py |
17 |
+++ b/gpackages/libs/package_info/generic_metadata/glsa.py |
18 |
@@ -40,6 +40,10 @@ class GLSA(ToStrMixin): |
19 |
simple_attrs = ('synopsis', 'background', 'description', |
20 |
'workaround', 'resolution') |
21 |
|
22 |
+ product_types = {'ebuild': 0, |
23 |
+ 'information' : 1, |
24 |
+ 'infrastructure' : 2} |
25 |
+ |
26 |
def __init__(self, file_name): |
27 |
if not os.path.isfile(file_name): |
28 |
raise ValueError |
29 |
@@ -66,6 +70,17 @@ class GLSA(ToStrMixin): |
30 |
self.impact_type = impact_xml.attrib.get('type') |
31 |
self.impact = children_text(impact_xml) |
32 |
self._set_references(root) |
33 |
+ self._set_bugs(root) |
34 |
+ |
35 |
+ product_xml = root.find('product') |
36 |
+ product_type = self.product_types[product_xml.attrib.get('type')] |
37 |
+ self.product = (product_xml.text, product_type) |
38 |
+ |
39 |
+ access_xml = root.find('access') |
40 |
+ if access_xml is not None: |
41 |
+ self.access = access_xml.text |
42 |
+ else: |
43 |
+ self.access = None |
44 |
|
45 |
|
46 |
def _set_references(self, root): |
47 |
@@ -77,6 +92,12 @@ class GLSA(ToStrMixin): |
48 |
references.append((name, link)) |
49 |
|
50 |
self.references = references |
51 |
+ |
52 |
+ def _set_bugs(self, root): |
53 |
+ bugs = [] |
54 |
+ for bug_xml in root.iterfind('bug'): |
55 |
+ bugs.append(bug_xml.text) |
56 |
+ self.bugs = bugs |
57 |
|
58 |
|
59 |
def __unicode__(self): |