blob: 33f7bf9021bb9357ec2d55b10effee66517f9275 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
import portage
from gentoostats.dbapi import VARDB
from gentoolkit.enalyze.lib import FlagAnalyzer
from gentoolkit.enalyze.lib import KeywordAnalyser
class Metadata(object):
"""
A class encapsulating all package metadata
"""
def __init__(self, cpv):
"""
Initialize the class with the cpv. All metadata are read from portage
"""
self.repo, self.counter, self.build_time, self.size = VARDB.aux_get(cpv, ['repository', 'COUNTER', 'BUILD_TIME', 'SIZE'])
system_use = portage.settings['USE'].split()
fa = FlagAnalyzer(system=system_use)
self.flags = fa.analyse_cpv(cpv)
arch = portage.settings['ARCH']
accept_keywords = portage.settings['ACCEPT_KEYWORDS'].split()
ka = KeywordAnalyser(arch=arch, accept_keywords=accept_keywords)
self.keyword = ka.get_inst_keyword_cpv(cpv)
def getPlusFlags(self):
"""
Return list of enabled useflags
"""
return list(self.flags[0])
def getMinusFlags(self):
"""
Return list of disabled useflags
"""
return list(self.flags[1])
def getUnsetFlags(self):
"""
Return list of unset useflags
"""
return list(self.flags[2])
def getKeyword(self):
"""
Return keyword used to install package
"""
return self.keyword
def getRepoName(self):
"""
Return the repository the package was installed from
"""
if self.repo:
return self.repo
return 'Unknown'
def getCounter(self):
"""
Return the package install counter. How's this useful ?
"""
return self.counter
def getBuildTime(self):
"""
Return the time package was built
"""
return self.build_time
def getSize(self):
"""
Return the size of the installed package
"""
return self.size
|