diff mbox series

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

Message ID 20260625070750.2757558-7-anders.heimer@est.tech
State New
Headers show
Series Follow-up fixes for command argument conversions | expand

Commit Message

Anders Heimer June 25, 2026, 7:07 a.m. UTC
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 <anders.heimer@est.tech>
---
 lib/bb/fetch2/repo.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

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