From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Hershberger Date: Wed, 13 May 2015 17:28:55 -0500 Subject: [U-Boot] [PATCH v3 09/10] moveconfig: Print status about the processed defconfigs In-Reply-To: <1431556137-8426-1-git-send-email-joe.hershberger@ni.com> References: <1431364998-2905-1-git-send-email-joe.hershberger@ni.com> <1431556137-8426-1-git-send-email-joe.hershberger@ni.com> Message-ID: <1431556137-8426-9-git-send-email-joe.hershberger@ni.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This gives a basic idea about progress. Signed-off-by: Joe Hershberger --- Changes in v3: -New for version 3 Changes in v2: None tools/moveconfig.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 798f717..bb087d4 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -93,7 +93,7 @@ def cleanup_header(header_path, patterns): def cleanup_headers(config_attrs): while True: - choice = raw_input('Clean up headers? [y/n]: ').lower() + choice = raw_input('\nClean up headers? [y/n]: ').lower() print choice if choice == 'y' or choice == 'n': break @@ -264,7 +264,7 @@ class Slot: pass shutil.rmtree(self.build_dir) - def add(self, defconfig): + def add(self, defconfig, num, total): """Add a new subprocess to the slot. Fails if the slot is occupied, that is, the current subprocess @@ -283,6 +283,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 defconfig_error(self, errmsg): @@ -323,6 +325,9 @@ class Slot: self.state = STATE_IDLE return True + 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') @@ -366,7 +371,7 @@ class Slots: for i in range(options.jobs): self.slots.append(Slot(config_attrs, devnull, make_cmd, options)) - def add(self, defconfig): + def add(self, defconfig, num, total): """Add a new subprocess if a vacant slot is available. Arguments: @@ -376,7 +381,7 @@ class Slots: Return True on success or False on fail """ for slot in self.slots: - if slot.add(defconfig): + if slot.add(defconfig, num, total): return True return False @@ -436,8 +441,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) -- 1.7.11.5