From 2ef204dcdd28d60819ad7a413426b9676c54a3a4 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 10 Jan 2011 23:05:19 +0100 Subject: *: use utils.remove() some more (Bitbake rev: d3489b141cac1197324661680fe38b8a88bc49b4) Signed-off-by: Bernhard Reutner-Fischer Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'bitbake/lib/bb/fetch2') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 751e51412..2aeb8b8fe 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -31,6 +31,7 @@ import logging import bb from bb import data from bb import persist_data +from bb import utils logger = logging.getLogger("BitBake.Fetch") @@ -217,12 +218,6 @@ def init(urls, d, setup = True): def mirror_from_string(data): return [ i.split() for i in (data or "").replace('\\n','\n').split('\n') if i ] -def removefile(f): - try: - os.remove(f) - except: - pass - def verify_checksum(u, ud, d): """ verify the MD5 and SHA256 checksum for downloaded src @@ -293,7 +288,7 @@ def go(d, urls = None): localpath = ud.localpath except FetchError: # Remove any incomplete file - removefile(ud.localpath) + bb.utils.remove(ud.localpath) # Finally, try fetching uri, u, from MIRRORS mirrors = mirror_from_string(bb.data.getVar('MIRRORS', d, True)) localpath = try_mirrors (d, u, mirrors) @@ -503,7 +498,7 @@ def try_mirrors(d, uri, mirrors, check = False, force = False): import sys (type, value, traceback) = sys.exc_info() logger.debug(2, "Mirror fetch failure: %s", value) - removefile(ud.localpath) + bb.utils.remove(ud.localpath) continue return None -- cgit v1.2.3