From: Gordon Hecker Date: Wed, 24 Mar 2010 08:29:59 +0000 (+0100) Subject: transport: use rsync instead of curl to handle file:// urls X-Git-Tag: e2factory-2.3.6pre1~6 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=263bd7152d897b57cd7c4842285f384428e634d9;p=e2factory.git transport: use rsync instead of curl to handle file:// urls Signed-off-by: Gordon Hecker --- diff --git a/Changelog b/Changelog index ef17e06..f6aca05 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ NEXT: + * rsync is now used instead of curl to access local files * allow environment configuration in source and results configuration files diff --git a/generic/transport.lua b/generic/transport.lua index 6af13a4..450a9c6 100644 --- a/generic/transport.lua +++ b/generic/transport.lua @@ -55,8 +55,7 @@ function fetch_file(surl, location, destdir, destname) local tmpfile_path = e2lib.mktempfile(template) local tmpfile = e2lib.basename(tmpfile_path) -- fetch the file to the temporary directory - if u.transport == "file" or - u.transport == "http" or + if u.transport == "http" or u.transport == "https" then -- use special flags here local curlflags = "--create-dirs --silent --show-error --fail" @@ -66,6 +65,14 @@ function fetch_file(surl, location, destdir, destname) if not rc then return false, e:cat(re) end + elseif u.transport == "file" then + -- rsync "sourcefile" "destdir/destfile" + local args = string.format("'/%s/%s' '%s/%s'", + u.path, location, destdir, tmpfile) + rc, re = e2lib.rsync(args) + if not rc then + return false, e:cat(re) + end elseif u.transport == "rsync+ssh" then local user if u.user then