[U-Boot] [PATCH v4 10/10] moveconfig: Print status about the processed defconfigs

Joe Hershberger joe.hershberger at ni.com
Fri May 15 23:40:52 CEST 2015


This gives a basic idea about progress.

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>

---

Changes in v4: None
Changes in v3:
-New for version 3

Changes in v2: None

 tools/moveconfig.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 685b47b..fca0197 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -568,7 +568,7 @@ class Slot:
                 pass
         shutil.rmtree(self.build_dir)
 
-    def add(self, defconfig):
+    def add(self, defconfig, num, total):
         """Assign a new subprocess for defconfig and add it to the slot.
 
         If the slot is vacant, create a new subprocess for processing the
@@ -588,6 +588,8 @@ class Slot:
         self.ps = subprocess.Popen(cmd, stdout=self.devnull)
         self.defconfig = defconfig
         self.state = STATE_DEFCONFIG
+        self.num = num
+        self.total = total
         return True
 
     def poll(self):
@@ -634,6 +636,9 @@ class Slot:
         if self.state == STATE_AUTOCONF:
             self.parser.update_defconfig(self.defconfig)
 
+            print ' %d defconfigs out of %d\r' % (self.num + 1, self.total),
+            sys.stdout.flush()
+
             """Save off the defconfig in a consistent way"""
             cmd = list(self.make_cmd)
             cmd.append('savedefconfig')
@@ -688,7 +693,7 @@ class Slots:
         for i in range(options.jobs):
             self.slots.append(Slot(config_attrs, options, devnull, make_cmd))
 
-    def add(self, defconfig):
+    def add(self, defconfig, num, total):
         """Add a new subprocess if a vacant slot is found.
 
         Arguments:
@@ -698,7 +703,7 @@ class Slots:
           Return True on success or False on failure
         """
         for slot in self.slots:
-            if slot.add(defconfig):
+            if slot.add(defconfig, num, total):
                 return True
         return False
 
@@ -784,8 +789,8 @@ def move_config(config_attrs, options):
     # Main loop to process defconfig files:
     #  Add a new subprocess into a vacant slot.
     #  Sleep if there is no available slot.
-    for defconfig in defconfigs:
-        while not slots.add(defconfig):
+    for i, defconfig in enumerate(defconfigs):
+        while not slots.add(defconfig, i, len(defconfigs)):
             while not slots.available():
                 # No available slot: sleep for a while
                 time.sleep(SLEEP_TIME)
@@ -794,6 +799,7 @@ def move_config(config_attrs, options):
     while not slots.empty():
         time.sleep(SLEEP_TIME)
 
+    print ''
     slots.show_failed_boards()
 
 def bad_recipe(filename, linenum, msg):
-- 
1.7.11.5



More information about the U-Boot mailing list