blob: 11b26f9f3556fed39e4ed78e987cb44131332576 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import sys
sys.path.append("../..")
from tinderbox import Tinderbox
import unittest
import portage
from util import flatten_deps
class TinderboxTest(unittest.TestCase):
def setUp(self):
self.tb = Tinderbox()
self.trees = portage.create_trees()
self.portapi = self.trees[portage.root]["porttree"].dbapi
self.portset = portage.config(clone=portage.settings)
self.pkgs = ['dev-db/hsqldb-1.8.0.9-r1','app-shells/bash-3.2_p39','sys-apps/portage-2.1.4.5']
def testCreateDepGroups(self):
settings = self.portset
portapi = self.portapi
for pkg in self.pkgs:
deps = portapi.aux_get(pkg, ["DEPEND"])
deps = portage.dep.paren_reduce(deps[0])
settings.setcpv(pkg, mydb=self.portapi)
use_enabled = set(settings["PORTAGE_USE"].split())
iuse = set(settings["IUSE"].split())
use_deps = portage.dep.use_reduce(deps, list(use_enabled & iuse))
use_deps = self.tb._normalize_dependencies(use_deps)
use_deps = flatten_deps(use_deps)
print self.tb.create_dep_groups(use_deps)
if __name__ == '__main__':
unittest.main()
|