--- /usr/bin/emerge~ 2003-06-24 15:50:50.000000000 -0400 +++ /usr/bin/emerge~ 2003-06-30 08:55:02.000000000 -0400 @@ -924,6 +924,8 @@ def display(self,mylist): changelogs=[] + totalsize=0 + for x in mylist: if x[0]=="blocks": addl=""+red("B")+" " @@ -989,6 +991,32 @@ if ebuild_iuse != "": iuse=iuse+blue("-"+ebuild_iuse)+" " + + + + mysize = [0] + mydigest = portage.db["/"]["porttree"].dbapi.finddigest(x[2]) + + + try: + myfile = open(mydigest,"r") + for line in myfile.readlines(): + mysize[0] += int(line.split(" ")[3]) + myfile.close() + totalsize+=mysize[0] + mystr = str(mysize[0]/1024) + mycount=len(mystr) + while (mycount > 3): + mycount-=3 + mystr=mystr[:mycount]+","+mystr[mycount:] + mysize[0]=mystr+" kB" + except Exception, e: + if edebug: + print "!!! Exception:",e + mysize[0]="Size Unavailable" + + + xs=portage.pkgsplit(x[2]) if xs[2]=="r0": xs[2]="" @@ -1012,8 +1040,9 @@ myprint=myprint+" "*(oldlp-len(myprint)) myprint=myprint+myoldbest myprint=myprint+darkgreen(" to "+x[1])+" "+iuse + myprint=myprint+" "+purple(mysize[0]) else: - myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+darkgreen("to "+x[1])+" "+iuse + myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+darkgreen("to "+x[1])+" "+iuse+" "+purple(mysize[0]) else: if "--columns" in myopts: myprint="["+x[0]+" "+addl+"] "+darkgreen(xs[0]) @@ -1023,10 +1052,12 @@ if (oldlp-len(myprint)) > 0: myprint=myprint+(" "*(oldlp-len(myprint))) myprint=myprint+myoldbest+" "+iuse + myprint=myprint+" "+purple(mysize[0]) else: - myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+iuse + myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+iuse+" "+purple(mysize[0]) print myprint + mysplit=portage.pkgsplit(x[2]) # XXX mysplit _can_ be None.... Why? if mysplit and (len(mysplit)==3): @@ -1054,6 +1085,14 @@ print bold('*'+revision) sys.stdout.write(text) + mystr = str(totalsize/1024) + mycount=len(mystr) + while (mycount > 3): + mycount-=3 + mystr=mystr[:mycount]+","+mystr[mycount:] + print + print "Total size of downloads: "+purple(mystr+" kb") + def calc_changelog(self,ebuildpath,current,next): current = '-'.join(portage.catpkgsplit(current)[1:]) if current.endswith('-r0'): current = current[:-3]