summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-03-25 03:51:51 +0000
committerZac Medico <zmedico@gentoo.org>2008-03-25 03:51:51 +0000
commitf702bafa4958b8e5df8b616112ef1e2373985cde (patch)
tree67111222f88848cfbb4d89e369669852e0693218 /pym
parent798e46a8d85493411163e7c1c7b6d2e3515b9191 (diff)
downloadportage-f702bafa4958b8e5df8b616112ef1e2373985cde.tar.gz
portage-f702bafa4958b8e5df8b616112ef1e2373985cde.tar.bz2
portage-f702bafa4958b8e5df8b616112ef1e2373985cde.zip
Bug #212152 - Account pre-existing files when calculating whether there
is enough space for a download. svn path=/main/trunk/; revision=9505
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py10
1 files changed, 9 insertions, 1 deletions
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