Merge branch 'ci/fix_wrongly_cleanup_preserve_dirs' into 'master'

ci: fix cleanup bin wrongly when extra_preserve_dir equals to the app dir

See merge request espressif/esp-idf!19214
This commit is contained in:
Fu Hanxi 2022-07-26 10:35:09 +08:00
commit 7ed174aee0

View File

@ -129,7 +129,12 @@ def main(args: argparse.Namespace) -> None:
if app.preserve: if app.preserve:
continue continue
for extra_preserve_dir in args.extra_preserve_dirs: for extra_preserve_dir in args.extra_preserve_dirs:
if Path(extra_preserve_dir).resolve() in Path(app.app_dir).resolve().parents: abs_extra_preserve_dir = Path(extra_preserve_dir).resolve()
abs_app_dir = Path(app.app_dir).resolve()
if (
abs_extra_preserve_dir == abs_app_dir
or abs_extra_preserve_dir in abs_app_dir.parents
):
app.preserve = True app.preserve = True
ret_code = build_apps( ret_code = build_apps(
@ -225,8 +230,9 @@ if __name__ == '__main__':
help='Copy the sdkconfig file to the build directory.', help='Copy the sdkconfig file to the build directory.',
) )
parser.add_argument( parser.add_argument(
'--extra-preserve-dirs', nargs='+', '--extra-preserve-dirs',
help='also preserve binaries of the apps under the specified dirs' nargs='+',
help='also preserve binaries of the apps under the specified dirs',
) )
parser.add_argument( parser.add_argument(