1 |
commit: 4c4d152413a0b112eb0ba35528b492c0f8d95e7a |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 31 08:08:06 2011 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 31 08:08:06 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=4c4d1524 |
7 |
|
8 |
Support specifying additional PM options. |
9 |
|
10 |
--- |
11 |
PMSTestSuite/cli.py | 5 ++++- |
12 |
PMSTestSuite/pm/__init__.py | 1 + |
13 |
PMSTestSuite/pm/portage.py | 4 ++-- |
14 |
3 files changed, 7 insertions(+), 3 deletions(-) |
15 |
|
16 |
diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py |
17 |
index b5c8921..713b1a0 100644 |
18 |
--- a/PMSTestSuite/cli.py |
19 |
+++ b/PMSTestSuite/cli.py |
20 |
@@ -2,7 +2,7 @@ |
21 |
# (c) 2011 Michał Górny <mgorny@g.o> |
22 |
# Released under the terms of the 2-clause BSD license. |
23 |
|
24 |
-import os.path |
25 |
+import os.path, shlex |
26 |
|
27 |
from optparse import OptionParser |
28 |
|
29 |
@@ -45,6 +45,8 @@ class PMSTestSuiteCLI(object): |
30 |
opt.add_option('-p', '--package-manager', dest='pm', |
31 |
help='Package manager to use', |
32 |
default='portage') |
33 |
+ opt.add_option('-P', '--pm-options', dest='pmopts', |
34 |
+ help='Additional options to pass to the Package Manager (shell-quoted)') |
35 |
|
36 |
self.optparser = opt |
37 |
|
38 |
@@ -71,6 +73,7 @@ class PMSTestSuiteCLI(object): |
39 |
break |
40 |
else: |
41 |
opt.error('Package manager not supported: %s' % opts.pm) |
42 |
+ self.pm.pm_options = shlex.split(opts.pmopts) |
43 |
|
44 |
try: |
45 |
self.repository = EbuildRepository(opts.repo_path) |
46 |
|
47 |
diff --git a/PMSTestSuite/pm/__init__.py b/PMSTestSuite/pm/__init__.py |
48 |
index 0ab91b3..9a2d5ed 100644 |
49 |
--- a/PMSTestSuite/pm/__init__.py |
50 |
+++ b/PMSTestSuite/pm/__init__.py |
51 |
@@ -15,6 +15,7 @@ class PackageManager(object): |
52 |
Base class for various package managers support. |
53 |
""" |
54 |
|
55 |
+ pm_options = [] |
56 |
repo_paths = [] |
57 |
|
58 |
@property |
59 |
|
60 |
diff --git a/PMSTestSuite/pm/portage.py b/PMSTestSuite/pm/portage.py |
61 |
index 4fbeda2..71672c0 100644 |
62 |
--- a/PMSTestSuite/pm/portage.py |
63 |
+++ b/PMSTestSuite/pm/portage.py |
64 |
@@ -36,11 +36,11 @@ class PortagePM(PackageManager): |
65 |
os.chdir(startdir) |
66 |
|
67 |
def merge(self, atoms): |
68 |
- ret = subprocess.call([self.emerge_path] + atoms, |
69 |
+ ret = subprocess.call([self.emerge_path] + self.pm_options + atoms, |
70 |
env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)}) |
71 |
return ret == 0 |
72 |
|
73 |
def unmerge(self, atoms): |
74 |
- ret = subprocess.call([self.emerge_path, '--unmerge'] + atoms, |
75 |
+ ret = subprocess.call([self.emerge_path, '--unmerge'] + self.pm_options + atoms, |
76 |
env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)}) |
77 |
return ret == 0 |