Fix "devtool finish --force" command, by allowing to copy folders that were not previously existing but also by preventing it from trying to remove non-existent files. Devtool was particularly confused when using the finish subcommand on a recipe that was just added.
Reproducer: devtool add --version 2.10 https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz ... devtool build hello ... devtool finish hello -f ../openembedded-core/meta/ ... Traceback (most recent call last): File "/home/mathieu/projects/swat/gits/openembedded-core/scripts/devtool", line 352, in <module> ret = main() File "/home/mathieu/projects/swat/gits/openembedded-core/scripts/devtool", line 338, in main ret = args.func(args, config, basepath, workspace) File "/home/mathieu/projects/swat/gits/openembedded-core/scripts/lib/devtool/standard.py", line 2214, in finish updated, appendfile, removed = _update_recipe(args.recipename, workspace, rd, args.mode, appendlayerdir, wildcard_version=True, no_remove=False, no_report_remove=removing_original, initial_rev=args.initial_rev, dry_run_outdir=dry_run_outdir, no_overrides=args.no_overrides, force_patch_refresh=args.force_patch_refresh) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mathieu/projects/swat/gits/openembedded-core/scripts/lib/devtool/standard.py", line 1903, in _update_recipe updated, appendf, removed = _update_recipe_patch(recipename, workspace, srctree, crd, appendlayerdir, wildcard_version, no_remove, no_report_remove, initial_rev, dry_run_outdir, force_patch_refresh) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mathieu/projects/swat/gits/openembedded-core/scripts/lib/devtool/standard.py", line 1675, in _update_recipe_patch upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mathieu/projects/swat/gits/openembedded-core/scripts/lib/devtool/standard.py", line 1469, in _export_local_files shutil.copy2(fullfile, os.path.join(destdir, f)) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/shutil.py", line 468, in copy2 copyfile(src, dst, follow_symlinks=follow_symlinks) ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/shutil.py", line 262, in copyfile with open(dst, 'wb') as fdst: ~~~~^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/tmp/devtool77jejua2/tmpyuo3c_ay/build-aux/compile' Using --force is arguably a bad idea here, but as we do provide this possibility, we should make sure the code does not crash. Signed-off-by: Mathieu Dubois-Briand <[email protected]> --- Changes in v2: - Use RecipetoolTransient instead of Proprietary. - Link to v1: https://lore.kernel.org/r/[email protected] --- Mathieu Dubois-Briand (4): scripts: scriptutils: Use LicenseRef-RecipetoolTransient LICENSE while fetching devtool: standard: Fix file copy on finish --force devtool: standard: Remove unused variable oe-selftest: devtool: Add test for add/finish workflow meta/files/common-licenses/RecipetoolTransient | 1 + meta/lib/oeqa/selftest/cases/devtool.py | 58 ++++++++++++++++++++++++++ scripts/lib/devtool/standard.py | 9 ++-- scripts/lib/scriptutils.py | 2 +- 4 files changed, 66 insertions(+), 4 deletions(-) --- base-commit: 07a342aa80c7349dd014f743a695a5e006add8df change-id: 20260813-mathieu-devtool-9b0b2768098f Best regards, -- Mathieu Dubois-Briand <[email protected]>
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#243516): https://lists.openembedded.org/g/openembedded-core/message/243516 Mute This Topic: https://lists.openembedded.org/mt/120774324/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
