1 |
commit: 0a1c62dcf051dae85cac185673abcec686a12052 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 7 18:46:27 2016 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 7 21:21:35 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0a1c62dc |
7 |
|
8 |
repoman: Move clear_attic() code to the modules |
9 |
|
10 |
pym/repoman/actions.py | 24 +----------------------- |
11 |
pym/repoman/modules/vcs/changes.py | 4 ++++ |
12 |
pym/repoman/modules/vcs/cvs/changes.py | 21 +++++++++++++++++++++ |
13 |
3 files changed, 26 insertions(+), 23 deletions(-) |
14 |
|
15 |
diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py |
16 |
index 20116db..e045295 100644 |
17 |
--- a/pym/repoman/actions.py |
18 |
+++ b/pym/repoman/actions.py |
19 |
@@ -152,7 +152,7 @@ class Actions(object): |
20 |
# inside the $Header path. This code detects the problem and corrects it |
21 |
# so that the Manifest will generate correctly. See bug #169500. |
22 |
# Use binary mode in order to avoid potential character encoding issues. |
23 |
- self.clear_attic(myheaders) |
24 |
+ self.vcs_settings.changes.clear_attic(myheaders) |
25 |
|
26 |
if self.scanner.repolevel == 1: |
27 |
utilities.repoman_sez( |
28 |
@@ -571,28 +571,6 @@ class Actions(object): |
29 |
pass |
30 |
|
31 |
|
32 |
- |
33 |
- |
34 |
- def clear_attic(self, myheaders): |
35 |
- cvs_header_re = re.compile(br'^#\s*\$Header.*\$$') |
36 |
- attic_str = b'/Attic/' |
37 |
- attic_replace = b'/' |
38 |
- for x in myheaders: |
39 |
- f = open( |
40 |
- _unicode_encode(x, encoding=_encodings['fs'], errors='strict'), |
41 |
- mode='rb') |
42 |
- mylines = f.readlines() |
43 |
- f.close() |
44 |
- modified = False |
45 |
- for i, line in enumerate(mylines): |
46 |
- if cvs_header_re.match(line) is not None and \ |
47 |
- attic_str in line: |
48 |
- mylines[i] = line.replace(attic_str, attic_replace) |
49 |
- modified = True |
50 |
- if modified: |
51 |
- portage.util.write_atomic(x, b''.join(mylines), mode='wb') |
52 |
- |
53 |
- |
54 |
def sign_manifest(self, myupdates, myremoved, mymanifests): |
55 |
try: |
56 |
for x in sorted(vcs_files_to_cps( |
57 |
|
58 |
diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py |
59 |
index 77d7dc1..1745a65 100644 |
60 |
--- a/pym/repoman/modules/vcs/changes.py |
61 |
+++ b/pym/repoman/modules/vcs/changes.py |
62 |
@@ -74,3 +74,7 @@ class ChangesBase(object): |
63 |
'''Create a thick manifest''' |
64 |
pass |
65 |
|
66 |
+ @staticmethod |
67 |
+ def clear_attic(myheaders): |
68 |
+ '''Old CVS leftover''' |
69 |
+ pass |
70 |
|
71 |
diff --git a/pym/repoman/modules/vcs/cvs/changes.py b/pym/repoman/modules/vcs/cvs/changes.py |
72 |
index 6accd4a..061486f 100644 |
73 |
--- a/pym/repoman/modules/vcs/cvs/changes.py |
74 |
+++ b/pym/repoman/modules/vcs/cvs/changes.py |
75 |
@@ -41,6 +41,27 @@ class Changes(ChangesBase): |
76 |
return self._unadded |
77 |
self._unadded = portage.cvstree.findunadded(self._tree, recursive=1, basedir="./") |
78 |
return self._unadded |
79 |
+ |
80 |
+ @staticmethod |
81 |
+ def clear_attic(myheaders): |
82 |
+ cvs_header_re = re.compile(br'^#\s*\$Header.*\$$') |
83 |
+ attic_str = b'/Attic/' |
84 |
+ attic_replace = b'/' |
85 |
+ for x in myheaders: |
86 |
+ f = open( |
87 |
+ _unicode_encode(x, encoding=_encodings['fs'], errors='strict'), |
88 |
+ mode='rb') |
89 |
+ mylines = f.readlines() |
90 |
+ f.close() |
91 |
+ modified = False |
92 |
+ for i, line in enumerate(mylines): |
93 |
+ if cvs_header_re.match(line) is not None and \ |
94 |
+ attic_str in line: |
95 |
+ mylines[i] = line.replace(attic_str, attic_replace) |
96 |
+ modified = True |
97 |
+ if modified: |
98 |
+ portage.util.write_atomic(x, b''.join(mylines), mode='wb') |
99 |
+ |
100 |
def thick_manifest(self, myupdates, myheaders, no_expansion, expansion): |
101 |
headerstring = "'\$(Header|Id).*\$'" |