From: Gordon Hecker Date: Fri, 15 Jan 2010 12:07:44 +0000 (+0100) Subject: cleanup: switch cache function calls to object oriented style X-Git-Tag: e2factory-2.3.4pre1~57 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=c56ac4b873963a14a3d91c850c55f08ca4e8667e;p=e2factory.git cleanup: switch cache function calls to object oriented style Signed-off-by: Gordon Hecker --- diff --git a/local/cvs.lua b/local/cvs.lua index 86c4fee..3b852c6 100644 --- a/local/cvs.lua +++ b/local/cvs.lua @@ -153,7 +153,7 @@ function cvs.fetch_source(info, sourcename) local src = info.sources[ sourcename ] local location = src.cvsroot local server = src.server - local surl, re = cache.remote_url(info.cache, server, location) + local surl, re = info.cache:remote_url(server, location) if not surl then return false, e:cat(re) end @@ -205,7 +205,7 @@ function cvs.prepare_source(info, sourcename, source_set, buildpath) local src = info.sources[ sourcename ] local location = src.cvsroot local server = src.server - local surl, re = cache.remote_url(info.cache, server, location) + local surl, re = info.cache:remote_url(server, location) if not surl then return false, e:cat(re) end diff --git a/local/e2build.lua b/local/e2build.lua index 7322c7a..b9e1517 100644 --- a/local/e2build.lua +++ b/local/e2build.lua @@ -74,14 +74,13 @@ function e2build.result_available(info, r, return_flags) local result_location = string.format("%s/%s/%s/result.tar", location, r, dep_set) local cache_flags = {} - rc, re = cache.cache_file(info.cache, server, result_location, cache_flags) + rc, re = info.cache:cache_file(server, result_location, cache_flags) if not rc then 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 = info.cache:file_path(server, result_location, cache_flags) rc = e2lib.isfile(path) if not rc then -- result is not available. Build. @@ -257,13 +256,11 @@ function e2build.setup_chroot(info, r, return_flags) if res.build_config.groups[grp.name] then for _, f in ipairs(grp.files) do local flags = { cache = true } - local rc, re = cache.cache_file(info.cache, f.server, f.location, - flags) + local rc, re = info.cache:cache_file(f.server, f.location, flags) 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 = info.cache:file_path(f.server, f.location, flags) if not path then return false, e:cat(re) end @@ -559,7 +556,7 @@ function e2build.sources(info, r, return_flags) local location1 = string.format("%s/%s/%s/result.tar", location, dep, dep_set) local cache_flags = {} - local rc, re = cache.fetch_file(info.cache, server, location1, tmpdir, + local rc, re = info.cache:fetch_file(server, location1, tmpdir, nil, cache_flags) if not rc then return false, e:cat(re) @@ -658,14 +655,13 @@ function e2build.linklast(info, r, return_flags) local cache_flags = { check_only = true } - local dst, re = cache.file_path(info.cache, server, location1, cache_flags) + local dst, re = info.cache:file_path(server, location1, cache_flags) if not dst then return false, e:cat(re) end -- create the last link local lnk_location = string.format("out/%s/last", r) - local lnk, re = cache.file_path(info.cache, info.root_server_name, - lnk_location) + local lnk, re = info.cache:file_path(info.root_server_name, lnk_location) if not lnk then return false, e:cat(re) end @@ -758,7 +754,7 @@ function e2build.store_result(info, r, return_flags) local cache_flags = { try_hardlink = true, } - local rc, re = cache.push_file(info.cache, sourcefile, server, location1, + local rc, re = info.cache:push_file(sourcefile, server, location1, cache_flags) if not rc then return false, e:cat(re) @@ -970,7 +966,7 @@ function e2build.collect_project(info, r, return_flags) local server = "." local location = string.format("proj/init/%s", f) local cache_flags = {} - rc, re = cache.fetch_file(info.cache, server, location, + rc, re = info.cache:fetch_file(server, location, destdir, nil, cache_flags) if not rc then return false, e:cat(re) @@ -1011,7 +1007,7 @@ function e2build.collect_project(info, r, return_flags) makefile:write(string.format("place:\n")) for _,file in pairs(grp.files) do local cache_flags = {} - rc, re = cache.fetch_file(info.cache, file.server, + rc, re = info.cache:fetch_file(file.server, file.location, destdir, nil, cache_flags) if not rc then return false, e:cat(re) @@ -1059,7 +1055,7 @@ function e2build.collect_project(info, r, return_flags) return false, e:cat(re) end end - rc, re = cache.fetch_file(info.cache, file.server, + rc, re = info.cache:fetch_file(file.server, file.location, destdir, nil, cache_flags) if not rc then @@ -1085,7 +1081,7 @@ function e2build.collect_project(info, r, return_flags) for _,file in pairs(files) do local server = info.root_server_name local cache_flags = {} - rc, re = cache.fetch_file(info.cache, server, file, + rc, re = info.cache:fetch_file(server, file, destdir, nil, cache_flags) if not rc then return false, e:cat(re) @@ -1163,7 +1159,7 @@ function e2build.collect_project(info, r, return_flags) ".e2/lib/make/detect_tool", } for _,location in ipairs(locations) do - rc, re = cache.fetch_file(info.cache, server, location, + rc, re = info.cache:fetch_file(server, location, destdir, nil, cache_flags) if not rc then return false, e:cat(re) diff --git a/local/e2tool.lua b/local/e2tool.lua index 44bb71c..6246393 100644 --- a/local/e2tool.lua +++ b/local/e2tool.lua @@ -963,11 +963,11 @@ function e2tool.read_hash_file(info, server, location) local e = new_error("error reading hash file") local cs = nil local cache_flags = { cache = true } - local rc, re = cache.cache_file(info.cache, server, location, cache_flags) + local rc, re = info.cache:cache_file(server, location, cache_flags) if not rc then return nil, e:cat(re) end - local path = cache.file_path(info.cache, server, location, cache_flags) + local path = info.cache:file_path(server, location, cache_flags) if path then cs = e2lib.read_line(path) if cs then @@ -1008,11 +1008,11 @@ end function e2tool.hash_file(info, server, location) local e = new_error("error hashing file") local cache_flags = { cache = true } - local rc, re = cache.cache_file(info.cache, server, location, cache_flags) + local rc, re = info.cache:cache_file(server, location, cache_flags) if not rc then return nil, e:cat(re) end - local path, re = cache.file_path(info.cache, server, location, cache_flags) + local path, re = info.cache:file_path(server, location, cache_flags) if not path then return nil, e:cat(re) end @@ -1306,8 +1306,7 @@ end function e2tool.hashcache(info, file) local e = new_error("getting fileid from hash cache") local rc, re, fileid - local p, re = cache.file_path(info.cache, file.server, - file.location, {}) + local p, re = info.cache:file_path(file.server, file.location, {}) if not p then return e:cat(re) end @@ -1346,14 +1345,13 @@ function e2tool.verify_remote_fileid(info, file, fileid) local rc, re local e = new_error("error calculating remote file id for file %s:%s", file.server, file.location) - if not cache.cache_enabled(info.cache, file.server) or + if not info.cache:cache_enabled(file.server) or not e2option.opts["check-remote"] then e2lib.logf(4, "checksum for remote file %s:%s skip verifying", file.server, file.location) return true, nil end - local surl, re = cache.remote_url(info.cache, file.server, - file.location) + local surl, re = info.cache:remote_url(file.server, file.location) if not surl then return false, e:cat(re) end diff --git a/local/fetch-sources.lua b/local/fetch-sources.lua index 7467ed2..d85baa1 100755 --- a/local/fetch-sources.lua +++ b/local/fetch-sources.lua @@ -117,7 +117,7 @@ end function cache_chroot(info) for _,c in ipairs(info.chroot) do for _,file in ipairs(c.files) do - local rc, e = cache.cache_file(info.cache, c.server, file, {}) + local rc, e = info.cache:cache_file(c.server, file, {}) if not rc then return false, "caching file failed" end diff --git a/local/files.lua b/local/files.lua index e925046..2f170c4 100644 --- a/local/files.lua +++ b/local/files.lua @@ -122,7 +122,7 @@ function files.cache_source(info, sourcename) f.server, f.location)) local flags = { cache = true } if f.server ~= info.root_server_name then - local rc, e = cache.cache_file(info.cache, f.server, f.location, flags) + local rc, e = info.cache:cache_file(f.server, f.location, flags) if not rc then return false, e end @@ -188,12 +188,12 @@ function files.prepare_source(info, sourcename, sourceset, buildpath) end if file.unpack then local cache_flags = { cache = true } - local rc, re = cache.cache_file(info.cache, file.server, file.location, + local rc, re = info.cache:cache_file(file.server, file.location, cache_flags) if not rc then return false, e:cat(re) end - local path, re = cache.file_path(info.cache, file.server, file.location, + local path, re = info.cache:file_path(file.server, file.location, cache_flags) if not path then return false, e:cat(re) @@ -221,12 +221,12 @@ function files.prepare_source(info, sourcename, sourceset, buildpath) end if file.patch then local cache_flags = { cache = true } - local rc, re = cache.cache_file(info.cache, file.server, file.location, + local rc, re = info.cache:cache_file(file.server, file.location, cache_flags) if not rc then return false, e:cat(re) end - local path, re = cache.file_path(info.cache, file.server, + local path, re = info.cache:file_path(file.server, file.location, cache_flags) if not path then return false, e:append(re) @@ -258,7 +258,7 @@ function files.prepare_source(info, sourcename, sourceset, buildpath) "can't create destination directory: %s", destdir)) end end - local rc, re = cache.fetch_file(info.cache, file.server, file.location, + local rc, re = info.cache:fetch_file(file.server, file.location, destdir, destname, {}) if not rc then return false, e:cat(re) @@ -373,7 +373,7 @@ function files.toresult(info, sourcename, sourceset, directory) local destdir = string.format("%s/%s", directory, source) local destname = nil e2lib.mkdir(destdir, "-p") - local rc, re = cache.fetch_file(info.cache, file.server, + local rc, re = info.cache:fetch_file(file.server, file.location, destdir, destname, {}) if not rc then return false, e:cat(re) diff --git a/local/policy.lua b/local/policy.lua index 08d3458..e1d99d6 100644 --- a/local/policy.lua +++ b/local/policy.lua @@ -142,7 +142,7 @@ function init(info) local server, location = s(location, release_id) local se = new_error("checking server configuration for '%s'", server) - local ce, re = cache.ce_by_server(info.cache, server) + local ce, re = info.cache:ce_by_server(server) if not ce then se:cat(re) elseif not ce.flags.writeback then diff --git a/local/svn.lua b/local/svn.lua index 69d3f2b..993c205 100644 --- a/local/svn.lua +++ b/local/svn.lua @@ -72,7 +72,7 @@ function svn.fetch_source(info, sourcename) --OK local src = info.sources[ sourcename ] local location = src.location local server = src.server - local surl, re = cache.remote_url(info.cache, server, location) + local surl, re = info.cache:remote_url(server, location) if not surl then return false, e:cat(re) end @@ -98,7 +98,7 @@ function svn.prepare_source(info, sourcename, source_set, build_path) --OK local src = info.sources[ sourcename ] local location = src.location local server = src.server - local surl, re = cache.remote_url(info.cache, server, location) + local surl, re = info.cache:remote_url(server, location) if not surl then return false, e:cat(re) end