aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Zhukov <pavel@zhukoff.net>2023-12-08 12:37:24 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-08 17:17:34 +0000
commite91c256ec076e70cf8a18e369fe7862e50618c48 (patch)
treefadbc044480ccfcf778c3de053dc1fc16122893a
parent234b125c11e4cca015e4d54fbddbfd3d276b88f6 (diff)
downloadbitbake-e91c256ec076e70cf8a18e369fe7862e50618c48.tar.gz
utils: Do not create directories with ${ in the name
In some cases ${ may not be expanded in the WORKDIR (one of the cases is undefined variable) and causes cryptic failures [1]. Guard this by erroring out if directory name contains ${ Fixes: [Yocto #15255] [1] ERROR: x-native-1.0+${SRCPV}-r0 do_deploy_source_date_epoch: Error executing a python function in exec_func_python() autogenerated: The stack trace of python calls that resulted in this exception/failure was: File: 'exec_func_python() autogenerated', lineno: 2, function: <module> 0001: *** 0002:sstate_hardcode_path(d) 0003: File: '/home/mischief/src/poky/meta/classes-global/sstate.bbclass', lineno: 654, function: sstate_hardcode_path 0650: bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)) 0651: subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir) 0652: 0653: # If the fixmefn is empty, remove it.. *** 0654: if os.stat(fixmefn).st_size == 0: 0655: os.remove(fixmefn) 0656: else: 0657: bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)) 0658: subprocess.check_output(sstate_filelist_relative_cmd, shell=True) Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/mischief/src/poky/build/tmp/work/core2-64-poky-linux/x-native/1.0+${SRCPV}-r0/sstate-build-deploy_source_date_epoch/fixmepath' Signed-off-by: Pavel Zhukov <pavel@zhukoff.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 61ffad92c..d299b2efd 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -759,7 +759,8 @@ def mkdirhier(directory):
"""Create a directory like 'mkdir -p', but does not complain if
directory already exists like os.makedirs
"""
-
+ if directory.find('${') != -1:
+ bb.fatal("Directory name {} contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution.".format(directory))
try:
os.makedirs(directory)
except OSError as e: