cros_bundle_firmware: Show the correct ebuild name
When we look up the path of a tool (e.g. cbfstool) and it is not present
we currently display the full path as the name of the ebuild. We should
display 'cbfstool' instead of '/usr/bin/cbfstool'.
BUG=none
TEST=manual
Remove tegrarcm tool and run 'cros_bundle_firmware'
See that it requests that we emerge 'tegrarcm'.
Change-Id: Ibeb55400b2ae58561474e33e9e3805f433cc5903
Reviewed-on: https://gerrit.chromium.org/gerrit/34384
Reviewed-by: Simon Glass <[email protected]>
Tested-by: Simon Glass <[email protected]>
Commit-Ready: Simon Glass <[email protected]>
diff --git a/host/lib/tools.py b/host/lib/tools.py
index e7097a4..e1e314c 100755
--- a/host/lib/tools.py
+++ b/host/lib/tools.py
@@ -261,14 +261,14 @@
return str.strip()
raise CmdError("Cannot find version script 'chromeos_version.sh'")
- def CheckTool(self, filename, ebuild=None):
+ def CheckTool(self, name, ebuild=None):
"""Check that the specified tool exists.
If it does not exist in the PATH, then generate a useful error message
indicating how to install the ebuild that contains the required tool.
Args:
- filename: filename of tool to look for on path.
+ name: filename of tool to look for on path.
ebuild: name of ebuild which should be emerged to install this tool,
or None if it is the same as the filename.
@@ -276,6 +276,7 @@
CmdError(msg) if the tool is not found.
"""
try:
+ filename = name
if filename in self._tools:
filename = self._tools[filename]
filename = self.Filename(filename)
@@ -283,7 +284,7 @@
except CmdError as err:
raise CmdError("The '%s' utility was not found in your path. "
"Run the following command in \nyour chroot to install it: "
- "sudo -E emerge %s" % (filename, ebuild or filename))
+ "sudo -E emerge %s" % (filename, ebuild or name))
def OutputSize(self, label, filename, level=cros_output.NOTICE):
"""Display the filename and size of an object.