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 BBD681384AE for ; Sun, 20 Sep 2015 02:07:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 958FF21C0C2; Sun, 20 Sep 2015 02:07:06 +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 C0DE921C0C2 for ; Sun, 20 Sep 2015 02:07:00 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D1221340917 for ; Sun, 20 Sep 2015 02:06:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A118A233 for ; Sun, 20 Sep 2015 02:06:54 +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: <1442714431.70f468194c669a265d9635740b27a6ddbb1f7dbd.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: 70f468194c669a265d9635740b27a6ddbb1f7dbd X-VCS-Branch: repoman Date: Sun, 20 Sep 2015 02:06:54 +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: f1e24a98-9438-4afc-8169-cfae64ca557d X-Archives-Hash: 31100ab0b8ef17b0bc9d03675f09d211 commit: 70f468194c669a265d9635740b27a6ddbb1f7dbd Author: Brian Dolbec gentoo org> AuthorDate: Sat Sep 19 04:26:39 2015 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sun Sep 20 02:00:31 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=70f46819 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 974de62..5b55ff8 100644 --- a/pym/repoman/actions.py +++ b/pym/repoman/actions.py @@ -166,23 +166,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( @@ -817,3 +801,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')