[game-data-packager] 02/02: download: do out-of-space check only once per file

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sun Jan 24 21:10:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit 0d0729f538a9004229e7728d9c83f5b39aa4e9aa
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sun Jan 24 22:09:46 2016 +0100

    download: do out-of-space check only once per file
---
 game_data_packager/build.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index bf51150..4c1d547 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -743,6 +743,15 @@ class PackagingTask(object):
 
             if download:
                 logger.debug('trying to download %s...', wanted.name)
+
+                tmpdir = self.save_downloads or os.path.dirname(self.get_workdir())
+                statvfs = os.statvfs(tmpdir)
+                if wanted.size > statvfs.f_frsize * statvfs.f_bavail:
+                    logger.error("Out of space on %s, can't download %s.",
+                                  tmpdir, wanted.name)
+                    self.download_failed.add(url)
+                    return FillResult.IMPOSSIBLE
+
                 urls = choose_mirror(wanted)
                 for url in urls:
                     if url in self.download_failed:
@@ -751,14 +760,6 @@ class PackagingTask(object):
 
                     logger.debug('... %s', url)
 
-                    tmpdir = self.save_downloads or os.path.dirname(self.get_workdir())
-                    statvfs = os.statvfs(tmpdir)
-                    if wanted.size > statvfs.f_frsize * statvfs.f_bavail:
-                        logger.error("Out of space on %s, can't download %s.",
-                                      tmpdir, wanted.name)
-                        self.download_failed.add(url)
-                        return FillResult.IMPOSSIBLE
-
                     tmp = None
                     try:
                         rf = urllib.request.urlopen(urllib.request.Request(

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list