public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoolkit r626 - trunk/gentoolkit/pym/gentoolkit/glsa
@ 2009-05-07 21:58 Paul Varner (fuzzyray)
  0 siblings, 0 replies; only message in thread
From: Paul Varner (fuzzyray) @ 2009-05-07 21:58 UTC (permalink / raw
  To: gentoo-commits

Author: fuzzyray
Date: 2009-05-07 21:58:49 +0000 (Thu, 07 May 2009)
New Revision: 626

Modified:
   trunk/gentoolkit/pym/gentoolkit/glsa/__init__.py
Log:
Add patch from Robert Buchholz: Respect count attribute in GLSA-2, based on a patch by Michael A. Smith in https://bugs.gentoo.org/218312

Modified: trunk/gentoolkit/pym/gentoolkit/glsa/__init__.py
===================================================================
--- trunk/gentoolkit/pym/gentoolkit/glsa/__init__.py	2009-05-07 21:58:13 UTC (rev 625)
+++ trunk/gentoolkit/pym/gentoolkit/glsa/__init__.py	2009-05-07 21:58:49 UTC (rev 626)
@@ -480,8 +480,24 @@
 		self.title = getText(myroot.getElementsByTagName("title")[0], format="strip")
 		self.synopsis = getText(myroot.getElementsByTagName("synopsis")[0], format="strip")
 		self.announced = getText(myroot.getElementsByTagName("announced")[0], format="strip")
-		self.revised = getText(myroot.getElementsByTagName("revised")[0], format="strip")
 		
+		count = 1
+		# Support both formats of revised:
+		# <revised>December 30, 2007: 02</revised>
+		# <revised count="2">2007-12-30</revised>
+		revisedEl = myroot.getElementsByTagName("revised")[0]
+		self.revised = getText(revisedEl, format="strip")
+		if (revisedEl.attributes.has_key("count")):
+			count = revisedEl.getAttribute("count")
+		elif (self.revised.find(":") >= 0):
+			(self.revised, count) = self.revised.split(":")
+		
+		try:
+			self.count = int(count)
+		except ValueError:
+			# TODO should this rais a GlsaFormatException?
+			self.count = 1
+		
 		# now the optional and 0-n toplevel, #PCDATA tags and references
 		try:
 			self.access = getText(myroot.getElementsByTagName("access")[0], format="strip")
@@ -537,7 +553,7 @@
 		outstream.write((width*"=")+"\n")
 		outstream.write(wrap(self.synopsis, width, caption="Synopsis:         ")+"\n")
 		outstream.write("Announced on:      %s\n" % self.announced)
-		outstream.write("Last revised on:   %s\n\n" % self.revised)
+		outstream.write("Last revised on:   %s : %02d\n\n" % (self.revised, self.count))
 		if self.glsatype == "ebuild":
 			for k in self.packages.keys():
 				pkg = self.packages[k]




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-07 21:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07 21:58 [gentoo-commits] gentoolkit r626 - trunk/gentoolkit/pym/gentoolkit/glsa Paul Varner (fuzzyray)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox