diff --git a/pypungi/gather.py b/pypungi/gather.py index e8c709ee..21d16e24 100755 --- a/pypungi/gather.py +++ b/pypungi/gather.py @@ -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)