Skip to content

devtool: standard: Fix file copy on finish --force

Mathieu Dubois-Briand openembedded-core 2 versions – In review

Get series with b4
b4 am [email protected] change-id 20260813-mathieu-devtool-9b0b2768098f

Versions newest first

  1. v2 Latest4 patches 1 replyIn review
  2. v14 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- Use RecipetoolTransient instead of Proprietary.
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4scripts: scriptutils: Use LicenseRef-RecipetoolTransient LICENSE while fetchingmeta/files/common-licenses/RecipetoolTransient scripts/lib/scriptutils.py+2 -10 replies
2/4devtool: standard: Fix file copy on finish --forcescripts/lib/devtool/standard.py+6 -20 replies
3/4devtool: standard: Remove unused variablescripts/lib/devtool/standard.py+0 -11 reply
4/4oe-selftest: devtool: Add test for add/finish workflowmeta/lib/oeqa/selftest/cases/devtool.py+58 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] devtool: standard: Fix file copy on finish --force

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.

---
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,

Signature · 1 line
Mathieu Dubois-Briand <[email protected]>