From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8679A1384AE for ; Sat, 19 Sep 2015 04:36:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4AF3121C0D8; Sat, 19 Sep 2015 04:36:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 591B621C0B9 for ; Sat, 19 Sep 2015 04:36:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 90E85340C25 for ; Sat, 19 Sep 2015 04:36:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9F2E4208 for ; Sat, 19 Sep 2015 04:36:27 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1442636799.1cd578b21b5e295cbd432b525ed5833285468c56.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/actions.py X-VCS-Directories: pym/repoman/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 1cd578b21b5e295cbd432b525ed5833285468c56 X-VCS-Branch: repoman Date: Sat, 19 Sep 2015 04:36:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 90f17a40-bef2-4157-947f-8d2e27d26480 X-Archives-Hash: e8cb08a990a2496e0e02563f3bf33c33 commit: 1cd578b21b5e295cbd432b525ed5833285468c56 Author: Brian Dolbec gentoo org> AuthorDate: Sat Sep 19 04:26:39 2015 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sat Sep 19 04:26:39 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1cd578b2 repoman/actions.py: Splitout clear_attic() pym/repoman/actions.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py index ba1e0a2..1751396 100644 --- a/pym/repoman/actions.py +++ b/pym/repoman/actions.py @@ -163,23 +163,7 @@ class Actions(object): # inside the $Header path. This code detects the problem and corrects it # so that the Manifest will generate correctly. See bug #169500. # Use binary mode in order to avoid potential character encoding issues. - cvs_header_re = re.compile(br'^#\s*\$Header.*\$$') - attic_str = b'/Attic/' - attic_replace = b'/' - for x in myheaders: - f = open( - _unicode_encode(x, encoding=_encodings['fs'], errors='strict'), - mode='rb') - mylines = f.readlines() - f.close() - modified = False - for i, line in enumerate(mylines): - if cvs_header_re.match(line) is not None and \ - attic_str in line: - mylines[i] = line.replace(attic_str, attic_replace) - modified = True - if modified: - portage.util.write_atomic(x, b''.join(mylines), mode='wb') + self.clear_attic(myheaders) if self.scanner.repolevel == 1: utilities.repoman_sez( @@ -813,3 +797,23 @@ class Actions(object): print( "* Files with headers will" " cause the manifests to be changed and committed separately.") + + + def clear_attic(self, myheaders): + cvs_header_re = re.compile(br'^#\s*\$Header.*\$$') + attic_str = b'/Attic/' + attic_replace = b'/' + for x in myheaders: + f = open( + _unicode_encode(x, encoding=_encodings['fs'], errors='strict'), + mode='rb') + mylines = f.readlines() + f.close() + modified = False + for i, line in enumerate(mylines): + if cvs_header_re.match(line) is not None and \ + attic_str in line: + mylines[i] = line.replace(attic_str, attic_replace) + modified = True + if modified: + portage.util.write_atomic(x, b''.join(mylines), mode='wb')