1 |
commit: b04e18f2d700d822969a6a9f7e38d4d64a9a5835 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 10 18:08:55 2016 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 8 02:54:47 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b04e18f2 |
7 |
|
8 |
repoman: Migrate add items to the vcs modules |
9 |
|
10 |
pym/repoman/actions.py | 25 +------------------------ |
11 |
pym/repoman/modules/vcs/None/changes.py | 4 ++++ |
12 |
pym/repoman/modules/vcs/changes.py | 20 ++++++++++++++++++++ |
13 |
3 files changed, 25 insertions(+), 24 deletions(-) |
14 |
|
15 |
diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py |
16 |
index 4209d13..d2e4fc1 100644 |
17 |
--- a/pym/repoman/actions.py |
18 |
+++ b/pym/repoman/actions.py |
19 |
@@ -411,30 +411,7 @@ class Actions(object): |
20 |
|
21 |
if myautoadd: |
22 |
print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...") |
23 |
- add_cmd = [self.vcs_settings.vcs, "add"] |
24 |
- add_cmd += myautoadd |
25 |
- if self.options.pretend: |
26 |
- portage.writemsg_stdout( |
27 |
- "(%s)\n" % " ".join(add_cmd), |
28 |
- noiselevel=-1) |
29 |
- else: |
30 |
- |
31 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \ |
32 |
- not os.path.isabs(add_cmd[0]): |
33 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
34 |
- # path passed as bytes (see http://bugs.python.org/issue8513). |
35 |
- fullname = find_binary(add_cmd[0]) |
36 |
- if fullname is None: |
37 |
- raise portage.exception.CommandNotFound(add_cmd[0]) |
38 |
- add_cmd[0] = fullname |
39 |
- |
40 |
- add_cmd = [_unicode_encode(arg) for arg in add_cmd] |
41 |
- retcode = subprocess.call(add_cmd) |
42 |
- if retcode != os.EX_OK: |
43 |
- logging.error( |
44 |
- "Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode)) |
45 |
- sys.exit(retcode) |
46 |
- |
47 |
+ self.vcs_settings.changes.add_items(myautoadd) |
48 |
myupdates += myautoadd |
49 |
return myupdates, broken_changelog_manifests |
50 |
|
51 |
|
52 |
diff --git a/pym/repoman/modules/vcs/None/changes.py b/pym/repoman/modules/vcs/None/changes.py |
53 |
index 37693ad..98beedb 100644 |
54 |
--- a/pym/repoman/modules/vcs/None/changes.py |
55 |
+++ b/pym/repoman/modules/vcs/None/changes.py |
56 |
@@ -22,3 +22,7 @@ class Changes(ChangesBase): |
57 |
def scan(self): |
58 |
'''VCS type scan function, looks for all detectable changes''' |
59 |
pass |
60 |
+ |
61 |
+ def add_items(self, myautoadd): |
62 |
+ '''Nothing to add them to''' |
63 |
+ pass |
64 |
|
65 |
diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py |
66 |
index 948407c..ee94217 100644 |
67 |
--- a/pym/repoman/modules/vcs/changes.py |
68 |
+++ b/pym/repoman/modules/vcs/changes.py |
69 |
@@ -2,9 +2,14 @@ |
70 |
Base Changes class |
71 |
''' |
72 |
|
73 |
+import logging |
74 |
import os |
75 |
+import subprocess |
76 |
+import sys |
77 |
from itertools import chain |
78 |
|
79 |
+from repoman._portage import portage |
80 |
+from portage import _unicode_encode |
81 |
|
82 |
class ChangesBase(object): |
83 |
'''Base Class object to scan and hold the resultant data |
84 |
@@ -89,3 +94,18 @@ class ChangesBase(object): |
85 |
def update_index(self, mymanifests, myupdates): |
86 |
'''Update the vcs's modified index if it is needed''' |
87 |
pass |
88 |
+ |
89 |
+ def add_items(self, myautoadd): |
90 |
+ add_cmd = [self.vcs, "add"] |
91 |
+ add_cmd += myautoadd |
92 |
+ if self.options.pretend: |
93 |
+ portage.writemsg_stdout( |
94 |
+ "(%s)\n" % " ".join(add_cmd), |
95 |
+ noiselevel=-1) |
96 |
+ else: |
97 |
+ add_cmd = [_unicode_encode(arg) for arg in add_cmd] |
98 |
+ retcode = subprocess.call(add_cmd) |
99 |
+ if retcode != os.EX_OK: |
100 |
+ logging.error( |
101 |
+ "Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode)) |
102 |
+ sys.exit(retcode) |