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: Sun, 29 May 2011 18:57:40
Message-Id: 969ba3809b72fa16d395ec099f41fbc3d735bcb9.mgorny@gentoo
1 commit: 969ba3809b72fa16d395ec099f41fbc3d735bcb9
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 29 18:51:16 2011 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun May 29 18:51:16 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=969ba380
7
8 Support passing repo paths to PM.
9
10 ---
11 PMSTestSuite/pm/__init__.py | 8 ++++++++
12 PMSTestSuite/pm/portage.py | 7 +++++--
13 PMSTestSuite/testrunner.py | 1 +
14 3 files changed, 14 insertions(+), 2 deletions(-)
15
16 diff --git a/PMSTestSuite/pm/__init__.py b/PMSTestSuite/pm/__init__.py
17 index 08b7c25..8189f83 100644
18 --- a/PMSTestSuite/pm/__init__.py
19 +++ b/PMSTestSuite/pm/__init__.py
20 @@ -15,6 +15,8 @@ class PackageManager(object):
21 Base class for various package managers support.
22 """
23
24 + repo_paths = []
25 +
26 @property
27 def name(self):
28 """ Human-readable, short PM name (used in option values). """
29 @@ -42,6 +44,12 @@ class PackageManager(object):
30 """ Regenerate Manifests in given <paths> (should be iterable). """
31 raise NotImplementedError('Please override the remanifest() method.')
32
33 + def append_repository(self, repo):
34 + """
35 + Append the repository <repo> (EbuildRepository) to PM's list of repos.
36 + """
37 + self.repo_paths.append(repo.path)
38 +
39 def merge(self, atoms):
40 """
41 Run PM to merge <atoms>.
42
43 diff --git a/PMSTestSuite/pm/portage.py b/PMSTestSuite/pm/portage.py
44 index 8326856..8a7763f 100644
45 --- a/PMSTestSuite/pm/portage.py
46 +++ b/PMSTestSuite/pm/portage.py
47 @@ -2,7 +2,7 @@
48 # (c) 2011 Michał Górny <mgorny@g.o>
49 # Released under the terms of the 2-clause BSD license.
50
51 -import os, subprocess
52 +import os, os.path, subprocess
53
54 from PMSTestSuite.pm import PackageManager
55
56 @@ -14,6 +14,8 @@ class PortagePM(PackageManager):
57 emerge_path = '/usr/bin/emerge'
58 repoman_path = '/usr/bin/repoman'
59
60 + repo_paths = []
61 +
62 @classmethod
63 def is_available(cls):
64 try:
65 @@ -32,5 +34,6 @@ class PortagePM(PackageManager):
66 subprocess.check_call([self.repoman_path, 'manifest'])
67
68 def merge(self, atoms):
69 - ret = subprocess.call([self.emerge_path] + atoms)
70 + ret = subprocess.call([self.emerge_path] + atoms,
71 + env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)})
72 return ret == 0
73
74 diff --git a/PMSTestSuite/testrunner.py b/PMSTestSuite/testrunner.py
75 index d7ca5c5..c1d2597 100644
76 --- a/PMSTestSuite/testrunner.py
77 +++ b/PMSTestSuite/testrunner.py
78 @@ -7,6 +7,7 @@ class TestRunnerCLI(EbuildGenCLI):
79 if ret != 0:
80 return ret
81
82 + self.pm.append_repository(self.repository)
83 atoms = ['=%s' % t.p for t in self.test_library]
84 print('-> Running PM...')
85 self.pm.merge(atoms)