Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 5036 Details for
Bug 9699
Patch for portage emerge & ebuild to easily check how much to download.
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to portage for "fetchsize" & "pfetchsize"
portage.py.patch (text/plain), 2.53 KB, created by
Jonathan Hunt
on 2002-10-26 06:19:43 UTC
(
hide
)
Description:
Patch to portage for "fetchsize" & "pfetchsize"
Filename:
MIME Type:
Creator:
Jonathan Hunt
Created:
2002-10-26 06:19:43 UTC
Size:
2.53 KB
patch
obsolete
>--- ./portage.py Sun Oct 27 00:00:35 2002 >+++ /home/jhunt/emergesize/portage.py Sat Oct 26 23:41:57 2002 >@@ -7,6 +7,7 @@ > from stat import * > from commands import * > from select import * >+from output import * > import string,os,types,sys,shlex,shutil,xpak,fcntl,signal,time,missingos,cPickle,atexit,grp > > #Secpass will be set to 1 if the user is root or in the wheel group. >@@ -810,6 +811,49 @@ > #interrupted by signal > return 16 > >+def fetchsize(myuris,humanread): >+ "get the amount remaing to fetch files. Will not work in digest file doesn't exist." >+ digestfn=settings["FILESDIR"]+"/digest-"+settings["PF"] >+ if not os.path.exists(digestfn): >+ print "Digest file", digestfn, " doesn't exist. Aborting" >+ return -1; >+ myfile=open(digestfn,"r") >+ mylines=myfile.readlines() >+ mydigests={} >+ # Parse digest file >+ for x in mylines: >+ myline=string.split(x) >+ if len(myline)<4: >+ #invalid line >+ print "!!! The digest",digestfn,"appears to be corrupt. Aborting." >+ return -1 >+ try: >+ mydigests[myline[2]]={"md5":myline[1],"size":string.atol(myline[3])} >+ except ValueError: >+ print "!!! The digest",digestfn,"appears to be corrupt. Aborting." >+ return -1 >+ >+ totalsize=0 >+ for myuri in myuris: >+ myfile=os.path.basename(myuri) >+ # Check how much we need to download of myfile >+ if not mydigests.has_key(myfile): >+ print "Digest file missing entry for ", myfile, "Try updating it." >+ return -1 >+ filesize=mydigests[myfile]["size"]; >+ try: >+ mystat=os.stat(settings["DISTDIR"]+"/"+myfile) >+ size=filesize - mystat[ST_SIZE]-filesize >+ if(size > 0): >+ totalsize+=size >+ except (OSError,IOError),e: >+ totalsize += filesize >+ if(humanread): >+ print "Requires "+humansize(totalsize)+" fetching." >+ else: >+ return totalsize >+ >+ > def fetch(myuris): > "fetch files. Will use digest file if available." > if ("mirror" in features) and ("nomirror" in settings["RESTRICT"].split()): >@@ -1058,7 +1102,7 @@ > return unmerge(settings["CATEGORY"],settings["PF"],myroot) > > if mydo not in ["help","clean","prerm","postrm","preinst","postinst","config","touch","setup", >- "depend","fetch","digest","unpack","compile","install","rpm","qmerge","merge","package"]: >+ "depend","fetch","fetchsize","pfetchsize","digest","unpack","compile","install","rpm","qmerge","merge","package"]: > print "!!! Please specify a valid command." > return 1 > >@@ -1102,6 +1146,11 @@ > fetchme=newuris > checkme=alist > >+ if mydo == "fetchsize": >+ return fetchsize(fetchme, 1) >+ if mydo == "pfetchsize": >+ return fetchsize(fetchme, 0) >+ > if not fetch(fetchme): > return 1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 9699
:
5034
|
5035
| 5036