]> git.itanic.dy.fi Git - emerge-timer/commitdiff
Add support for showing emerge sync history
authorEsko Kokkonen <esko.kokkonen@gmail.com>
Sat, 21 Jan 2012 14:34:11 +0000 (16:34 +0200)
committerEsko Kokkonen <esko.kokkonen@gmail.com>
Sat, 21 Jan 2012 14:34:11 +0000 (16:34 +0200)
emerge-timer.py

index e314493e03f9f4cb8dfbfb712eb7d35a3be2128e..baffb73669612958934b2f090fd86a002d53e2ef 100755 (executable)
@@ -461,6 +461,23 @@ def list_emerge_processes():
     return 0
 
 
+def search_syncs():
+    f = open_log()
+
+    print "These emerge syncs found"
+    print "\tDate                    Server"
+    print "\t------------------------------"
+
+    for line in f:
+        if "=== Sync completed with" in line:
+            time = float(line.partition(' ')[0].strip(":"))
+            server = line.rpartition(' ')[2]
+
+            print("\t" + GREEN(give_date(time)) +
+                  " === " + server),
+
+
+
 def main(status, user_package=None):
     try:
         _main(status, user_package)
@@ -488,6 +505,11 @@ def _main(status, user_package=None):
                       + " has never been emerged.")
 
 
+    elif status == "sync":
+        search_syncs()
+        return
+
+
     elif status == "list":
         search_log_for_all_packages()
         return
@@ -531,6 +553,7 @@ Options:
 \t-c, --current \t Show time until currently compiling package finishes
 \t-p, --pretended  Calculate compile time from piped 'emerge -p' output
 \t-l, --list \t List all emerged packages
+\t-s, --sync \t Show emerge sync history
 \t-h, --help \t Show this helpscreen
 \t-q, --quiet \t Be less verbose
 \t--no-color \t Use colorless output
@@ -562,6 +585,9 @@ if __name__ == "__main__":
         if arg == "-l" or arg == "--list":
             mode = "list"
 
+        if arg == "-s" or arg == "--sync":
+            mode = "sync"
+
         if arg == "-q" or arg == "--quiet":
             QUIET = True