aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-18 06:43:01 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-18 06:43:01 +0000
commit81d34889d4f51ed52d8683e5837375b9c3840ee0 (patch)
tree76f18dcc4ef16a77358d42481550a0532fa640e4 /pym/portage/news.py
parentUse _content_encoding and _fs_encoding where appropriate. Also, enable (diff)
downloadportage-81d34889d4f51ed52d8683e5837375b9c3840ee0.tar.gz
portage-81d34889d4f51ed52d8683e5837375b9c3840ee0.tar.bz2
portage-81d34889d4f51ed52d8683e5837375b9c3840ee0.zip
Bug #270866 - Validate News-Item-Format headers.
svn path=/main/trunk/; revision=14086
Diffstat (limited to 'pym/portage/news.py')
-rw-r--r--pym/portage/news.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pym/portage/news.py b/pym/portage/news.py
index a5e533fe1..f3482150d 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -186,6 +186,7 @@ class NewsManager(object):
if unread_lock:
unlockfile(unread_lock)
+_formatRE = re.compile("News-Item-Format:\s*([^\s]*)\s*$")
_installedRE = re.compile("Display-If-Installed:(.*)\n")
_profileRE = re.compile("Display-If-Profile:(.*)\n")
_keywordRE = re.compile("Display-If-Keyword:(.*)\n")
@@ -259,6 +260,10 @@ class NewsItem(object):
for i, line in enumerate(lines):
# Optimization to ignore regex matchines on lines that
# will never match
+ format_match = _formatRE.match(line)
+ if format_match is not None and format_match.group(1) != '1.0':
+ invalids.append((i + 1, line.rstrip('\n')))
+ break
if not line.startswith('D'):
continue
restricts = { _installedRE : DisplayInstalledRestriction,