From: Aaron Bauman <bman@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Aaron Bauman <bman@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH v2] portage/glsa.py: only check for revisions based on GLSA DTD
Date: Tue, 13 Aug 2019 18:26:04 -0400 [thread overview]
Message-ID: <20190813222604.311969-1-bman@gentoo.org> (raw)
* 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..f94e9834d 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("Invalid revision attribute 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.0
reply other threads:[~2019-08-13 22:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190813222604.311969-1-bman@gentoo.org \
--to=bman@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox