Fix reget better. Don't try to stat a nonexistant file
This commit is contained in:
parent
83aec9363a
commit
33a28f0c0a
@ -330,17 +330,18 @@ class Gather(pypungi.PungiBase):
|
|||||||
local = os.path.join(self.config.get('default', 'cachedir'), basename)
|
local = os.path.join(self.config.get('default', 'cachedir'), basename)
|
||||||
target = os.path.join(pkgdir, basename)
|
target = os.path.join(pkgdir, basename)
|
||||||
|
|
||||||
cursize = os.stat(local)[6]
|
|
||||||
totsize = long(po.size)
|
totsize = long(po.size)
|
||||||
|
|
||||||
|
# this block needs work to be more efficient
|
||||||
if os.path.exists(local) and self.verifyCachePkg(po, local):
|
if os.path.exists(local) and self.verifyCachePkg(po, local):
|
||||||
self.logger.debug("%s already exists and appears to be complete" % local)
|
self.logger.debug("%s already exists and appears to be complete" % local)
|
||||||
if os.path.exists(target):
|
if os.path.exists(target):
|
||||||
os.remove(target) # avoid traceback after interrupted download
|
os.remove(target) # avoid traceback after interrupted download
|
||||||
self._link(local, target)
|
self._link(local, target)
|
||||||
continue
|
continue
|
||||||
else:
|
elif os.path.exists(local):
|
||||||
# Check to see if the file on disk is bigger, and if so, remove it
|
# Check to see if the file on disk is bigger, and if so, remove it
|
||||||
|
cursize = os.stat(local)[6]
|
||||||
if cursize >= totsize:
|
if cursize >= totsize:
|
||||||
os.unlink(local)
|
os.unlink(local)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user