Merge lp:~mvo/ubuntu-release-upgrader/text-install-progress into lp:ubuntu-release-upgrader

Proposed by Michael Vogt
Status: Merged
Merged at revision: 2796
Proposed branch: lp:~mvo/ubuntu-release-upgrader/text-install-progress
Merge into: lp:ubuntu-release-upgrader
Diff against target: 61 lines (+31/-1)
2 files modified
DistUpgrade/DistUpgradeViewText.py (+20/-1)
README.devel (+11/-0)
To merge this branch: bzr merge lp:~mvo/ubuntu-release-upgrader/text-install-progress
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+176872@code.launchpad.net

Description of the change

This tiny branch adds progress information into the text-mode upgrader.
Useful to guess how long the upgrade will take.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

P.S. If this looks good I'm happy to do the merge/upload, just want to have a additional pair of eyes on it.

Revision history for this message
Brian Murray (brian-murray) wrote :

I saw Total Progess [02.02] which doesn't seem that informative to me. A whole number followed by a percent sign would be more informative e.g. "Total Progress [22%]".

review: Needs Fixing
Revision history for this message
Michael Vogt (mvo) wrote :

Indeed, good point. I added the "%" at the end now.

Revision history for this message
Michael Vogt (mvo) wrote :

Is there a chance that this gets in for trusty?

It would be nice to have some progress reporting for users who do server upgrades. But I understand that the added string will probably need a exception (or multiple ones) at this point.

Thanks,
 Michael

Revision history for this message
Michael Vogt (mvo) wrote :

I updated the branch now so that it avoids a string break. Still a FeatureFreezeException required I guess.

Revision history for this message
Brian Murray (brian-murray) wrote :

The file README.devel actually contains a typo or two in that it mentions ubuntu-release-upgrade not ubuntu-release-upgrader.

Revision history for this message
Brian Murray (brian-murray) wrote :

I've tested this again and see "Progress [ 15%]" now, so this looks good to me. Sorry for the delay in getting this reviewed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DistUpgrade/DistUpgradeViewText.py'
2--- DistUpgrade/DistUpgradeViewText.py 2012-12-13 16:42:43 +0000
3+++ DistUpgrade/DistUpgradeViewText.py 2014-04-08 09:16:22 +0000
4@@ -24,6 +24,7 @@
5 import sys
6 import logging
7 import subprocess
8+from gettext import dgettext
9
10 import apt
11 import os
12@@ -51,6 +52,24 @@
13 return True
14
15
16+class TextInstallProgress(InstallProgress):
17+
18+ # percent step when progress is reported (to avoid screen spam)
19+ MIN_REPORTING = 5
20+
21+ def __init__(self, *args, **kwargs):
22+ super(TextInstallProgress, self).__init__(*args, **kwargs)
23+ self._prev_percent = 0
24+
25+ def status_change(self, pkg, percent, status):
26+ if self._prev_percent + self.MIN_REPORTING < percent:
27+ # FIXME: move into ubuntu-release-upgrader after trusty
28+ domain = "libapt-pkg4.12"
29+ progress_str = dgettext(domain, "Progress: [%3i%%]") % int(percent)
30+ sys.stdout.write("\r\n%s\r\n" % progress_str)
31+ self._prev_percent = percent
32+
33+
34 class TextCdromProgressAdapter(apt.progress.base.CdromProgress):
35 """ Report the cdrom add progress """
36 def update(self, text, step):
37@@ -88,7 +107,7 @@
38 self._opCacheProgress = apt.progress.text.OpProgress()
39 self._acquireProgress = TextAcquireProgress()
40 self._cdromProgress = TextCdromProgressAdapter()
41- self._installProgress = InstallProgress()
42+ self._installProgress = TextInstallProgress()
43 sys.excepthook = self._handleException
44 #self._process_events_tick = 0
45
46
47=== added file 'README.devel'
48--- README.devel 1970-01-01 00:00:00 +0000
49+++ README.devel 2014-04-08 09:16:22 +0000
50@@ -0,0 +1,11 @@
51+How to test run the release-upgrade
52+===================================
53+
54+In a VM or chroot run:
55+$ bzr co lp:ubuntu-release-upgrade
56+$ cd ubuntu-release-upgrade/DistUpgrade
57+$ sudo ./dist-upgrade --datadir=../data
58+
59+or to test a specific frontend
60+$ sudo ./dist-upgrade --datadir=../data --frontend DistUpgradeViewText
61+(or DistUpgradeViewGtk3)

Subscribers

People subscribed via source and target branches