]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake/fetch2: Remove hardcoded file removal and use clean method
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 13 May 2012 07:38:13 +0000 (07:38 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 20 May 2012 08:24:22 +0000 (09:24 +0100)
Under certain circumstances, bitbake could remove files which were
outside its control since it unconditionally removes ud.localpath.
In the file:// case this can point at external paths.

This patch converts it to use the clean() method which will remove
files when its safe to do so but not in the file:// case since the
file:// handler has an empty clean method. This means bitbake no
longer removes files outside its control and is generally much safer.

(Bitbake rev: 9ad1cebe2220b41da2141cdb3f0a403abb46d77c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/fetch2/__init__.py

index 670afb1eed34ac167b76af1065144ec1e65b7cb4..5d7ef1f014b91814b86282fc5a77e83fca3e2c2d 100644 (file)
@@ -507,8 +507,7 @@ def try_mirrors(d, origud, mirrors, check = False):
             logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url))
             logger.debug(1, str(e))
             try:
-                if os.path.isfile(ud.localpath):
-                    bb.utils.remove(ud.localpath)
+                ud.method.clean(ud, ld)
             except UnboundLocalError:
                 pass
             continue
@@ -984,8 +983,7 @@ class Fetch(object):
                         logger.debug(1, str(e))
                         firsterr = e
                         # Remove any incomplete fetch
-                        if os.path.isfile(ud.localpath):
-                            bb.utils.remove(ud.localpath)
+                        m.clean(ud, self.d)
                         logger.debug(1, "Trying MIRRORS")
                         mirrors = mirror_from_string(self.d.getVar('MIRRORS', True))
                         localpath = try_mirrors (self.d, ud, mirrors)