Fix reget better. Don't try to stat a nonexistant file

This commit is contained in:
Jesse Keating 2007-10-29 16:59:06 -04:00 committed by Jesse Keating
parent 83aec9363a
commit 33a28f0c0a
1 changed files with 3 additions and 2 deletions

View File

@ -330,17 +330,18 @@ class Gather(pypungi.PungiBase):
local = os.path.join(self.config.get('default', 'cachedir'), basename)
target = os.path.join(pkgdir, basename)
cursize = os.stat(local)[6]
totsize = long(po.size)
# this block needs work to be more efficient
if os.path.exists(local) and self.verifyCachePkg(po, local):
self.logger.debug("%s already exists and appears to be complete" % local)
if os.path.exists(target):
os.remove(target) # avoid traceback after interrupted download
self._link(local, target)
continue
else:
elif os.path.exists(local):
# Check to see if the file on disk is bigger, and if so, remove it
cursize = os.stat(local)[6]
if cursize >= totsize:
os.unlink(local)