Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: ulm@g.o
Subject: Re: [gentoo-portage-dev] [PATCH v2] news.py: Check only for major version when parsing
Date: Thu, 19 May 2016 14:37:35
Message-Id: 573DCFA8.9000104@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2] news.py: Check only for major version when parsing by Alexander Berntsen
1 On 05/19/2016 03:12 AM, Alexander Berntsen wrote:
2 > Only check the major version of news items, as GLEP 42 specifies an
3 > upgrade path for them. Future revisions to news item formats may yield
4 > minor number increments. GLEP 42 further ensures that only
5 > forwards-compatible changes may incur, as incompatible changes demand a
6 > major version increment.
7 >
8 > Suggested-by: Ulrich Müller <ulm@g.o>
9 > Signed-off-by: Alexander Berntsen <bernalex@g.o>
10 > ---
11 > pym/portage/news.py | 4 +++-
12 > 1 file changed, 3 insertions(+), 1 deletion(-)
13 >
14 > diff --git a/pym/portage/news.py b/pym/portage/news.py
15 > index 784ba70..ea1b947 100644
16 > --- a/pym/portage/news.py
17 > +++ b/pym/portage/news.py
18 > @@ -9,6 +9,7 @@ __all__ = ["NewsManager", "NewsItem", "DisplayRestriction",
19 > "DisplayInstalledRestriction",
20 > "count_unread_news", "display_news_notifications"]
21 >
22 > +import fnmatch
23 > import io
24 > import logging
25 > import os as _os
26 > @@ -270,7 +271,8 @@ class NewsItem(object):
27 > # Optimization to ignore regex matchines on lines that
28 > # will never match
29 > format_match = _formatRE.match(line)
30 > - if format_match is not None and format_match.group(1) != '1.0':
31 > + if (format_match is not None and
32 > + not fnmatch.fnmatch(format_match.group(1), '1.*')):
33 > invalids.append((i + 1, line.rstrip('\n')))
34 > break
35 > if not line.startswith('D'):
36 >
37
38 Looks good.
39 --
40 Thanks,
41 Zac

Replies