1 |
import portage |
2 |
|
3 |
class conf: |
4 |
def config(self, my): |
5 |
return portage.settings[my] |
6 |
|
7 |
def wholeConfig(self): |
8 |
ret="" |
9 |
for x in [ 'PORTDIR', 'PORTAGE_TMPDIR', 'DISTDIR', 'PKGDIR', 'RPMDIR', |
10 |
'PORTDIR_OVERLAY', 'SYNC', 'CHOST', 'CFLAGS', 'CXXFLAGS', 'MAKEOPTS', |
11 |
'ARCH', 'FETCHCOMMAND', 'RESUMECOMMAND', 'HTTP_PROXY', 'FTP_PROXY', |
12 |
'RSYNC_PROXY', 'NOCOLOR', 'AUTOCLEAN', 'DEBUGBUILD', 'GENTOO_MIRRORS', |
13 |
'USE_ORDER', 'FEATURES', 'ACCEPT_KEYWORDS', 'CONFIG_PROTECT', |
14 |
'CONFIG_PROTECT_MASK', 'USE', 'CLEAN_DELAY', 'PORT_LOGDIR', 'PORTAGE_CACHEDIR']: |
15 |
ret = ret+x+'="'+portage.settings[x]+'"++' |
16 |
return ret |
17 |
|
18 |
def useOrderUse(self, my=""): |
19 |
portageConf=portage.config() |
20 |
useorder=my |
21 |
if not useorder: |
22 |
useorder="env:conf:auto:defaults" |
23 |
usevaluelist=useorder.split(":") |
24 |
portageConf.uvlist=[] |
25 |
for x in usevaluelist: |
26 |
if portageConf.configdict.has_key(x): |
27 |
portageConf.uvlist[0:0]=[portageConf.configdict[x]] |
28 |
portageConf.regenerate() |
29 |
return portageConf["USE"] |
30 |
|
31 |
|
32 |
def confWithoutMakeConf(self, my): |
33 |
"""returns the config of "my" in make.defaults, make.globals and autouse, |
34 |
_not_ in make.conf! this is needed for ParseMakeConfs::merge() to |
35 |
get the difference between onDisk and configured by the gui for the |
36 |
incrementals""" |
37 |
portageConf=portage.config() |
38 |
ret="" |
39 |
keylist = ["globals", "defaults"] |
40 |
for x in keylist: |
41 |
if portageConf.configdict[x].has_key(my): |
42 |
ret = portageConf.configdict[x][my] + " " + ret |
43 |
return ret |
44 |
|
45 |
def auxdbkeys(self, my): |
46 |
"""returns auxdbkeys from my, my is a cpv""" |
47 |
ret="" |
48 |
mylist=[] |
49 |
myauxkeys=["SLOT","SRC_URI","HOMEPAGE","LICENSE","DESCRIPTION", |
50 |
"KEYWORDS","IUSE"] |
51 |
try: |
52 |
mylist = portage.portdb.aux_get(my,myauxkeys) |
53 |
except KeyError: |
54 |
print "Error on fetching aux_keys" |
55 |
# ebuilds which are only in /var/db/pkg doesn't work yet |
56 |
# (and there is no easy way in portage i've found ;) |
57 |
for x in mylist: |
58 |
ret = ret+x+"++" |
59 |
return ret |
60 |
|
61 |
def ismasked(self, my): |
62 |
ret = portage.portdb.visible([my]) |
63 |
if(ret): |
64 |
ret = portage.portdb.gvisible([my]) |
65 |
if (ret == [my]): |
66 |
return "false" |
67 |
else: |
68 |
return "true" |
69 |
|
70 |
|
71 |
#myconf = conf() |
72 |
#print myconf.ismasked("sys-kernel/gentoo-sources-2.4.20-r1") |
73 |
#print myconf.auxdbkeys("app-admin/kportage-5") |