While uploading a change to client/bin/utils.py, I noticed this error:
E:148,24: Undefined variable 'hash_file' (undefined-variable)
The code is quite old (it was moved recently from base_utils.py to utils.py, though):
d60882f21c client/bin/base_utils.py (lmr 2010-02-04 03:26:36 +0000 113) def unmap_url_cache(cachedir, url, expected_hash, method="md5"):
...
d60882f21c client/bin/base_utils.py (lmr 2010-02-04 03:26:36 +0000 138) while not file_hash == expected_hash:
d60882f21c client/bin/base_utils.py (lmr 2010-02-04 03:26:36 +0000 139) if os.path.isfile(file_local_path):
d60882f21c client/bin/base_utils.py (lmr 2010-02-04 03:26:36 +0000 140) file_hash = hash_file(file_local_path, method)
d60882f21c client/bin/base_utils.py (lmr 2010-02-04 03:26:36 +0000 141) if file_hash == expected_hash:
d60882f21c client/bin/base_utils.py (lmr 2010-02-04 03:26:36 +0000 142) # File is already at the expected position and ready to go
d60882f21c client/bin/base_utils.py (lmr 2010-02-04 03:26:36 +0000 143) src = file_from_url
It does appear hash_file function was removed by this commit:
commit c32ef4d9f8a9f659cafdfaeebfdcfcb6d3356211
Author: Richard Barnette <jrbarnette@chromium.org>
Date: Thu Apr 21 12:31:05 2016 -0700
[autotest] Delete client/tests/kvm and related dead code.
This deletes code related to kernel tests for KVM (N.B. _not_ the
Chrome OS tests that run inside KVM in the builders), as well as
various client-side libraries that become dead after the deletion.
BUG=None
TEST=Run push_to_prod suite on a local instance
Change-Id: I6cb49f7c0eac5da07c27112071e0effda69f2a7a
Reviewed-on: https://chromium-review.googlesource.com/340243
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
And there are still a few users of unmap_url_cache, not sure if any of them matter:
client/tests/dacapo/dacapo.py: dacapo_pkg = utils.unmap_url_cache(cachedir, dacapo_url, dacapo_md5)
client/tests/dacapo/dacapo.py: jvm_pkg = utils.unmap_url_cache(cachedir, jvm_pkg_url, jvm_pkg_md5)
client/tests/dma_memtest/dma_memtest.py: self.tarball = utils.unmap_url_cache(self.cachedir, tarball_url,
client/tests/lsb_dtk/lsb_dtk.py: dtk_manager_pkg = utils.unmap_url_cache(self.cachedir,
client/tests/lsb_dtk/lsb_dtk.py: lsb_pkg = utils.unmap_url_cache(self.cachedir, lsb_url, lsb_md5)
Comment 1 by dtapu...@chromium.org
, Nov 12 2017