]> git.e2factory.org Git - e2factory.git/commitdiff
git: fix git archive | tar pipe calling sequence
authorTobias Ulmer <tu@emlix.com>
Thu, 9 May 2019 14:35:37 +0000 (16:35 +0200)
committerTobias Ulmer <tu@emlix.com>
Thu, 9 May 2019 14:35:40 +0000 (16:35 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
plugins/git.lua

index d501a0a98c9188a2026e437bb6ea43c4a247e319..5d62da8eb639b2f075112d90603f4ecd70df4b8a 100644 (file)
@@ -709,7 +709,7 @@ function git.git_source:prepare_source(sourceset, buildpath)
     end
 
     local gitdir, git_argv, git_tool, tar_argv
-    local pid, status, fdctv
+    local pid, status, git_fdctv, tar_fdctv
     local writeend, readend, devnull
     local children = {}
 
@@ -770,29 +770,44 @@ function git.git_source:prepare_source(sourceset, buildpath)
         e2lib.log(3, "[git archive]: "..msg)
     end
 
-    fdctv = {
+    git_fdctv = {
         { istype = "readfo", dup = eio.STDIN, file = devnull },
         { istype = "readfo", dup = eio.STDOUT, file = writeend },
         { istype = "writefunc", dup = eio.STDERR, linebuffer = true, callfn = log_git },
     }
 
-    pid, re = e2lib.callcmd(git_argv, fdctv, nil, nil, true)
+    pid, re = e2lib.callcmd(git_argv, git_fdctv, nil, nil, 'nopoll')
     if not pid then
         return false, e:cat(re)
     end
     table.insert(children, { pid=pid, name="git" })
 
-    fdctv = {
+    tar_fdctv = {
         { istype = "readfo", dup = eio.STDIN, file = readend },
         { istype = "readfo", dup = eio.STDOUT, file = devnull }
     }
 
-    pid, re = e2lib.callcmd(tar_argv, fdctv, nil, nil, true)
+    pid, re = e2lib.callcmd(tar_argv, tar_fdctv, nil, nil, 'nopoll')
     if not pid then
         return false, e:cat(re)
     end
     table.insert(children, { pid=pid, name="tar" })
 
+    rc, re = e2lib.callcmd_poll(git_fdctv, tar_fdctv)
+    if not rc then
+        return false, e:cat(re)
+    end
+
+    rc, re = e2lib.callcmd_cleanup(git_fdctv)
+    if not rc then
+        return false, e:cat(re)
+    end
+
+    rc, re = e2lib.callcmd_cleanup(tar_fdctv)
+    if not rc then
+        return false, e:cat(re)
+    end
+
     local errors = false
     while (#children > 0) do
         local found = false