diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2019-10-22 23:54:16 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2019-10-22 23:54:16 +0300 |
commit | 9722c6ee87766a45a337c094d1293de81cdcb106 (patch) | |
tree | 08b57716ae3c02fef2bc870b634019e692fd70e6 /poky/bitbake/lib/bb/utils.py | |
parent | 35e295e2a161fcf146ea031de53431b2888521fa (diff) | |
parent | 5b6cc97bf138293b6af12d5d3003bb66c700c48a (diff) | |
download | openbmc-9722c6ee87766a45a337c094d1293de81cdcb106.tar.xz |
Merge branch 'master' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into HEAD
Diffstat (limited to 'poky/bitbake/lib/bb/utils.py')
-rw-r--r-- | poky/bitbake/lib/bb/utils.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/poky/bitbake/lib/bb/utils.py b/poky/bitbake/lib/bb/utils.py index ed19825fa..d035949b3 100644 --- a/poky/bitbake/lib/bb/utils.py +++ b/poky/bitbake/lib/bb/utils.py @@ -394,7 +394,7 @@ def better_exec(code, context, text = None, realfile = "<code>", pythonexception code = better_compile(code, realfile, realfile) try: exec(code, get_context(), context) - except (bb.BBHandledException, bb.parse.SkipRecipe, bb.build.FuncFailed, bb.data_smart.ExpansionError): + except (bb.BBHandledException, bb.parse.SkipRecipe, bb.data_smart.ExpansionError): # Error already shown so passthrough, no need for traceback raise except Exception as e: @@ -677,7 +677,7 @@ def _check_unsafe_delete_path(path): return True return False -def remove(path, recurse=False): +def remove(path, recurse=False, ionice=False): """Equivalent to rm -f or rm -rf""" if not path: return @@ -686,7 +686,10 @@ def remove(path, recurse=False): if _check_unsafe_delete_path(path): raise Exception('bb.utils.remove: called with dangerous path "%s" and recurse=True, refusing to delete!' % path) # shutil.rmtree(name) would be ideal but its too slow - subprocess.check_call(['rm', '-rf'] + glob.glob(path)) + cmd = [] + if ionice: + cmd = ['ionice', '-c', '3'] + subprocess.check_call(cmd + ['rm', '-rf'] + glob.glob(path)) return for name in glob.glob(path): try: @@ -695,12 +698,12 @@ def remove(path, recurse=False): if exc.errno != errno.ENOENT: raise -def prunedir(topdir): +def prunedir(topdir, ionice=False): # Delete everything reachable from the directory named in 'topdir'. # CAUTION: This is dangerous! if _check_unsafe_delete_path(topdir): raise Exception('bb.utils.prunedir: called with dangerous path "%s", refusing to delete!' % topdir) - remove(topdir, recurse=True) + remove(topdir, recurse=True, ionice=ionice) # # Could also use return re.compile("(%s)" % "|".join(map(re.escape, suffixes))).sub(lambda mo: "", var) @@ -780,7 +783,7 @@ def movefile(src, dest, newmtime = None, sstat = None): os.rename(src, destpath) renamefailed = 0 except Exception as e: - if e[0] != errno.EXDEV: + if e.errno != errno.EXDEV: # Some random error. print("movefile: Failed to move", src, "to", dest, e) return None |