public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] update portage cache progress patch
@ 2006-01-26  4:05 Jason Pepas
  2006-01-26  8:03 ` Brian Harring
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Pepas @ 2006-01-26  4:05 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]

Hi Guys,

I cobbled together a quick little hack to have a little bit more interactivity 
during the "Updating Portage cache" phase.  It prints out the name of the 
package it is updating, along with the percentage progress.

-jason

[-- Attachment #2: portage-cache-update-progress.patch --]
[-- Type: text/x-diff, Size: 1206 bytes --]

--- emerge.orig	2006-01-25 21:36:09.000000000 -0600
+++ emerge	2006-01-25 21:45:08.000000000 -0600
@@ -2647,7 +2647,7 @@
 
 	if os.path.exists(myportdir+"/metadata/cache") and updatecache_flg:
 		if "--quiet" not in myopts:
-			print "\n>>> Updating Portage cache:      ",
+			print "\n>>> Updating Portage cache: ",
 		os.umask(0002)
 		cachedir = os.path.normpath(portage.settings.depcachedir)
 		if cachedir in ["/",    "/bin", "/dev",  "/etc",  "/home",
@@ -2731,15 +2731,20 @@
 		savelist = []
 		catlist = []
 		oldcat = portage.catsplit(cp_list[0])[0]
+		prev_msg_len = 0
 		for cp in cp_list:
 			current += 1
 			if current >= nextupdate:
 				pcnt += 1
 				nextupdate += pcntcount
-				if "--quiet" not in myopts:
-					pcntstr = str(pcnt)
-					sys.stdout.write("\b"*(len(pcntstr)+1)+pcntstr+"%")
-					sys.stdout.flush()
+			if "--quiet" not in myopts:
+				pcntstr = str(pcnt)
+				bksp = "\b" * prev_msg_len
+				msg = pcntstr + "% (" + cp + ")"
+				erasure = " " * max((prev_msg_len - len(msg)),0)
+				prev_msg_len = len(msg + erasure)
+				sys.stdout.write(bksp + msg + erasure)
+				sys.stdout.flush()
 			cat = portage.catsplit(cp)[0]
 			if cat != oldcat:
 				catlist.append(oldcat)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-portage-dev] update portage cache progress patch
  2006-01-26  4:05 [gentoo-portage-dev] update portage cache progress patch Jason Pepas
@ 2006-01-26  8:03 ` Brian Harring
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Harring @ 2006-01-26  8:03 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

On Wed, Jan 25, 2006 at 10:05:31PM -0600, Jason Pepas wrote:
> Hi Guys,
> 
> I cobbled together a quick little hack to have a little bit more interactivity 
> during the "Updating Portage cache" phase.  It prints out the name of the 
> package it is updating, along with the percentage progress.

Err... might want to split that against 2.1.

~harring

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-26  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-26  4:05 [gentoo-portage-dev] update portage cache progress patch Jason Pepas
2006-01-26  8:03 ` Brian Harring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox