the command for the package. With this package search the LOGFILE for
the emerge startup time."""
-
+ now = datetime.datetime.today()
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([pack, 0])
+ packages.append([pack, 12*3600])
for line in f:
if (p[0] in line):
time = float(line.partition(' ')[0].strip(":"))
- if time > p[1]:
- p[1] = time
+
+ timestamp = datetime.datetime.fromtimestamp(time)
+ difference = (now - timestamp).total_seconds()
+
+ if difference < p[1]:
+ p[1] = difference
if len(packages) == 0:
print "No current emerge process found."
return
+ print_current_emerges(f, packages)
+
- # Here we go through all the packages we have found and
- # printout the current emerge time
- a = 1
- for p in packages:
- now = datetime.datetime.today()
- timestamp = datetime.datetime.fromtimestamp(p[1])
- difference = now - timestamp
+def print_current_emerges(f, packages):
+ """Print the current packages that are being merged with the
+ current emerge time."""
- if a:
- print("Currently emerging: ")
- a = 0
+ print("Currently emerging: ")
+ for p in packages:
print("\t" + green_start + p[0] + color_stop),
print('\n\t current emerge time: '),
- organize_times(difference.total_seconds())
+ organize_times(p[1])
print
name = (p[0].partition('-')[0] + '-' +
p[0].partition('-')[2].partition('-')[0])
+
main_loop(f, name, True)