summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-27 21:30:29 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-27 21:30:29 +0000
commit6a034c0774ff51f91c8c3166651bf19b8df6c8a4 (patch)
tree970fe8c73bad2a7b0f6dc022077e9696a705af91
parent75fcdeb6eeceb53af8c7194f206b0593723bef6e (diff)
downloadportage-6a034c0774ff51f91c8c3166651bf19b8df6c8a4.tar.gz
portage-6a034c0774ff51f91c8c3166651bf19b8df6c8a4.tar.bz2
portage-6a034c0774ff51f91c8c3166651bf19b8df6c8a4.zip
Move the filesystem mirrors code into the main fetch loop.
svn path=/main/trunk/; revision=4034
-rw-r--r--pym/portage.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/pym/portage.py b/pym/portage.py
index e321832b5..8f9dd0041 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -1790,22 +1790,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
fsmirrors += [mymirrors[x]]
del mymirrors[x]
- for myuri in myuris:
- myfile=os.path.basename(myuri)
- try:
- destdir = mysettings["DISTDIR"]+"/"
- if not os.path.exists(destdir+myfile):
- for mydir in fsmirrors:
- if os.path.exists(mydir+"/"+myfile):
- writemsg(_("Local mirror has file: %(file)s\n" % {"file":myfile}))
- shutil.copyfile(mydir+"/"+myfile,destdir+"/"+myfile)
- break
- except (OSError,IOError),e:
- # file does not exist
- writemsg(_("!!! %(file)s not found in %(dir)s\n") % {"file":myfile, "dir":mysettings["DISTDIR"]},
- noiselevel=-1)
- gotit=0
-
restrict_fetch = "fetch" in mysettings["RESTRICT"].split()
custom_local_mirrors = custommirrors.get("local", [])
if restrict_fetch:
@@ -1928,6 +1912,19 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
file_lock = portage_locks.lockfile(mysettings["DISTDIR"]+"/"+myfile,wantnewlockfile=1)
try:
if not listonly:
+ if fsmirrors and not os.path.exists(myfile_path):
+ for mydir in fsmirrors:
+ mirror_file = os.path.join(mydir, myfile)
+ try:
+ shutil.copyfile(mirror_file, myfile_path)
+ writemsg(_("Local mirror has file:" + \
+ " %(file)s\n" % {"file":myfile}))
+ break
+ except (IOError, OSError), e:
+ if e.errno != errno.ENOENT:
+ raise
+ del e
+
try:
mystat = os.stat(myfile_path)
except OSError, e: