]> git.e2factory.org Git - e2factory.git/commitdiff
file_class: replace hash_file_once with digest to compute checksum
authorTobias Ulmer <tu@emlix.com>
Thu, 1 Dec 2016 19:28:24 +0000 (20:28 +0100)
committerTobias Ulmer <tu@emlix.com>
Thu, 1 Dec 2016 19:28:24 +0000 (20:28 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/e2tool.lua

index 7bf7b8bcaf6ecbe9822834287a73d45793ac323f..f932c4d241c9f989c8edfa985cca5b3c8f7f273a 100644 (file)
@@ -122,7 +122,7 @@ end
 -- @return SHA1 checksum on success, false if an error occured.
 -- @return error object on failure.
 function e2tool.file_class:_compute_checksum(flags)
-    local rc, re, info, path, checksum
+    local rc, re, info, path, dt
 
     info = e2tool.info()
 
@@ -132,12 +132,14 @@ function e2tool.file_class:_compute_checksum(flags)
         return false, re
     end
 
-    checksum, re = hash.hash_file_once(path)
-    if not checksum then
+    dt = digest.new()
+    digest.new_entry(dt, digest.SHA1, nil--[[checksum]], nil--[[name]], path)
+    rc, re = digest.checksum(dt, false)
+    if not rc then
         return false, re
     end
 
-    return checksum
+    return dt[1].checksum
 end
 
 --- Compute checksum of file on the remote server, if transport supports it.