From: Zac Medico Date: Thu, 27 Jul 2006 21:30:29 +0000 (-0000) Subject: Move the filesystem mirrors code into the main fetch loop. X-Git-Tag: v2.1.1~131 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6a034c0774ff51f91c8c3166651bf19b8df6c8a4;p=portage.git Move the filesystem mirrors code into the main fetch loop. svn path=/main/trunk/; revision=4034 --- 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: