summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
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:42 +0000
commitd14eb12deb625e6644c0e727c336ad6bfafd0793 (patch)
tree57c83dc2761de9b2996562cf8fde5f22f96f7d22 /bitbake/lib/bb/utils.py
parent7fefb8588894b37ba8d7064385d10a2b7b568290 (diff)
downloadpoky-d14eb12deb625e6644c0e727c336ad6bfafd0793.tar.gz
bitbake: 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' (Bitbake rev: e91c256ec076e70cf8a18e369fe7862e50618c48) Signed-off-by: Pavel Zhukov <pavel@zhukoff.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 61ffad92ce..d299b2efdb 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -759,7 +759,8 @@ def mkdirhier(directory):
759 """Create a directory like 'mkdir -p', but does not complain if 759 """Create a directory like 'mkdir -p', but does not complain if
760 directory already exists like os.makedirs 760 directory already exists like os.makedirs
761 """ 761 """
762 762 if directory.find('${') != -1:
763 bb.fatal("Directory name {} contains unexpanded bitbake variable. This may cause build failures and WORKDIR polution.".format(directory))
763 try: 764 try:
764 os.makedirs(directory) 765 os.makedirs(directory)
765 except OSError as e: 766 except OSError as e: