[PATCH 6/9] fetch2/repo: fix mirror tar command arguments

Anders Heimer <[email protected]> Thu, 25 Jun 2026 09:07:47 +0200
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <[email protected]>
The direct tar invocation no longer has a shell to expand ./* or
strip quotes from exclude patterns. Build the path list explicitly and
pass tar exclude patterns without shell quote characters.

Signed-off-by: Anders Heimer <[email protected]>
---
 lib/bb/fetch2/repo.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/bb/fetch2/repo.py b/lib/bb/fetch2/repo.py
index 8543e3d59..9b96cd824 100644
--- a/lib/bb/fetch2/repo.py
+++ b/lib/bb/fetch2/repo.py
@@ -73,10 +73,13 @@ class Repo(FetchMethod):
         if scmdata == "keep":
             tar_flags = []
         else:
-            tar_flags = ["--exclude='.repo'", "--exclude='.git'"]
+            tar_flags = ["--exclude=.repo", "--exclude=.git"]
 
         # Create a cache
-        runfetchcmd(['tar'] + tar_flags + ['-czf', ud.localpath, os.path.join(".", "*")], d, workdir=codir)
+        tar_paths = [os.path.join(".", name)
+                     for name in sorted(os.listdir(codir))
+                     if not name.startswith(".")]
+        runfetchcmd(['tar'] + tar_flags + ['-czf', ud.localpath] + tar_paths, d, workdir=codir)
 
     def supports_srcrev(self):
         return False