From d62010a1e06aa88e176fe732e7d248abe12b2c1d Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Mon, 3 Jun 2019 22:11:15 +1000 Subject: [PATCH] tools: Remove hashes from metadata. - Hashes aren't strictly metadata. - Which types of hashes are popular? - Hashes are expensive to calculate. --- eris/tools.py | 7 +------ tests/golden-files/results/metadata-hi3_py | 3 --- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/eris/tools.py b/eris/tools.py index 07c377d..6a0cf42 100644 --- a/eris/tools.py +++ b/eris/tools.py @@ -187,7 +187,7 @@ def _pretty_bytes(bytes): return f"{conversion} {units[unit_index]}" -@deps(deps={"file", "coreutils"}, executables={"file", "sha1sum", "md5sum"}) +@deps(deps={"file", "coreutils"}, executables={"file"}) def metadata(path): def detail(value, unit): @@ -213,10 +213,6 @@ def metadata(path): stdout, *rest = _do_command( ["file", "--dereference", "--brief", "--uncompress", path]) file_type = stdout - stdout, *rest = _do_command(["md5sum", path]) - md5sum = stdout.split()[0] - stdout, *rest = _do_command(["sha1sum", path]) - sha1sum = stdout.split()[0] permissions_value = [permissions, detail(_permissions_in_octal(permissions), None)] text = [] @@ -226,7 +222,6 @@ def metadata(path): ("access time", access), None, ("owner", owner), ("group", group), None, ("hardlinks", hardlinks), ("symlink", is_symlink), None, - ("md5", md5sum), ("sha1", sha1sum), None, ("mime type", mime_type.strip()), ("file type", file_type.strip())]: if line is None: diff --git a/tests/golden-files/results/metadata-hi3_py b/tests/golden-files/results/metadata-hi3_py index bfa8378..0991a88 100644 --- a/tests/golden-files/results/metadata-hi3_py +++ b/tests/golden-files/results/metadata-hi3_py @@ -11,8 +11,5 @@ hardlinks:(B 2 (Bsymlink:(B no -(Bmd5:(B 28ca2e417cb64ea4e555efe3203642de -(Bsha1:(B 8b8c0214f3f0a0d79032d1b44550064964a33a26 - (Bmime type:(B text/x-python; charset=us-ascii (Bfile type:(B Python script, ASCII text executable  \ No newline at end of file