From: Zac Medico Date: Mon, 17 Oct 2011 01:11:22 +0000 (-0700) Subject: UpdateChangeLog: update copyright year in header X-Git-Tag: v2.2.0_alpha68~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=190a8a577934755ff07f9bc58f0b87a65c7f0738;p=portage.git UpdateChangeLog: update copyright year in header This feature got dropped on commit b655137b7b5f87c11a7e742b7ef0e028a1139677. --- diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index 5b9eaf741..e4fc1a45b 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -28,6 +28,7 @@ import io from itertools import chain import logging import pwd +import re import sys import time import textwrap @@ -549,6 +550,7 @@ def UpdateChangeLog(pkgdir, category, package, new, removed, changed, msg, prete cl_path = os.path.join(pkgdir, 'ChangeLog') clold_lines = [] clnew_lines = [] + old_header_lines = [] header_lines = [] try: @@ -583,6 +585,12 @@ def UpdateChangeLog(pkgdir, category, package, new, removed, changed, msg, prete if not line_strip: break + # update the copyright year + old_header_lines = header_lines[:] + if len(header_lines) >= 2: + header_lines[1] = re.sub(r'^(# Copyright \d\d\d\d)-\d\d\d\d ', + r'\1-%s ' % time.strftime('%Y'), header_lines[1]) + # write new ChangeLog entry clnew_lines.extend(header_lines) date = time.strftime('%d %b %Y') @@ -620,9 +628,9 @@ def UpdateChangeLog(pkgdir, category, package, new, removed, changed, msg, prete for line in clold_lines: f.write(line) - # Now prepend header_lines to clold_lines, for use + # Now prepend old_header_lines to clold_lines, for use # in the unified_diff call below. - clold_lines = header_lines + clold_lines + clold_lines = old_header_lines + clold_lines for line in clold_file: f.write(line)