-- @param c the cache data structure
-- @param server the server where the file is located
-- @param location the location on the server
--- @param flags unused parameter
-- @return string the path to the cached file, false on error
-- @return an error object on failure
-function cache.file_path(c, server, location, flags)
- local rc, re
- local e = err.new("providing file path failed")
- -- get the cache entry
- local ce, re = cache.ce_by_server(c, server)
+function cache.file_path(c, server, location)
+ local rc, re, e
+ local ce, path
+
+ e = err.new("providing path to file not possible (remote server, no cache?)")
+
+ ce, re = cache.ce_by_server(c, server)
if not ce then
return false, e:cat(re)
end
- assertFlags(flags)
+
if ce.flags.cache then
- -- cache enabled. cache the file and return path to cached
- -- file
- local path, re = transport.file_path(ce.cache_url, location)
+ path, re = transport.file_path(ce.cache_url, location)
if not path then
return false, e:cat(re)
end
return path
end
+
-- try if the transport delivers a path directly (works for file://)
- local path, re = transport.file_path(ce.remote_url, location)
+ path, re = transport.file_path(ce.remote_url, location)
if not path then
- e:append("Enable caching for this server.")
+ e:append("Try to enable caching for this server.")
return false, e:cat(re)
end
return path
e2lib.log(3, "caching result failed")
-- ignore
end
- local cache_flags = {}
- local path, re = cache.file_path(info.cache, server, result_location,
- cache_flags)
+ local path, re = cache.file_path(info.cache, server, result_location)
rc = e2lib.isfile(path)
if not rc then
-- result is not available. Build.
if not rc then
return false, e:cat(re)
end
- local path, re = cache.file_path(info.cache, f.server,
- f.location, flags)
+ local path, re = cache.file_path(info.cache, f.server, f.location)
if not path then
return false, e:cat(re)
end
dep:get_name(), server, location)
resulttarpath = e2lib.join(location, dep:get_name(), dep_set, "result.tar")
- path, re = cache.file_path(info.cache, server, resulttarpath, {})
+ path, re = cache.file_path(info.cache, server, resulttarpath)
if not path then
return false, e:cat(re)
end
return false, e:cat(re)
end
local location1 = e2lib.join(location, res:get_name(), buildid)
- local cache_flags = {}
- local dst, re = cache.file_path(info.cache, server, location1, cache_flags)
+ local dst, re = cache.file_path(info.cache, server, location1)
if not dst then
return false, e:cat(re)
end
return false, e:cat(re)
end
- path, re = cache.file_path(info.cache, file.server,
- file.location, cache_flags)
+ path, re = cache.file_path(info.cache, file.server, file.location)
if not path then
return false, e:cat(re)
end
if not rc then
return false, e:cat(re)
end
- local path, re = cache.file_path(info.cache, file.server,
- file.location, cache_flags)
+ local path, re = cache.file_path(info.cache, file.server, file.location)
if not path then
return false, e:cat(re)
end
if not rc then
return false, e:cat(re)
end
- local path, re = cache.file_path(info.cache, file.server,
- file.location, cache_flags)
+ local path, re = cache.file_path(info.cache, file.server, file.location)
if not path then
return false, e:append(re)
end