return f
-def current_emerges(f):
- packages = []
- for line in f:
- if ((">>>" in line) and ("emerge" in line)):
- part = line.partition(' ')
-
- time = float(part[0].strip(":"))
+def list_emerge_processes(f):
- # The logfile string is in form of
- # '1309638757: >>> emerge (1 of 1) x11-libs/cairo-1.10.2-r1 to /'
- # so the package is the sixth string pattern when partitioed
- # with whitespace
- for i in range(7):
- part = part[2].partition(' ')
+ packages = []
+ for i in os.popen("ps ax"):
+ if (("ebuild" in i) and ("/bin/bash" not in i)):
+ pack = i.partition('[')[2].partition(']')[0]
- packages.append((part[0], time))
+ packages.append([pack, 0])
+ for line in f:
for p in packages:
- if ((p[0] in line) and ('completed emerge' in line)):
- packages.remove(p)
+ if ((p[0] in line) and (">>>" in line) and ("emerge" in line)):
+ time = float(line.partition(' ')[0].strip(":"))
+ if time > p[1]:
+ p[1] = time
a = 1
for p in packages:
main_loop(f, name, True)
+
def main_loop(f, package, silent):
global emerge_number
emerge_number = 0
f = open_log()
if status == 'current':
- current_packages = current_emerges(f)
+ list_emerge_processes(f)
return
else:
pass