From: Zac Medico Date: Tue, 25 Mar 2008 03:51:51 +0000 (-0000) Subject: Bug #212152 - Account pre-existing files when calculating whether there X-Git-Tag: v2.2_pre6~334 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f702bafa4958b8e5df8b616112ef1e2373985cde;p=portage.git Bug #212152 - Account pre-existing files when calculating whether there is enough space for a download. svn path=/main/trunk/; revision=9505 --- diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 66ff4ce29..6a253764f 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3243,8 +3243,16 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", # overestimate the filesize so we aren't bitten by FS overhead if hasattr(os, "statvfs"): vfs_stat = os.statvfs(mysettings["DISTDIR"]) + try: + mysize = os.stat(myfile_path) + except OSError, e: + if e.errno != errno.ENOENT: + raise + del e + mysize = 0 if myfile in mydigests \ - and (mydigests[myfile]["size"] + vfs_stat.f_bsize) >= (vfs_stat.f_bsize * vfs_stat.f_bavail): + and (mydigests[myfile]["size"] - mysize + vfs_stat.f_bsize) >= \ + (vfs_stat.f_bsize * vfs_stat.f_bavail): writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1) has_space = False