stamp = stamp_internal(task, d, file_name)
# Remove the file and recreate to force timestamp
# change on broken NFS filesystems
- if os.access(stamp, os.F_OK):
- os.remove(stamp)
if stamp:
+ bb.utils.remove(stamp)
f = open(stamp, "w")
f.close()
(d can be a data dict or dataCache)
"""
stamp = stamp_internal(task, d, file_name)
- if os.access(stamp, os.F_OK):
- os.remove(stamp)
+ bb.utils.remove(stamp)
def stampfile(taskname, d):
return stamp_internal(taskname, d, None)
import bb
from bb import data
from bb import persist_data
+from bb import utils
logger = logging.getLogger("BitBake.Fetch")
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
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)
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
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
"""
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")
import bb
from bb import data
from bb import persist_data
+from bb import utils
logger = logging.getLogger("BitBake.Fetch")
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
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)
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
def remove(path, recurse=False):
"""Equivalent to rm -f or rm -rf"""
+ if not path:
+ return
import os, errno, shutil
try:
os.unlink(path)
- except OSError, exc:
+ except OSError as exc:
if recurse and exc.errno == errno.EISDIR:
shutil.rmtree(path)
elif exc.errno != errno.ENOENT: