]> git.e2factory.org Git - e2factory.git/commitdiff
cache: file_path() remove unused flags and clean up
authorTobias Ulmer <tu@emlix.com>
Wed, 31 Aug 2016 13:30:46 +0000 (15:30 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/cache.lua
local/e2build.lua
local/e2tool.lua
plugins/files.lua

index 99648d529278096b2d17459957a8b4798e744fea..343043c444503e668aad856748efb9a3993cd941 100644 (file)
@@ -517,31 +517,31 @@ end
 -- @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
index bbb2176ad085a6eca1cb33dbe1c736b027734d2d..0109aae57602222bdf78d5077c49ce5454ef702f 100644 (file)
@@ -237,9 +237,7 @@ function e2build.build_process_class:_result_available(res, return_flags)
         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.
@@ -367,8 +365,7 @@ function e2build.build_process_class:_setup_chroot(res, return_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 = cache.file_path(info.cache, f.server, f.location)
             if not path then
                 return false, e:cat(re)
             end
@@ -556,7 +553,7 @@ function e2build.build_process_class:helper_unpack_result(res, dep, destdir)
         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
@@ -974,8 +971,7 @@ function e2build.build_process_class:_linklast(res, return_flags)
         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
index 43b9b78bfced7acc46deae640ba624aa0106fee5..b1eb64952b0593257c50c3bf102a31b0f22888ed 100644 (file)
@@ -909,8 +909,7 @@ function e2tool.fileid(info, file)
             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
index 9578d180dcff8ba04c5a5ec714581d11f05ae3e4..70af7c0b7e573d2b6656a03a2c14c5da6964a71e 100644 (file)
@@ -554,8 +554,7 @@ function files.prepare_source(info, sourcename, sourceset, buildpath)
             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
@@ -604,8 +603,7 @@ function files.prepare_source(info, sourcename, sourceset, buildpath)
                 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