From a3a0c54c6ead99a63b6574d1704b1f17eabf5b80 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Tue, 7 Aug 2012 12:37:32 +0200 Subject: [PATCH] Require the transport module where needed Signed-off-by: Tobias Ulmer --- generic/cache.lua | 2 +- generic/transport.lua | 10 ++++++---- local/e2build.lua | 1 + local/e2tool.lua | 1 - 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/generic/cache.lua b/generic/cache.lua index 85e37d2..61b35cc 100644 --- a/generic/cache.lua +++ b/generic/cache.lua @@ -27,7 +27,7 @@ local cache = {} require("e2lib") -require("transport") +local transport = require("transport") local url = require("url") --- cache diff --git a/generic/transport.lua b/generic/transport.lua index 0a54759..8142a1e 100644 --- a/generic/transport.lua +++ b/generic/transport.lua @@ -25,7 +25,7 @@ along with this program. If not, see . ]] -module("transport", package.seeall) +local transport = {} local url = require("url") --- call rsync with appropriate rsh argument according to the tools @@ -133,7 +133,7 @@ end -- @param destname filename of the fetched file -- @return true on success, false on error -- @return an error object on failure -function fetch_file(surl, location, destdir, destname) +function transport.fetch_file(surl, location, destdir, destname) e2lib.log(4, string.format("%s: %s %s %s", "fetch_file()", surl, location, destdir)) if not destname then @@ -223,7 +223,7 @@ end -- @param try_hardlink bool: optimize by trying to hardlink instead of copying -- @return true on success, false on error -- @return nil, an error string on error -function push_file(sourcefile, durl, location, push_permissions, try_hardlink) +function transport.push_file(sourcefile, durl, location, push_permissions, try_hardlink) e2lib.log(4, string.format("%s: %s %s %s %s", "transport.push_file()", sourcefile, durl, location, tostring(push_permissions))) local rc, e @@ -342,7 +342,7 @@ end -- @param location location relative to the server url -- @return true on success, false on error -- @return nil, an error string on error -function file_path(surl, location) +function transport.file_path(surl, location) e2lib.log(4, string.format("%s: %s %s", "file_path()", surl, location)) local e = new_error("can't get path to file") @@ -356,3 +356,5 @@ function file_path(surl, location) local path = string.format("/%s/%s", u.path, location) return path end + +return transport diff --git a/local/e2build.lua b/local/e2build.lua index 9534583..d108af9 100644 --- a/local/e2build.lua +++ b/local/e2build.lua @@ -28,6 +28,7 @@ -- e2build.lua -*- Lua -*- module("e2build", package.seeall) +local transport = require("transport") --- cache a result -- @param info diff --git a/local/e2tool.lua b/local/e2tool.lua index 9a8ad34..66f5d2e 100644 --- a/local/e2tool.lua +++ b/local/e2tool.lua @@ -40,7 +40,6 @@ require("git") require("cvs") require("svn") require("cache") -require("transport") require("tools") require("environment") require("plugin") -- 2.39.5