All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
To: openembedded-core@lists.openembedded.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Subject: [PATCH 2/4] devtool: standard: Fix file copy on finish --force
Date: Fri, 14 Aug 2026 18:26:35 +0200	[thread overview]
Message-ID: <20260814-mathieu-devtool-v1-2-985e81a17bb3@bootlin.com> (raw)
In-Reply-To: <20260814-mathieu-devtool-v1-0-985e81a17bb3@bootlin.com>

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.

Fixes: ce8190c51905: devtool: Drop oe-local-files and simplify
---
 scripts/lib/devtool/standard.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 9b2643604d1d..536411efef6a 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1461,13 +1461,17 @@ def _export_local_files(srctree, rd, destdir, srctreebase):
         if os.path.exists(os.path.join(fullfile, ".git")):
             # submodules handled elsewhere
             continue
-        if f not in existing_files:
+        if f not in existing_files and os.path.exists(fullfile):
             added[f] = {}
+            parentdir = os.path.normpath(os.path.join(destdir, f, os.pardir))
+            if not os.path.isdir(parentdir):
+                os.makedirs(parentdir)
+
             if os.path.isdir(os.path.join(srctree, f)):
                 shutil.copytree(fullfile, os.path.join(destdir, f))
             else:
                 shutil.copy2(fullfile, os.path.join(destdir, f))
-        elif not os.path.exists(fullfile):
+        elif f in existing_files and not os.path.exists(fullfile):
             removed[f] = existing_files[f]
         elif f in existing_files:
             updated[f] = {'path' : existing_files[f]}

-- 
2.47.3



  parent reply	other threads:[~2026-08-14 16:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 16:26 [PATCH 0/4] devtool: standard: Fix file copy on finish --force Mathieu Dubois-Briand
2026-08-14 16:26 ` [PATCH 1/4] scripts: scriptutils: Use LicenseRef-Proprietary LICENSE while fetching Mathieu Dubois-Briand
2026-08-14 16:26 ` Mathieu Dubois-Briand [this message]
2026-08-14 16:32   ` Patchtest results for [PATCH 2/4] devtool: standard: Fix file copy on finish --force patchtest
2026-08-14 17:13     ` [OE-core] " Mathieu Dubois-Briand
2026-08-14 16:26 ` [PATCH 3/4] devtool: standard: Remove unused variable Mathieu Dubois-Briand
2026-08-14 16:32   ` Patchtest results for " patchtest
2026-08-14 16:26 ` [PATCH 4/4] oe-selftest: devtool: Add test for add/finish workflow Mathieu Dubois-Briand
2026-08-14 16:32   ` Patchtest results for " patchtest

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260814-mathieu-devtool-v1-2-985e81a17bb3@bootlin.com \
    --to=mathieu.dubois-briand@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.