[PATCH] For yum-based installs, move the progress bar while packages are installing.
vpodzime at redhat.com
Wed Sep 3 10:52:27 UTC 2014
On Tue, 2014-09-02 at 14:27 -0400, Chris Lumens wrote:
> It's impossible to know how many packages will be installed before we start
> doing stuff with the progress bar. Just look at how realmd is handled to
> understand that. Thus, just move the bar along for every 10% of packages.
> This also has the effect of making all the other steps of installation take
> less of the total amount of the progress bar which makes package installation
> look a little more serious.
> Other payloads can gain this as-needed, though right now it looks like the
> dnf payload would be the most critical.
> Related: rhbz#1024403
> pyanaconda/install.py | 5 +++++
> pyanaconda/packaging/yumpayload.py | 7 +++++++
> scripts/anaconda-yum | 3 +++
> 3 files changed, 15 insertions(+)
> diff --git a/pyanaconda/install.py b/pyanaconda/install.py
> index 8e7d0d6..b9d4ef9 100644
> --- a/pyanaconda/install.py
> +++ b/pyanaconda/install.py
> @@ -145,6 +145,11 @@ def doInstall(storage, payload, ksdata, instClass):
> steps = len(storage.devicetree.findActions(action_type="create", object_type="format")) + \
> len(storage.devicetree.findActions(action_type="resize", object_type="format"))
> + # Update every 10% of packages installed. We don't know how many packages
> + # we are installing until it's too late (see realmd later on) so this is
> + # the best we can do.
> + steps += 10
> # pre setup phase, post install
> steps += 2
> diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
> index 5e56347..cae752f 100644
> --- a/pyanaconda/packaging/yumpayload.py
> +++ b/pyanaconda/packaging/yumpayload.py
> @@ -1414,6 +1414,7 @@ reposdir=%s
> log.info("Running anaconda-yum to install packages")
> # Watch output for progress, debug and error information
> install_errors = 
> + prev = 0
> for line in execReadlines("/usr/libexec/anaconda/anaconda-yum", args):
> if line.startswith("PROGRESS_"):
> @@ -1421,6 +1422,12 @@ reposdir=%s
> msg = progress_map[key] + text
> + elif line.startswith("PERCENT:"):
> + _key, pct = line.split(":", 1)
> + if float(pct) // 10 > prev // 10:
> + progressQ.send_step()
> + prev = float(pct)
> elif line.startswith("DEBUG:"):
> elif line.startswith("INFO:"):
> diff --git a/scripts/anaconda-yum b/scripts/anaconda-yum
> index 52c461d..4538aab 100755
> --- a/scripts/anaconda-yum
> +++ b/scripts/anaconda-yum
> @@ -380,6 +380,9 @@ class RPMCallback(object):
> # display the message.
> if self.completed_actions == self.total_actions:
> + elif self.completed_actions is not None and self.total_actions is not None:
> + pct = 100 * (self.completed_actions/float(self.total_actions))
Please add spaces around the operator here ^.
> + print("PERCENT: %f" % pct)
> def cpio_error(self, amount, total, key, data):
> name = self._get_txmbr(key)
A very neat solution for a long-term issue. ACK!
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches