* [gentoo-portage-dev] [PATCH v3] portage/glsa.py: only check for revision based on GLSA DTD
@ 2019-08-14 18:05 Aaron Bauman
2019-08-19 1:12 ` Zac Medico
0 siblings, 1 reply; 2+ messages in thread
From: Aaron Bauman @ 2019-08-14 18:05 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Aaron Bauman
* All GLSA's have been converted to use the revision attribute
* If there is no count attribute then raise a GlsaFormatException
* Ensure the attribute is an integer
Signed-off-by: Aaron Bauman <bman@gentoo.org>
---
lib/portage/glsa.py | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py
index ccf93439d..3fd877b22 100644
--- a/lib/portage/glsa.py
+++ b/lib/portage/glsa.py
@@ -528,25 +528,20 @@ class Glsa:
self.synopsis = getText(myroot.getElementsByTagName("synopsis")[0], format="strip")
self.announced = format_date(getText(myroot.getElementsByTagName("announced")[0], format="strip"))
- # Support both formats of revised:
- # <revised>December 30, 2007: 02</revised>
+ # Support only format defined in GLSA DTD
# <revised count="2">2007-12-30</revised>
revisedEl = myroot.getElementsByTagName("revised")[0]
self.revised = getText(revisedEl, format="strip")
count = revisedEl.getAttribute("count")
if not count:
- if self.revised.find(":") >= 0:
- (self.revised, count) = self.revised.split(":")
- else:
- count = 1
-
- self.revised = format_date(self.revised)
+ raise GlsaFormatException("Count attribute is missing or blank in GLSA: " + myroot.getAttribute("id"))
try:
self.count = int(count)
except ValueError:
- # TODO should this raise a GlsaFormatException?
- self.count = 1
+ raise GlsaFormatException("Revision attribute in GLSA: " + myroot.getAttribute("id") + " is not an integer")
+
+ self.revised = format_date(self.revised)
# now the optional and 0-n toplevel, #PCDATA tags and references
try:
--
2.22.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v3] portage/glsa.py: only check for revision based on GLSA DTD
2019-08-14 18:05 [gentoo-portage-dev] [PATCH v3] portage/glsa.py: only check for revision based on GLSA DTD Aaron Bauman
@ 2019-08-19 1:12 ` Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2019-08-19 1:12 UTC (permalink / raw
To: gentoo-portage-dev, Aaron Bauman
[-- Attachment #1.1: Type: text/plain, Size: 1971 bytes --]
On 8/14/19 11:05 AM, Aaron Bauman wrote:
> * All GLSA's have been converted to use the revision attribute
> * If there is no count attribute then raise a GlsaFormatException
> * Ensure the attribute is an integer
>
> Signed-off-by: Aaron Bauman <bman@gentoo.org>
> ---
> lib/portage/glsa.py | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py
> index ccf93439d..3fd877b22 100644
> --- a/lib/portage/glsa.py
> +++ b/lib/portage/glsa.py
> @@ -528,25 +528,20 @@ class Glsa:
> self.synopsis = getText(myroot.getElementsByTagName("synopsis")[0], format="strip")
> self.announced = format_date(getText(myroot.getElementsByTagName("announced")[0], format="strip"))
>
> - # Support both formats of revised:
> - # <revised>December 30, 2007: 02</revised>
> + # Support only format defined in GLSA DTD
> # <revised count="2">2007-12-30</revised>
> revisedEl = myroot.getElementsByTagName("revised")[0]
> self.revised = getText(revisedEl, format="strip")
> count = revisedEl.getAttribute("count")
> if not count:
> - if self.revised.find(":") >= 0:
> - (self.revised, count) = self.revised.split(":")
> - else:
> - count = 1
> -
> - self.revised = format_date(self.revised)
> + raise GlsaFormatException("Count attribute is missing or blank in GLSA: " + myroot.getAttribute("id"))
>
> try:
> self.count = int(count)
> except ValueError:
> - # TODO should this raise a GlsaFormatException?
> - self.count = 1
> + raise GlsaFormatException("Revision attribute in GLSA: " + myroot.getAttribute("id") + " is not an integer")
> +
> + self.revised = format_date(self.revised)
>
> # now the optional and 0-n toplevel, #PCDATA tags and references
> try:
>
Thanks, merged:
https://gitweb.gentoo.org/proj/portage.git/commit/?id=98f8a4a8f5c38dfb3c797ad8d66f8cac1822805d
--
Thanks,
Zac
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-19 1:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-14 18:05 [gentoo-portage-dev] [PATCH v3] portage/glsa.py: only check for revision based on GLSA DTD Aaron Bauman
2019-08-19 1:12 ` Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox