commit:     1cd578b21b5e295cbd432b525ed5833285468c56
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 04:26:39 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> 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')

Reply via email to