]> git.e2factory.org Git - e2factory.git/commitdiff
Move patch() into files plugin and convert to argv
authorTobias Ulmer <tu@emlix.com>
Mon, 18 Nov 2013 13:25:10 +0000 (14:25 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua
plugins/files.lua

index c900ce1177bf8435b2f41289b3dcc578bde75079..469fddc2a57013613d6f5f3668550bb73de8b603 100644 (file)
@@ -1746,15 +1746,6 @@ function e2lib.mkdir_recursive(path, mode)
     return true
 end
 
---- call the patch command
--- @param dir string: the directory name
--- @param flags string: flags to pass to mkdir
--- @return bool
--- @return the last line ouf captured output
-function e2lib.patch(args)
-    return e2lib.call_tool("patch", args)
-end
-
 --- Call a tool.
 -- @param tool Tool name as registered in the tools library (string).
 -- @param args Arguments as a string. Caller is responsible for safe escaping.
index d307edef98c1ff695cf9302203943735c97b6417..3178c48897e5843f9ba101264824107c0042a5a6 100644 (file)
@@ -314,6 +314,14 @@ local function gen_unpack_command(physpath, virtpath, destdir)
     return tool, toolargv
 end
 
+--- Call the patch command
+-- @param argv Vector of arguments supplied to patch tool.
+-- @return True on success, false on error.
+-- @return Error object on failure.
+local function patch_tool(argv)
+    return e2lib.call_tool_argv("patch", argv)
+end
+
 --- Prepare a files source.
 -- @param info The info table.
 -- @param sourcename The source name (string)
@@ -392,9 +400,8 @@ function files.prepare_source(info, sourcename, sourceset, buildpath)
                 if not path then
                     return false, e:append(re)
                 end
-                local args = string.format("-p '%s' -d '%s' -i '%s'", file.patch,
-                symlink, path)
-                rc, re = e2lib.patch(args)
+                local argv = { "-p", file.patch, "-d", symlink, "-i", path }
+                rc, re = patch_tool(argv)
                 if not rc then
                     e:append("applying patch: \"%s:%s\"", file.server, file.location)
                     return false, e:cat(re)