Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/
Date: Wed, 01 Mar 2017 18:40:43
Message-Id: 1488393406.d38405be3e0d22ad106e2e1e1c26dda2e216c402.dolsen@gentoo
1 commit: d38405be3e0d22ad106e2e1e1c26dda2e216c402
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 1 18:36:46 2017 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 1 18:36:46 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d38405be
7
8 repoman: Don't update years in non-Gentoo copyright lines bug 611296
9
10 The regular expressions also match the whole line now, so broken date
11 ranges like "1998-2017 - 2000" won't happen any more.
12
13 For now, "Gentoo Foundation" is hardcoded as copyright holder.
14 If necessary, this can later be moved to repository configuration.
15
16 X-Gentoo-bug: 611296
17 X-Gentoo-bug-url: https://bugs.gentoo.org/611296
18
19 repoman/pym/repoman/copyrights.py | 10 ++++++----
20 1 file changed, 6 insertions(+), 4 deletions(-)
21
22 diff --git a/repoman/pym/repoman/copyrights.py b/repoman/pym/repoman/copyrights.py
23 index 761309af6..7a36ff30d 100644
24 --- a/repoman/pym/repoman/copyrights.py
25 +++ b/repoman/pym/repoman/copyrights.py
26 @@ -14,8 +14,10 @@ from portage import shutil
27 from portage import util
28
29
30 -_copyright_re1 = re.compile(br'^(# Copyright \d\d\d\d)-\d\d\d\d ')
31 -_copyright_re2 = re.compile(br'^(# Copyright )(\d\d\d\d) ')
32 +_copyright_re1 = \
33 + re.compile(br'^(# Copyright \d\d\d\d)-\d\d\d\d( Gentoo Foundation)$')
34 +_copyright_re2 = \
35 + re.compile(br'^(# Copyright )(\d\d\d\d)( Gentoo Foundation)$')
36
37
38 class _copyright_repl(object):
39 @@ -29,7 +31,7 @@ class _copyright_repl(object):
40 return matchobj.group(0)
41 else:
42 return matchobj.group(1) + matchobj.group(2) + \
43 - b'-' + self.year + b' '
44 + b'-' + self.year + matchobj.group(3)
45
46
47 def update_copyright_year(year, line):
48 @@ -49,7 +51,7 @@ def update_copyright_year(year, line):
49 year = _unicode_encode(year)
50 line = _unicode_encode(line)
51
52 - line = _copyright_re1.sub(br'\1-' + year + b' ', line)
53 + line = _copyright_re1.sub(br'\1-' + year + br'\2', line)
54 line = _copyright_re2.sub(_copyright_repl(year), line)
55 if not is_bytes:
56 line = _unicode_decode(line)