1 |
commit: bf3905892670dd294eb8ae5680920b09d1c77230 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 31 11:44:32 2011 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 31 11:44:32 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=bf390589 |
7 |
|
8 |
Pass cpvs to PM.merge()/unmerge(). Unmerge only when merged. |
9 |
|
10 |
--- |
11 |
PMSTestSuite/pm/__init__.py | 8 ++++---- |
12 |
PMSTestSuite/pm/portagepm.py | 13 ++++++++----- |
13 |
PMSTestSuite/testrunner.py | 12 ++++++++---- |
14 |
3 files changed, 20 insertions(+), 13 deletions(-) |
15 |
|
16 |
diff --git a/PMSTestSuite/pm/__init__.py b/PMSTestSuite/pm/__init__.py |
17 |
index 9838822..cc6d3d5 100644 |
18 |
--- a/PMSTestSuite/pm/__init__.py |
19 |
+++ b/PMSTestSuite/pm/__init__.py |
20 |
@@ -51,9 +51,9 @@ class PackageManager(object): |
21 |
""" |
22 |
self.repo_paths.append(repo.path) |
23 |
|
24 |
- def merge(self, atoms): |
25 |
+ def merge(self, cpvs): |
26 |
""" |
27 |
- Run PM to merge <atoms>. |
28 |
+ Run PM to merge <cpvs>. |
29 |
|
30 |
Returns True if PM run successfully, False otherwise. Please note that |
31 |
this return code may not have anything to do with ebuilds actually |
32 |
@@ -61,9 +61,9 @@ class PackageManager(object): |
33 |
""" |
34 |
raise NotImplementedError('Please override the merge() method.') |
35 |
|
36 |
- def unmerge(self, atoms): |
37 |
+ def unmerge(self, cpvs): |
38 |
""" |
39 |
- Run PM to unmerge <atoms>. |
40 |
+ Run PM to unmerge <cpvs>. |
41 |
|
42 |
Returns True if PM run successfully, False otherwise. Please note that |
43 |
this return code may not have anything to do with ebuilds actually |
44 |
|
45 |
diff --git a/PMSTestSuite/pm/portagepm.py b/PMSTestSuite/pm/portagepm.py |
46 |
index 9d5fa0b..d73406b 100644 |
47 |
--- a/PMSTestSuite/pm/portagepm.py |
48 |
+++ b/PMSTestSuite/pm/portagepm.py |
49 |
@@ -35,14 +35,17 @@ class PortagePM(PackageManager): |
50 |
subprocess.check_call([self.repoman_path, 'manifest']) |
51 |
os.chdir(startdir) |
52 |
|
53 |
- def merge(self, atoms): |
54 |
- ret = subprocess.call([self.emerge_path] + self.pm_options + atoms, |
55 |
+ def call_emerge(self, cpvs, opts = []): |
56 |
+ return subprocess.call([self.emerge_path] + opts + self.pm_options |
57 |
+ + ['=%s' % cpv for cpv in cpvs], |
58 |
env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)}) |
59 |
+ |
60 |
+ def merge(self, cpvs): |
61 |
+ ret = self.call_emerge(cpvs) |
62 |
return ret == 0 |
63 |
|
64 |
- def unmerge(self, atoms): |
65 |
- ret = subprocess.call([self.emerge_path, '--unmerge'] + self.pm_options + atoms, |
66 |
- env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)}) |
67 |
+ def unmerge(self, cpvs): |
68 |
+ ret = self.call_emerge(cpvs, ['--unmerge']) |
69 |
return ret == 0 |
70 |
|
71 |
_vardb = None |
72 |
|
73 |
diff --git a/PMSTestSuite/testrunner.py b/PMSTestSuite/testrunner.py |
74 |
index 76f7071..703ae31 100644 |
75 |
--- a/PMSTestSuite/testrunner.py |
76 |
+++ b/PMSTestSuite/testrunner.py |
77 |
@@ -8,10 +8,14 @@ class TestRunnerCLI(EbuildGenCLI): |
78 |
return ret |
79 |
|
80 |
self.pm.append_repository(self.repository) |
81 |
- atoms = ['=%s' % t.p for t in self.test_library] |
82 |
- print('-> Unmerging already-merged test ebuilds...') |
83 |
- self.pm.unmerge(atoms) |
84 |
+ cpvs = [t.p for t in self.test_library] |
85 |
+ |
86 |
+ installedcpvs = self.pm.lookup_vardb(cpvs) |
87 |
+ if installedcpvs: |
88 |
+ print('-> Unmerging already-merged test ebuilds...') |
89 |
+ self.pm.unmerge(installedcpvs) |
90 |
+ |
91 |
print('-> Running PM...') |
92 |
- self.pm.merge(atoms) |
93 |
+ self.pm.merge(cpvs) |
94 |
|
95 |
return 0 |