]> git.e2factory.org Git - e2factory.git/commitdiff
Remove e2lib.sha1sum() in favor of the hash module
authorTobias Ulmer <tu@emlix.com>
Wed, 20 Nov 2013 15:50:52 +0000 (16:50 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index ac46c27dac6182a3e6855d1a830b1df0cfffb000..ca6d16550fb6fef09a07bf91734c33c96d79e3a9 100644 (file)
@@ -2185,48 +2185,6 @@ function e2lib.isfile(path)
     return false
 end
 
---- Calculate SHA1 sum of a file.
--- @param path string: path
--- @return SHA1 sum of file or false on error.
--- @return Error object on failure.
-function e2lib.sha1sum(path)
-    local rc, re, e, sha1sum, sha1sum_flags, cmd, p, msg, out, sha1, file
-
-    assert(type(path) == "string")
-
-    e = err.new("calculating SHA1 checksum failed")
-
-    sha1sum, re = tools.get_tool("sha1sum")
-    if not sha1sum then
-        return false , e:cat(re)
-    end
-
-    sha1sum_flags, re = tools.get_tool_flags("sha1sum")
-    if not sha1sum_flags then
-        return false, e:cat(re)
-    end
-
-    sha1sum_flags = table.concat(sha1sum_flags, " ")
-
-    cmd = string.format("%s %s %s", e2lib.shquote(sha1sum), sha1sum_flags,
-        e2lib.shquote(path))
-
-    p, msg = io.popen(cmd, "r")
-    if not p then
-        return false, e:cat(msg)
-    end
-
-    out, msg = p:read("*l")
-    p:close()
-
-    sha1, file = out:match("(%S+)  (%S+)")
-    if type(sha1) ~= "string" then
-        return false, e:cat("parsing sha1sum output failed")
-    end
-
-    return sha1
-end
-
 --- call the e2-su-2.2 command
 -- @param argv table: argument vector
 -- @return bool