base.bbclass: remove obsolete hosttools
PATCH 1/1 base.bbclass: remove obsolete hosttools
If some tool is removed from HOSTTOOLS or HOSTTOOLS_NONFATAL, it will not be removed from TMPDIR/hosttools in an existing build directory. This is unexpected. Any tool that is not specified in HOSTTOOLS and HOSTTOOLS_NONFATAL should be filtered out.
--- meta/classes/base.bbclass | 8 ++++++++ 1 file changed, 8 insertions(+)
meta/classes/base.bbclass +8 -0
@@ -145,6 +145,13 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True): if notfound and fatal: bb.fatal("The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:\n %s" % " ".join(notfound)) +def clean_hosttools_dir(dest, tools): + import glob + desttools = glob.glob('%s/*' % dest) + for dt in desttools: + if os.path.basename(dt) not in tools: + os.unlink(dt) + addtask fetch do_fetch[dirs] = "${DL_DIR}" do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
@@ -257,6 +264,7 @@ python base_eventhandler() { # Works with the line in layer.conf which changes PATH to point here setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS', d) setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS_NONFATAL', d, fatal=False) + clean_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), d.getVar('HOSTTOOLS').split() + d.getVar('HOSTTOOLS_NONFATAL').split()) if isinstance(e, bb.event.MultiConfigParsed): # We need to expand SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS in each of the multiconfig data stores
Signature · 1 line
2.30.2
Quoted 19 lines · Chen Qi
If some tool is removed from HOSTTOOLS or
HOSTTOOLS_NONFATAL, it will not be removed from TMPDIR/hosttools in an existing build directory. This is unexpected. Any tool that is not specified in HOSTTOOLS andHOSTTOOLS_NONFATALshould be filtered out.Signed-off-by Chen Qi <[email protected]>---
meta/classes/base.bbclass | 8 ++++++++1 file changed, 8 insertions(+)meta/classes/base.bbclass +0
-0@@ -145,6 +145,13 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):if notfound and fatal:
bb.fatal("The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:\n %s" % " ".join(notfound))
meta/classes/base.bbclass def setup_hosttools_dir(dest, toolsvar, d, fatal=True): · line 150
Quoted 3 lines
meta/classes/base.bbclass +3
-0+def clean_hosttools_dir(dest, tools): + import glob + desttools = glob.glob('%s/*' % dest)
I think you want os.listdir() here?
meta/classes/base.bbclass def setup_hosttools_dir(dest, toolsvar, d, fatal=True): · line 154
Quoted 4 lines
meta/classes/base.bbclass +4
-0+ for dt in desttools: + if os.path.basename(dt) not in tools: + os.unlink(dt) +
We didn't do this as it was assumed people very very rarely remove anything from HOSTTOOLS and if they did, they'd know what else they needed to do. This does add yet more housekeeping to every build which I try to avoid doing for performance :/.
Cheers,
Richard
Quoted 29 lines · Richard Purdie
Quoted 13 lines · Chen Qi
If some tool is removed from HOSTTOOLS or
HOSTTOOLS_NONFATAL, it will not be removed from TMPDIR/hosttools in an existing build directory. This is unexpected. Any tool that is not specified in HOSTTOOLS andHOSTTOOLS_NONFATALshould be filtered out.Signed-off-by Chen Qi <[email protected] <mailto:[email protected]>>--- meta/classes/base.bbclass | 8 ++++++++ 1 file changed, 8 insertions(+)meta/classes/base.bbclass +0
-0meta/classes/base.bbclass def setup_hosttools_dir(dest, toolsvar, d, fatal=True): · line 151
Quoted 7 lines
meta/classes/base.bbclass +3
-0@@ -145,6 +145,13 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True): if notfound and fatal: bb.fatal("The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:\n %s" % " ".join(notfound)) +def clean_hosttools_dir(dest, tools): + import glob + desttools = glob.glob('%s/*' % dest)I think you want
os.listdir()here?meta/classes/base.bbclass def setup_hosttools_dir(dest, toolsvar, d, fatal=True): · line 154
Quoted 4 lines
meta/classes/base.bbclass +4
-0+ for dt in desttools: + if os.path.basename(dt) not in tools: + os.unlink(dt) +
Quoted 8 lines
We didn't do this as it was assumed people very very rarely remove anything from HOSTTOOLS and if they did, they'd know what else they needed to do. This does add yet more housekeeping to every build which I try to avoid doing for performance :/.
Cheers,
Richard
Got it. Thanks for the clarification.
Best Regards,
Chen Qi