commit: d38405be3e0d22ad106e2e1e1c26dda2e216c402 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Wed Mar 1 18:36:46 2017 +0000 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> CommitDate: Wed Mar 1 18:36:46 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d38405be
repoman: Don't update years in non-Gentoo copyright lines bug 611296 The regular expressions also match the whole line now, so broken date ranges like "1998-2017 - 2000" won't happen any more. For now, "Gentoo Foundation" is hardcoded as copyright holder. If necessary, this can later be moved to repository configuration. X-Gentoo-bug: 611296 X-Gentoo-bug-url: https://bugs.gentoo.org/611296 repoman/pym/repoman/copyrights.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/repoman/pym/repoman/copyrights.py b/repoman/pym/repoman/copyrights.py index 761309af6..7a36ff30d 100644 --- a/repoman/pym/repoman/copyrights.py +++ b/repoman/pym/repoman/copyrights.py @@ -14,8 +14,10 @@ from portage import shutil from portage import util -_copyright_re1 = re.compile(br'^(# Copyright \d\d\d\d)-\d\d\d\d ') -_copyright_re2 = re.compile(br'^(# Copyright )(\d\d\d\d) ') +_copyright_re1 = \ + re.compile(br'^(# Copyright \d\d\d\d)-\d\d\d\d( Gentoo Foundation)$') +_copyright_re2 = \ + re.compile(br'^(# Copyright )(\d\d\d\d)( Gentoo Foundation)$') class _copyright_repl(object): @@ -29,7 +31,7 @@ class _copyright_repl(object): return matchobj.group(0) else: return matchobj.group(1) + matchobj.group(2) + \ - b'-' + self.year + b' ' + b'-' + self.year + matchobj.group(3) def update_copyright_year(year, line): @@ -49,7 +51,7 @@ def update_copyright_year(year, line): year = _unicode_encode(year) line = _unicode_encode(line) - line = _copyright_re1.sub(br'\1-' + year + b' ', line) + line = _copyright_re1.sub(br'\1-' + year + br'\2', line) line = _copyright_re2.sub(_copyright_repl(year), line) if not is_bytes: line = _unicode_decode(line)