diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2011-01-10 23:05:19 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2011-01-11 09:21:18 +0100 |
commit | d3489b141cac1197324661680fe38b8a88bc49b4 (patch) | |
tree | fc784025b2d6698094f3f8661a80de216837b72e /lib/bb/fetch | |
parent | 86c6434f093ce5e55d1febfb424a8e595ffc2d17 (diff) | |
download | bitbake-d3489b141cac1197324661680fe38b8a88bc49b4.tar.gz |
*: use utils.remove() some more
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'lib/bb/fetch')
-rw-r--r-- | lib/bb/fetch/__init__.py | 11 | ||||
-rw-r--r-- | lib/bb/fetch/osc.py | 4 |
2 files changed, 5 insertions, 10 deletions
diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py index f7153ebce..d87ff0aaf 100644 --- a/lib/bb/fetch/__init__.py +++ b/lib/bb/fetch/__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) @@ -514,7 +509,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 diff --git a/lib/bb/fetch/osc.py b/lib/bb/fetch/osc.py index 26820967a..8e0423d76 100644 --- a/lib/bb/fetch/osc.py +++ b/lib/bb/fetch/osc.py @@ -11,6 +11,7 @@ import sys import logging import bb from bb import data +from bb import utils from bb.fetch import Fetch from bb.fetch import FetchError from bb.fetch import MissingParameterError @@ -123,8 +124,7 @@ class Osc(Fetch): """ config_path = os.path.join(data.expand('${OSCDIR}', d), "oscrc") - if (os.path.exists(config_path)): - os.remove(config_path) + bb.utils.remove(config_path) f = open(config_path, 'w') f.write("[general]\n") |