summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-11-16 23:47:50 +0000
committerNick Mathewson <nickm@torproject.org>2008-11-16 23:47:50 +0000
commit5825bc0d551ecf72364f8d21afbc1b20e2e00eb1 (patch)
treea24b39811cf133c579a89e180e3fca8d7231c25b
parentb63eda4396dc7b17554e657bc2eec0b0fda7bcb4 (diff)
Fix bundle download logic. Better fix needed.
git-svn-id: file:///home/or/svnrepo/updater/trunk@17299 55e972cd-5a19-0410-ae62-a4d7a52db4cd
-rw-r--r--TODO9
-rw-r--r--lib/thandy/formats.py2
-rw-r--r--lib/thandy/repository.py12
3 files changed, 17 insertions, 6 deletions
diff --git a/TODO b/TODO
index 4b54437..af09042 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,10 @@
+- Bugs.
+ - Check hashes of downloaded packages and bundles as they are received.
+
+- Download improvements.
+ - Back off on download failure.
+ - Handle full stalled file in download.
+ - Use if-modified-since on timestamp
- Write client-side code
. Decide early if a python implementation will do for v1.
@@ -20,7 +27,7 @@
- Better configurability: let users override mirrors, keys, etc.
- Backend for "A bunch of files you can unzip someplace."
- OSX backend (hard).
-- Proper exponential backoff on backend.
+- Proper exponential back-off on download backend.
- Wrapping
- More unit tests
diff --git a/lib/thandy/formats.py b/lib/thandy/formats.py
index 4afbd00..ccf3517 100644
--- a/lib/thandy/formats.py
+++ b/lib/thandy/formats.py
@@ -273,7 +273,7 @@ def getFileDigest(f, digestObj=None):
"""
f_to_close = None
if isinstance(f, basestring):
- t_to_close = f = open(f, 'rb')
+ f_to_close = f = open(f, 'rb')
useTempDigestObj = (digestObj == None)
if useTempDigestObj:
diff --git a/lib/thandy/repository.py b/lib/thandy/repository.py
index 696bbec..3e1f441 100644
--- a/lib/thandy/repository.py
+++ b/lib/thandy/repository.py
@@ -390,7 +390,9 @@ class LocalRepository:
continue
rp = binfo.getRelativePath()
- hashDict[rp] = h_expected = binfo.getHash()
+ #hashDict[rp] = #XXXX this hash needs to be calculated ovver
+ # # the json data.
+ h_expected = binfo.getHash()
bfile = self.getBundleFile(rp)
try:
bfile.load()
@@ -401,7 +403,8 @@ class LocalRepository:
h_b = thandy.formats.getDigest(bfile.get())
if h_b != h_expected:
- logging.info("Bundle hash not as expected; must fetch.", rp)
+ logging.info("Bundle hash for %s not as expected; must fetch.",
+ rp)
need.add(rp)
continue
@@ -422,7 +425,8 @@ class LocalRepository:
rp = pkginfo['path']
pfile = self.getPackageFile(rp)
h_expected = thandy.formats.parseHash(pkginfo['hash'])
- hashDict[rp] = h_expected
+ #hashDict[rp] = #XXXX this hash needs to be calculated ovver
+ # # the json data.
try:
pfile.load()
except OSError:
@@ -477,7 +481,7 @@ class LocalRepository:
fn = self.getFilename(rp)
try:
h_got = thandy.formats.getFileDigest(fn)
- except OSError:
+ except (OSError, IOError):
logging.info("Installable file %s not found on disk; "
"must load", rp)
need.add(rp)