Gentoo Archives: gentoo-commits

From: "Marius Mauch (genone)" <genone@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r9425 - main/trunk/pym/portage
Date: Mon, 03 Mar 2008 19:43:21
Message-Id: E1JWGZD-00078T-8Z@stork.gentoo.org
1 Author: genone
2 Date: 2008-03-03 19:43:18 +0000 (Mon, 03 Mar 2008)
3 New Revision: 9425
4
5 Modified:
6 main/trunk/pym/portage/__init__.py
7 Log:
8 check available space in DISTDIR before trying to fetch/copy a file, bug #212152
9
10 Modified: main/trunk/pym/portage/__init__.py
11 ===================================================================
12 --- main/trunk/pym/portage/__init__.py 2008-03-03 19:24:05 UTC (rev 9424)
13 +++ main/trunk/pym/portage/__init__.py 2008-03-03 19:43:18 UTC (rev 9425)
14 @@ -3208,10 +3208,19 @@
15 """
16 myfile_path = os.path.join(mysettings["DISTDIR"], myfile)
17 fetched=0
18 + has_space = True
19 file_lock = None
20 if listonly:
21 writemsg_stdout("\n", noiselevel=-1)
22 else:
23 + # check if there is enough space in DISTDIR to completely store myfile
24 + # overestimate the filesize so we aren't bitten by FS overhead
25 + vfs_stat = os.statvfs(mysettings["DISTDIR"])
26 + if myfile in mydigests \
27 + and (mydigests[myfile]["size"] + vfs_stat.f_bsize) >= (vfs_stat.f_bsize * vfs_stat.f_bavail):
28 + writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1)
29 + has_space = False
30 +
31 if use_locks and can_fetch:
32 waiting_msg = None
33 if "parallel-fetch" in features:
34 @@ -3228,7 +3237,7 @@
35 waiting_msg=waiting_msg)
36 try:
37 if not listonly:
38 - if fsmirrors and not os.path.exists(myfile_path):
39 + if fsmirrors and not os.path.exists(myfile_path) and has_space:
40 for mydir in fsmirrors:
41 mirror_file = os.path.join(mydir, myfile)
42 try:
43 @@ -3349,7 +3358,7 @@
44 else:
45 continue
46
47 - if fetched != 2:
48 + if fetched != 2 and has_space:
49 #we either need to resume or start the download
50 #you can't use "continue" when you're inside a "try" block
51 if fetched==1:
52
53 --
54 gentoo-commits@l.g.o mailing list