]> git.e2factory.org Git - e2factory.git/commitdiff
transport: use rsync instead of curl to handle file:// urls
authorGordon Hecker <gh@emlix.com>
Wed, 24 Mar 2010 08:29:59 +0000 (09:29 +0100)
committerGordon Hecker <gh@emlix.com>
Mon, 3 May 2010 09:49:43 +0000 (11:49 +0200)
Signed-off-by: Gordon Hecker <gh@emlix.com>
Changelog
generic/transport.lua

index ef17e0662c5adf23b87b4bfc73f0c223d47595e6..f6aca055e319ca08f51b068c3802cd3bfd5238d3 100644 (file)
--- 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
 
index 6af13a408f7d33d86068b46e2656573993c80434..450a9c6f7a812dc03076055ed9646e4108337657 100644 (file)
@@ -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