From f702bafa4958b8e5df8b616112ef1e2373985cde Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 25 Mar 2008 03:51:51 +0000 Subject: Bug #212152 - Account pre-existing files when calculating whether there is enough space for a download. svn path=/main/trunk/; revision=9505 --- pym/portage/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-1-g7c22