Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/pm/, PMSTestSuite/
Date: Tue, 31 May 2011 08:10:18
Message-Id: b03e95f288317a206980038576a1b5f00cf7abe9.mgorny@gentoo
1 commit: b03e95f288317a206980038576a1b5f00cf7abe9
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 31 07:59:48 2011 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue May 31 07:59:48 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=b03e95f2
7
8 Support unmerging packages before proceeding.
9
10 ---
11 PMSTestSuite/pm/__init__.py | 10 ++++++++++
12 PMSTestSuite/pm/portage.py | 7 ++++++-
13 PMSTestSuite/testrunner.py | 2 ++
14 3 files changed, 18 insertions(+), 1 deletions(-)
15
16 diff --git a/PMSTestSuite/pm/__init__.py b/PMSTestSuite/pm/__init__.py
17 index 8189f83..0ab91b3 100644
18 --- a/PMSTestSuite/pm/__init__.py
19 +++ b/PMSTestSuite/pm/__init__.py
20 @@ -60,6 +60,16 @@ class PackageManager(object):
21 """
22 raise NotImplementedError('Please override the merge() method.')
23
24 + def unmerge(self, atoms):
25 + """
26 + Run PM to unmerge <atoms>.
27 +
28 + Returns True if PM run successfully, False otherwise. Please note that
29 + this return code may not have anything to do with ebuilds actually
30 + getting removed.
31 + """
32 + raise NotImplementedError('Please override the unmerge() method.')
33 +
34 def get_package_managers():
35 """ Return the list of supported Package Managers. """
36
37
38 diff --git a/PMSTestSuite/pm/portage.py b/PMSTestSuite/pm/portage.py
39 index d31bd44..4fbeda2 100644
40 --- a/PMSTestSuite/pm/portage.py
41 +++ b/PMSTestSuite/pm/portage.py
42 @@ -22,7 +22,7 @@ class PortagePM(PackageManager):
43 import portage
44 except ImportError:
45 return False
46 -
47 +
48 ret = True
49 for prog in (cls.emerge_path, cls.repoman_path):
50 ret &= os.access(prog, os.X_OK)
51 @@ -39,3 +39,8 @@ class PortagePM(PackageManager):
52 ret = subprocess.call([self.emerge_path] + atoms,
53 env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)})
54 return ret == 0
55 +
56 + def unmerge(self, atoms):
57 + ret = subprocess.call([self.emerge_path, '--unmerge'] + atoms,
58 + env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)})
59 + return ret == 0
60
61 diff --git a/PMSTestSuite/testrunner.py b/PMSTestSuite/testrunner.py
62 index c1d2597..76f7071 100644
63 --- a/PMSTestSuite/testrunner.py
64 +++ b/PMSTestSuite/testrunner.py
65 @@ -9,6 +9,8 @@ class TestRunnerCLI(EbuildGenCLI):
66
67 self.pm.append_repository(self.repository)
68 atoms = ['=%s' % t.p for t in self.test_library]
69 + print('-> Unmerging already-merged test ebuilds...')
70 + self.pm.unmerge(atoms)
71 print('-> Running PM...')
72 self.pm.merge(atoms)