42 | 42 |
dlist = deps.keys()
|
43 | 43 |
return dlist
|
44 | 44 |
|
45 | |
def pkginstalltime(pkg):
|
46 | |
dpkg_archs = subprocess.Popen(
|
47 | |
['dpkg-architecture', '-L'],
|
|
45 |
|
|
46 |
def localarchitectures():
|
|
47 |
architectures = []
|
|
48 |
dpkg_arch = subprocess.Popen(
|
|
49 |
['dpkg', '--print-architecture'],
|
48 | 50 |
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
49 | 51 |
env={} # force POSIX locale
|
50 | 52 |
)
|
|
53 |
for arch in dpkg_arch.stdout.readlines():
|
|
54 |
architectures.append(arch.rstrip())
|
51 | 55 |
|
52 | |
arch = dpkg_archs.stdout.readline().rstrip()
|
|
56 |
try:
|
|
57 |
dpkg_archs = subprocess.Popen(
|
|
58 |
['dpkg', '--print-foreign-architecture'],
|
|
59 |
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
|
60 |
env={} # force POSIX locale
|
|
61 |
)
|
|
62 |
for arch in dpkg_archs.stdout.readlines():
|
|
63 |
architectures.append(arch.rstrip())
|
|
64 |
|
|
65 |
except OSError:
|
|
66 |
pass # non-multiarchy dpkg, which is ok
|
|
67 |
|
|
68 |
return architectures
|
|
69 |
|
|
70 |
def pkginstalltime(pkg, architectures):
|
53 | 71 |
times = []
|
54 | |
while(arch != ''):
|
|
72 |
for arch in architectures:
|
55 | 73 |
listfile = '/var/lib/dpkg/info/' + pkg + ':' + arch + '.list'
|
56 | 74 |
try:
|
57 | 75 |
times.append([pkg + ':' + arch, os.stat(listfile)[ST_MTIME]])
|
58 | 76 |
except OSError:
|
59 | 77 |
pass
|
60 | |
arch = dpkg_archs.stdout.readline().rstrip()
|
61 | |
dpkg_archs.wait()
|
62 | 78 |
|
63 | 79 |
if not times:
|
64 | 80 |
listfile = '/var/lib/dpkg/info/' + pkg + '.list'
|
|
76 | 92 |
pkgs = [ pname ]
|
77 | 93 |
pkgs.extend(alldeps(sys.argv[1], {}))
|
78 | 94 |
|
|
95 |
architectures = localarchitectures()
|
|
96 |
|
79 | 97 |
itimes = []
|
80 | 98 |
for p in pkgs:
|
81 | |
itimes.extend(pkginstalltime(p))
|
|
99 |
itimes.extend(pkginstalltime(p, architectures))
|
82 | 100 |
itimes.sort(sortfun)
|
83 | 101 |
for i in itimes:
|
84 | 102 |
p, t = i
|