Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 16870 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]
Patch to allow multiple DISTDIRs
portage.py-2.0.49-r2-01.diff (text/plain), 5.09 KB, created by
Kurt Hindenburg
on 2003-08-31 15:22:36 UTC
(
hide
)
Description:
Patch to allow multiple DISTDIRs
Filename:
MIME Type:
Creator:
Kurt Hindenburg
Created:
2003-08-31 15:22:36 UTC
Size:
5.09 KB
patch
obsolete
>--- Oportage-2.0.49-r2/pym/portage.py 2003-08-30 01:08:33.000000000 -0500 >+++ portage.py 2003-08-31 16:54:36.000000000 -0500 >@@ -1,9 +1,9 @@ > # portage.py -- core Portage functionality > # Copyright 1998-2003 Daniel Robbins, Gentoo Technologies, Inc. > # Distributed under the GNU Public License v2 >-# $Header: /home/cvsroot/gentoo-src/portage/pym/portage.py,v 1.337 2003/08/22 17:09:37 carpaski Exp $ >+# $Header: /mnt/alpha/cvsroot/kvh/portage-df/portage.py,v 1.29 2003/08/31 21:54:36 kvh Exp $ > >-VERSION="2.0.49-r2" >+VERSION="2.0.49-r2-k1" > > from stat import * > from commands import * >@@ -1092,6 +1092,38 @@ > 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()): >@@ -1180,12 +1212,37 @@ > if listonly: > sys.stderr.write(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. >@@ -1205,9 +1262,10 @@ > 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: >+ # Reset filedir to point to original DISTDIR >+ filedir=settings["DISTDIR"] >+ > #we either need to resume or start the download > #you can't use "continue" when you're inside a "try" block > if fetched==1: >@@ -1269,6 +1327,22 @@ > if (fetched!=2) and not listonly: > sys.stderr.write("!!! 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 > > >@@ -1294,8 +1368,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 >@@ -1521,11 +1598,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
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