Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 19594 Details for
Bug 27669
Patches to allow multiple DISTDIRs
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Diff for 2.0.49-r13
portage.py-2.0.49-r13-01.diff (text/plain), 8.16 KB, created by
Kurt Hindenburg
on 2003-10-21 10:18:14 UTC
(
hide
)
Description:
Diff for 2.0.49-r13
Filename:
MIME Type:
Creator:
Kurt Hindenburg
Created:
2003-10-21 10:18:14 UTC
Size:
8.16 KB
patch
obsolete
>--- portage.py-2.0.49-r13 2003-10-21 01:07:47.603157704 -0500 >+++ portage.py 2003-10-21 01:07:47.597158616 -0500 >@@ -1,4 +1,9 @@ > >+# >+# >+# It appears the VERSION can change when 'emerge portage' is done. Hence we append. >+VERSION+="-kvh1" >+ > import sys > > noiselimit = 0 >@@ -1108,24 +1113,79 @@ > else: > return 16 # interrupted by signal > >+ >+#KVH >+def returnFileSizeInDir(mydir,myfile): >+ "If myfile found in mydir, return size of myfile; otherwise 0" >+ >+ st_size=0 >+ try: >+ mystat=os.stat(mydir+"/"+myfile) >+ st_size=mystat[ST_SIZE] >+ except (OSError,IOError),e: >+ st_size=0 >+ return st_size >+ >+#KVH >+def findFileInDistDirs(myfile): >+ "Check all directories in DISTDIRS for myfile" >+ >+ mydir="" >+ >+ if settings["DISTDIRS"]=="": >+ return mydir >+ >+# Traverse through all directories >+ for d in settings["DISTDIRS"].split(":"): >+ #print "^^^ Checking for "+myfile+" in "+d >+ st_size=returnFileSizeInDir(d,myfile) >+ if st_size: >+ mydir=d >+ break >+ return mydir >+ > def fetch(myuris, listonly=0, fetchonly=0): > "fetch files. Will use digest file if available." > if ("mirror" in features) and ("nomirror" in settings["RESTRICT"].split()): > print ">>> \"mirror\" mode and \"nomirror\" restriction enabled; skipping fetch." > return 1 > global thirdpartymirrors >- >+ > if ("nomirror" in settings["RESTRICT"].split()): > mymirrors=[] > else: > mymirrors=settings["GENTOO_MIRRORS"].split() >- >+ > fetchcommand=settings["FETCHCOMMAND"] > resumecommand=settings["RESUMECOMMAND"] > fetchcommand=string.replace(fetchcommand,"${DISTDIR}",settings["DISTDIR"]) > resumecommand=string.replace(resumecommand,"${DISTDIR}",settings["DISTDIR"]) > mydigests=None > digestfn=settings["FILESDIR"]+"/digest-"+settings["PF"] >+ >+#KVH >+ settings["SRC_LINKS"]=settings["PORTAGE_TMPDIR"]+"/source-links" >+ try: >+ if not os.path.exists(settings["SRC_LINKS"]): >+ os.makedirs(settings["SRC_LINKS"]) >+ os.chown(settings["SRC_LINKS"],portage_uid,portage_gid) >+ else: >+ #O.K. we'll clean out old links here... >+ src_links = settings["SRC_LINKS"] >+ files = os.listdir(src_links) >+ for file in files: >+ jfile = src_links+"/"+file >+ if os.path.islink(jfile): >+ os.remove(jfile) >+ else: >+ pass >+ >+ except Exception, e: >+ print "!!! Filesystem error. (Read-Only?)" >+ print "!!!",e >+ return 0 >+ >+ > if os.path.exists(digestfn): > myfile=open(digestfn,"r") > mylines=myfile.readlines() >@@ -1183,12 +1243,13 @@ > writemsg( "!!! prior to 3.2.3. Please merge the latest gcc or rebuid python with either\n") > writemsg( "!!! -march=pentium3 or set -mno-sse2 in your cflags.\n\n\n") > time.sleep(10) >- >+ > for locmirr in thirdpartymirrors[mirrorname]: >- filedict[myfile].append(locmirr+"/"+myuri[eidx+1:]) >+ filedict[myfile].append(locmirr+"/"+myuri[eidx+1:]) > else: > filedict[myfile].append(myuri) > for myfile in filedict.keys(): >+# print "^^^ myfile ",myfile > if listonly: > fetched=0 > writemsg("\n") >@@ -1196,36 +1257,55 @@ > if listonly: > writemsg(loc+" ") > continue >- try: >- mystat=os.stat(settings["DISTDIR"]+"/"+myfile) >- if mydigests!=None and mydigests.has_key(myfile): >- #if we have the digest file, we know the final size and can resume the download. >- if mystat[ST_SIZE]<mydigests[myfile]["size"]: >- fetched=1 >+ >+ fetched=0 >+ indistdirs=0 >+ # Try the normal place first >+ filedir=settings["DISTDIR"] >+ mystsize=returnFileSizeInDir(filedir,myfile) >+ >+ # If not DISTDIR, try all DISTDIRS >+ if mystsize==0 and settings["DISTDIRS"]: >+ filedir=findFileInDistDirs(myfile) >+ if filedir!="": >+ mystsize=returnFileSizeInDir(filedir,myfile) >+ indistdirs=1 >+ if mydigests!=None and mydigests.has_key(myfile): >+ #if we have the digest file, we know the final size and can resume the download. >+ if mystsize == 0: >+ fetched=0 >+ elif mystsize<mydigests[myfile]["size"]: >+ fetched=1 >+ # Do not allow resume for files in DISTDIRS >+ if indistdirs==1: >+ fetched=0 >+ else: >+ #we already have it downloaded, skip. >+ #if our file is bigger than the recorded size, digestcheck should catch it. >+ if not fetchonly: >+ fetched=2 > else: >- #we already have it downloaded, skip. >- #if our file is bigger than the recorded size, digestcheck should catch it. >- if not fetchonly: >- fetched=2 >+ # Check md5sum's at each fetch for fetchonly. >+ mymd5=perform_md5(filedir+"/"+myfile) >+ if mymd5 != mydigests[myfile]["md5"]: >+ writemsg("!!! Previously fetched file: "+str(myfile)+" MD5 FAILED! Refetching...\n") >+ os.unlink(filedir+"/"+myfile) >+ fetched=0 > else: >- # Check md5sum's at each fetch for fetchonly. >- mymd5=perform_md5(settings["DISTDIR"]+"/"+myfile) >- if mymd5 != mydigests[myfile]["md5"]: >- writemsg("!!! Previously fetched file: "+str(myfile)+" MD5 FAILED! Refetching...\n") >- os.unlink(settings["DISTDIR"]+"/"+myfile) >- fetched=0 >- else: >- writemsg(">>> Previously fetched file: "+str(myfile)+" MD5 ;-)\n") >- fetched=2 >- break #No need to keep looking for this file, we have it! >- else: >- #we don't have the digest file, but the file exists. Assume it is fully downloaded. >- fetched=2 >- except (OSError,IOError),e: >- fetched=0 >+ writemsg(">>> Previously fetched file: "+str(myfile)+" MD5 ;-)\n") >+ fetched=2 >+ break #No need to keep looking for this file, we have it! >+ else: >+ #we don't have the digest file, but the file exists. Assume it is fully downloaded. >+ fetched=2 >+# except (OSError,IOError),e: >+# fetched=0 > if fetched!=2: > #we either need to resume or start the download > #you can't use "continue" when you're inside a "try" block >+ # Reset filedir to point to original DISTDIR >+ filedir=settings["DISTDIR"] >+ > if fetched==1: > #resume mode: > writemsg(">>> Resuming download...\n") >@@ -1237,7 +1317,7 @@ > myfetch=string.replace(locfetch,"${URI}",loc) > myfetch=string.replace(myfetch,"${FILE}",myfile) > myret=spawn(myfetch,free=1) >- >+ > if mydigests!=None and mydigests.has_key(myfile): > try: > mystat=os.stat(settings["DISTDIR"]+"/"+myfile) >@@ -1285,6 +1365,22 @@ > if (fetched!=2) and not listonly: > writemsg("!!! Couldn't download "+str(myfile)+". Aborting.\n") > return 0 >+ >+#KVH >+# Create a new directory to store all the distfile links. >+# settings["SRC_LINKS"]=settings["PORTAGE_TMPDIR"]+"/source-links" >+ if not listonly and not fetchonly: >+# print "^^^ "+myfile+" is located in "+filedir >+ target = filedir + "/" + myfile >+ dest = settings["SRC_LINKS"] + "/" + myfile >+# print "^^^ "+target+" --> "+dest >+ try: >+ os.symlink(target,dest) >+ except Exception, e: >+ # Should not happen since we clear out the directory above. >+ # May already exists...should likely ignore errors here... >+ print "^^^ Error : "+dest+ " already exists! (ignore)" >+ > return 1 > > >@@ -1310,8 +1406,11 @@ > """generates digest file if missing. Assumes all files are available. If > overwrite=0, the digest will only be created if it doesn't already exist.""" > >+# KVH - Change basedir to SRC_LINKS >+# basedir=settings["DISTDIR"]+"/" >+ basedir=settings["SRC_LINKS"]+"/" >+ > # archive files >- basedir=settings["DISTDIR"]+"/" > digestfn=settings["FILESDIR"]+"/digest-"+settings["PF"] > > # portage files -- p(ortagefiles)basedir >@@ -1537,11 +1636,27 @@ > retval=spawnebuild(actionmap[mydo]["dep"],actionmap,debug,alwaysdep) > if retval: > return retval >- # spawn ebuild.sh >+ >+#KVH >+ settings["ODISTDIR"]=settings["DISTDIR"] >+ settings["DISTDIR"]=settings["SRC_LINKS"] >+ >+# print "^^^ Current [DISTDIR] "+settings["DISTDIR"] >+ # spawn ebuild.sh > mycommand="/usr/sbin/ebuild.sh " >- return spawn(mycommand + mydo,debug, >- actionmap[mydo]["args"][0], >- actionmap[mydo]["args"][1]) >+ ret=spawn(mycommand + mydo,debug, >+ actionmap[mydo]["args"][0], >+ actionmap[mydo]["args"][1]) >+ >+ settings["DISTDIR"]=settings["ODISTDIR"] >+ >+ return ret >+ >+ # spawn ebuild.sh >+# mycommand="/usr/sbin/ebuild.sh " >+# return spawn(mycommand + mydo,debug, >+# actionmap[mydo]["args"][0], >+# actionmap[mydo]["args"][1]) > > def doebuild(myebuild,mydo,myroot,debug=0,listonly=0,fetchonly=0): > global settings,db
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 27669
:
16870
|
16875
|
18929
|
18931
| 19594