]> git.e2factory.org Git - e2factory.git/commitdiff
cleanup: switch cache function calls to object oriented style
authorGordon Hecker <gh@emlix.com>
Fri, 15 Jan 2010 12:07:44 +0000 (13:07 +0100)
committerGordon Hecker <gh@emlix.com>
Fri, 12 Feb 2010 09:51:57 +0000 (10:51 +0100)
Signed-off-by: Gordon Hecker <gh@emlix.com>
local/cvs.lua
local/e2build.lua
local/e2tool.lua
local/fetch-sources.lua
local/files.lua
local/policy.lua
local/svn.lua

index 86c4feea9a2fd34a97a75392f49863b9a01e20f5..3b852c6efe6f65ca5c3a4da830429175cf0b29ec 100644 (file)
@@ -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
index 7322c7a579a07d085273cde709bb73370977b209..b9e15173258a9b90f749a6c7c1f2600788656d04 100644 (file)
@@ -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)
index 44bb71cc9938d42b6d99bd209ffaf59699cb5d13..6246393213e327fdad8f3a895404a5925c64de89 100644 (file)
@@ -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
index 7467ed2ec13e7c788c0303ed49741e3dfe7602d3..d85baa1c810b27d5e0de56c74496a3515cd6bd8b 100755 (executable)
@@ -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
index e925046f582c0dd246adb23dea9eeaa27cabb42a..2f170c41517cc801f232229ec0e6741c0061decf 100644 (file)
@@ -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)
index 08d34583dbac15484b6e7d3d466022ea7287c75e..e1d99d6f5cc428bbcdfeb2cde817c0cf25c32f32 100644 (file)
@@ -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
index 69d3f2b4cf794cfb6c8266350ba260f3086c2ac8..993c20507ea265656b8ee535e5dc8e9a1fbc9ba6 100644 (file)
@@ -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