fetch: handle non-essential statvfs failure
authorZac Medico <zmedico@gentoo.org>
Sun, 7 Aug 2011 05:59:26 +0000 (22:59 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 7 Aug 2011 05:59:26 +0000 (22:59 -0700)
pym/portage/package/ebuild/fetch.py

index 2ae1fe85b0b89f1a369aea5bf4ee63dde491cbd5..5cbbf8708d36a4d87cfaf05292fe06eeca1f9dac 100644 (file)
@@ -580,8 +580,17 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
                else:
                        # check if there is enough space in DISTDIR to completely store myfile
                        # overestimate the filesize so we aren't bitten by FS overhead
+                       vfs_stat = None
                        if size is not None and hasattr(os, "statvfs"):
-                               vfs_stat = os.statvfs(mysettings["DISTDIR"])
+                               try:
+                                       vfs_stat = os.statvfs(mysettings["DISTDIR"])
+                               except OSError as e:
+                                       writemsg_level("!!! statvfs('%s'): %s\n" %
+                                               (mysettings["DISTDIR"], e),
+                                               noiselevel=-1, level=logging.ERROR)
+                                       del e
+
+                       if vfs_stat is not None:
                                try:
                                        mysize = os.stat(myfile_path).st_size
                                except OSError as e: