commit 372beb64ffd1d956745178376cf263735b415285 Author: Mark J. Cox <mjc@redhat.com> Date: Mon Aug 16 15:15:05 2010 -0400 Add summary, solution and rights updateinfo data. diff --git a/yum/update_md.py b/yum/update_md.py index 6954c7b..9f6ff99 100644 --- a/yum/update_md.py +++ b/yum/update_md.py @@ -56,6 +56,9 @@ class UpdateNotice(object): 'issued' : '', 'updated' : '', 'description' : '', + 'rights' : '', + 'summary' : '', + 'solution' : '', 'references' : [], 'pkglist' : [], 'reboot_suggested' : False @@ -103,11 +106,26 @@ class UpdateNotice(object): cvelist += " %s\n\t :" % cve['id'] head += cvelist[: - 1].rstrip() + '\n' - if self._md['description'] is not None: + if self._md['summary']: + data = utf8_text_wrap(self._md['summary'], width=64, + subsequent_indent=' ' * 12 + ': ') + head += " Summary : %s\n" % '\n'.join(data) + + if self._md['description']: desc = utf8_text_wrap(self._md['description'], width=64, subsequent_indent=' ' * 12 + ': ') head += "Description : %s\n" % '\n'.join(desc) + if self._md['solution']: + data = utf8_text_wrap(self._md['solution'], width=64, + subsequent_indent=' ' * 12 + ': ') + head += " Solution : %s\n" % '\n'.join(data) + + if self._md['rights']: + data = utf8_text_wrap(self._md['rights'], width=64, + subsequent_indent=' ' * 12 + ': ') + head += " Rights : %s\n" % '\n'.join(data) + # Get a list of arches we care about: #XXX ARCH CHANGE - what happens here if we set the arch - we need to # pass this in, perhaps @@ -132,7 +150,7 @@ class UpdateNotice(object): Parse an update element:: <!ELEMENT update (id, synopsis?, issued, updated, - references, description, pkglist)> + references, description, rights?, summary?, solution?, pkglist)> <!ATTLIST update type (errata|security) "errata"> <!ATTLIST update status (final|testing) "final"> <!ATTLIST update version CDATA #REQUIRED> @@ -156,6 +174,12 @@ class UpdateNotice(object): self._parse_references(child) elif child.tag == 'description': self._md['description'] = child.text + elif child.tag == 'rights': + self._md['rights'] = child.text + elif child.tag == 'summary': + self._md['summary'] = child.text + elif child.tag == 'solution': + self._md['solution'] = child.text elif child.tag == 'pkglist': self._parse_pkglist(child) elif child.tag == 'title': @@ -172,7 +196,7 @@ class UpdateNotice(object): <!ELEMENT references (reference*)> <!ELEMENT reference> <!ATTLIST reference href CDATA #REQUIRED> - <!ATTLIST reference type (self|cve|bugzilla) "self"> + <!ATTLIST reference type (self|other|cve|bugzilla) "self"> <!ATTLIST reference id CDATA #IMPLIED> <!ATTLIST reference title CDATA #IMPLIED> """ @@ -254,7 +278,13 @@ class UpdateNotice(object): to_xml(self._md['title']), to_xml(self._md['release']), to_xml(self._md['issued'], attrib=True), to_xml(self._md['description'])) - + + if self._md['summary']: + msg += """ <summary>%s</summary>\n""" % (to_xml(self._md['summary'])) + if self._md['solution']: + msg += """ <solution>%s</solution>\n""" % (to_xml(self._md['solution'])) + if self._md['rights']: + msg += """ <rights>%s</rights>\n""" % (to_xml(self._md['rights'])) if self._md['references']: msg += """ <references>\n""" for ref in self._md['references']: commit a791348d55fef603370d11c9e71ce74e50cda2a4 Author: James Antill <james@and.org> Date: Mon Aug 16 16:08:38 2010 -0400 Don't print files section of updateinfo notices, by default. diff --git a/yum/update_md.py b/yum/update_md.py index 9f6ff99..3d05d19 100644 --- a/yum/update_md.py +++ b/yum/update_md.py @@ -74,7 +74,7 @@ class UpdateNotice(object): def __setitem__(self, item, val): self._md[item] = val - def __str__(self): + def text(self, skip_data=('files',)): head = """ =============================================================================== %(title)s @@ -91,7 +91,7 @@ class UpdateNotice(object): # Add our bugzilla references bzs = filter(lambda r: r['type'] == 'bugzilla', self._md['references']) - if len(bzs): + if len(bzs) and 'bugs' not in skip_data: buglist = " Bugs :" for bz in bzs: buglist += " %s%s\n\t :" % (bz['id'], 'title' in bz @@ -100,32 +100,35 @@ class UpdateNotice(object): # Add our CVE references cves = filter(lambda r: r['type'] == 'cve', self._md['references']) - if len(cves): + if len(cves) and 'cves' not in skip_data: cvelist = " CVEs :" for cve in cves: cvelist += " %s\n\t :" % cve['id'] head += cvelist[: - 1].rstrip() + '\n' - if self._md['summary']: + if self._md['summary'] and 'summary' not in skip_data: data = utf8_text_wrap(self._md['summary'], width=64, subsequent_indent=' ' * 12 + ': ') head += " Summary : %s\n" % '\n'.join(data) - if self._md['description']: + if self._md['description'] and 'description' not in skip_data: desc = utf8_text_wrap(self._md['description'], width=64, subsequent_indent=' ' * 12 + ': ') head += "Description : %s\n" % '\n'.join(desc) - if self._md['solution']: + if self._md['solution'] and 'solution' not in skip_data: data = utf8_text_wrap(self._md['solution'], width=64, subsequent_indent=' ' * 12 + ': ') head += " Solution : %s\n" % '\n'.join(data) - if self._md['rights']: + if self._md['rights'] and 'rights' not in skip_data: data = utf8_text_wrap(self._md['rights'], width=64, subsequent_indent=' ' * 12 + ': ') head += " Rights : %s\n" % '\n'.join(data) + if 'files' in skip_data: + return head[:-1] # chop the last '\n' + # Get a list of arches we care about: #XXX ARCH CHANGE - what happens here if we set the arch - we need to # pass this in, perhaps @@ -141,6 +144,9 @@ class UpdateNotice(object): return head + def __str__(self): + return to_utf8(self.text()) + def get_metadata(self): """ Return the metadata dict. """ return self._md commit d9fcb373b2c6cd7ca708e146a795ce3f3239692b Author: James Antill <james@and.org> Date: Wed Sep 15 08:30:12 2010 -0400 Add "severity" to updateinfo parsing, another element from BZ 624079. diff --git a/yum/update_md.py b/yum/update_md.py index 3d05d19..74db5ad 100644 --- a/yum/update_md.py +++ b/yum/update_md.py @@ -57,6 +57,7 @@ class UpdateNotice(object): 'updated' : '', 'description' : '', 'rights' : '', + 'severity' : '', 'summary' : '', 'solution' : '', 'references' : [], @@ -126,6 +127,11 @@ class UpdateNotice(object): subsequent_indent=' ' * 12 + ': ') head += " Rights : %s\n" % '\n'.join(data) + if self._md['severity'] and 'severity' not in skip_data: + data = utf8_text_wrap(self._md['severity'], width=64, + subsequent_indent=' ' * 12 + ': ') + head += " Severity : %s\n" % '\n'.join(data) + if 'files' in skip_data: return head[:-1] # chop the last '\n' @@ -156,7 +162,8 @@ class UpdateNotice(object): Parse an update element:: <!ELEMENT update (id, synopsis?, issued, updated, - references, description, rights?, summary?, solution?, pkglist)> + references, description, rights?, + severity?, summary?, solution?, pkglist)> <!ATTLIST update type (errata|security) "errata"> <!ATTLIST update status (final|testing) "final"> <!ATTLIST update version CDATA #REQUIRED> @@ -182,6 +189,8 @@ class UpdateNotice(object): self._md['description'] = child.text elif child.tag == 'rights': self._md['rights'] = child.text + elif child.tag == 'severity': + self._md[child.tag] = child.text elif child.tag == 'summary': self._md['summary'] = child.text elif child.tag == 'solution': @@ -291,6 +300,9 @@ class UpdateNotice(object): msg += """ <solution>%s</solution>\n""" % (to_xml(self._md['solution'])) if self._md['rights']: msg += """ <rights>%s</rights>\n""" % (to_xml(self._md['rights'])) + if self._md['severity']: + msg += """ <severity>%s</severity>\n""" % (to_xml(self._md['severity'])) + if self._md['references']: msg += """ <references>\n""" for ref in self._md['references']: