[Debtorrent-commits] r54 - in /debtorrent/trunk: DebTorrent/BT1/Storage.py DebTorrent/download_bt1.py TODO
camrdale-guest at users.alioth.debian.org
camrdale-guest at users.alioth.debian.org
Fri May 18 21:20:04 UTC 2007
Author: camrdale-guest
Date: Fri May 18 21:20:03 2007
New Revision: 54
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=54
Log:
Directories are no longer created when they will contain no files.
Modified:
debtorrent/trunk/DebTorrent/BT1/Storage.py
debtorrent/trunk/DebTorrent/download_bt1.py
debtorrent/trunk/TODO
Modified: debtorrent/trunk/DebTorrent/BT1/Storage.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/Storage.py?rev=54&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/Storage.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/Storage.py Fri May 18 21:20:03 2007
@@ -8,7 +8,8 @@
from threading import Lock
from time import time, strftime, localtime
import os
-from os.path import exists, getsize, getmtime, basename
+from os.path import exists, getsize, getmtime, basename, split
+from os import makedirs
from traceback import print_exc
try:
from os import fsync
@@ -107,6 +108,7 @@
l = length
else:
l = 0
+ self.make_directories(file)
h = open(file, 'wb+')
h.flush()
h.close()
@@ -203,6 +205,7 @@
+strftime(' != (%x %X) ?',localtime(getmtime(file))) )
raise IOError('modified during download')
try:
+ self.make_directories(file)
return open(file, mode)
except:
if DEBUG:
@@ -338,6 +341,11 @@
self.lock.release()
total += end - begin
+ def make_directories(self, file):
+ file = split(file)[0]
+ if file != '' and not exists(file):
+ makedirs(file)
+
def top_off(self):
for begin, end, offset, file in self.ranges:
l = offset + end - begin
@@ -409,6 +417,7 @@
return
file = r[3]
if not exists(file):
+ self.make_directories(file)
h = open(file, 'wb+')
h.flush()
h.close()
Modified: debtorrent/trunk/DebTorrent/download_bt1.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/download_bt1.py?rev=54&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Fri May 18 21:20:03 2007
@@ -600,7 +600,8 @@
for i in x['path']:
n = path.join(n, i)
files.append((n, x['length']))
- make(n)
+ #Move directory creation to Storage
+ #make(n)
except OSError, e:
self.errorfunc("Couldn't allocate dir - " + str(e))
return None
Modified: debtorrent/trunk/TODO
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/TODO?rev=54&op=diff
==============================================================================
--- debtorrent/trunk/TODO (original)
+++ debtorrent/trunk/TODO Fri May 18 21:20:03 2007
@@ -68,14 +68,6 @@
matches.
-Modify pre-allocation to not create directories
-
-Currently, the pre-allocation type of allocation will create all the
-directories in the download, even if the files in the directory are not being
-downloaded. This could be modified to create directories on demand to reduce
-filesystem bloat.
-
-
Add parsing of currently installed packages to determine what to download
As a temporary measure, before full apt proxy support (dt://) is possible,
More information about the Debtorrent-commits
mailing list