1 |
commit: a0849ae0b37956da75b517b8d0b38c839261f4ba |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Sep 19 04:26:39 2015 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 21 23:42:47 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a0849ae0 |
7 |
|
8 |
repoman/actions.py: Splitout clear_attic() |
9 |
|
10 |
pym/repoman/actions.py | 38 +++++++++++++++++++++----------------- |
11 |
1 file changed, 21 insertions(+), 17 deletions(-) |
12 |
|
13 |
diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py |
14 |
index 974de62..5b55ff8 100644 |
15 |
--- a/pym/repoman/actions.py |
16 |
+++ b/pym/repoman/actions.py |
17 |
@@ -166,23 +166,7 @@ class Actions(object): |
18 |
# inside the $Header path. This code detects the problem and corrects it |
19 |
# so that the Manifest will generate correctly. See bug #169500. |
20 |
# Use binary mode in order to avoid potential character encoding issues. |
21 |
- cvs_header_re = re.compile(br'^#\s*\$Header.*\$$') |
22 |
- attic_str = b'/Attic/' |
23 |
- attic_replace = b'/' |
24 |
- for x in myheaders: |
25 |
- f = open( |
26 |
- _unicode_encode(x, encoding=_encodings['fs'], errors='strict'), |
27 |
- mode='rb') |
28 |
- mylines = f.readlines() |
29 |
- f.close() |
30 |
- modified = False |
31 |
- for i, line in enumerate(mylines): |
32 |
- if cvs_header_re.match(line) is not None and \ |
33 |
- attic_str in line: |
34 |
- mylines[i] = line.replace(attic_str, attic_replace) |
35 |
- modified = True |
36 |
- if modified: |
37 |
- portage.util.write_atomic(x, b''.join(mylines), mode='wb') |
38 |
+ self.clear_attic(myheaders) |
39 |
|
40 |
if self.scanner.repolevel == 1: |
41 |
utilities.repoman_sez( |
42 |
@@ -817,3 +801,23 @@ class Actions(object): |
43 |
print( |
44 |
"* Files with headers will" |
45 |
" cause the manifests to be changed and committed separately.") |
46 |
+ |
47 |
+ |
48 |
+ def clear_attic(self, myheaders): |
49 |
+ cvs_header_re = re.compile(br'^#\s*\$Header.*\$$') |
50 |
+ attic_str = b'/Attic/' |
51 |
+ attic_replace = b'/' |
52 |
+ for x in myheaders: |
53 |
+ f = open( |
54 |
+ _unicode_encode(x, encoding=_encodings['fs'], errors='strict'), |
55 |
+ mode='rb') |
56 |
+ mylines = f.readlines() |
57 |
+ f.close() |
58 |
+ modified = False |
59 |
+ for i, line in enumerate(mylines): |
60 |
+ if cvs_header_re.match(line) is not None and \ |
61 |
+ attic_str in line: |
62 |
+ mylines[i] = line.replace(attic_str, attic_replace) |
63 |
+ modified = True |
64 |
+ if modified: |
65 |
+ portage.util.write_atomic(x, b''.join(mylines), mode='wb') |