All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bitbake/fetch2: Remove hardcoded file removal and use clean method
@ 2012-05-13 11:44 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2012-05-13 11:44 UTC (permalink / raw)
  To: bitbake-devel

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.
    
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index e5c4b34..8ae8caa 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -506,8 +506,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
@@ -981,8 +980,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)




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-13 18:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-13 11:44 [PATCH] bitbake/fetch2: Remove hardcoded file removal and use clean method Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.