cros_build_lib: new MachineDetails helper
The pushimage & gslock & signer files write out some details about the
system they're running on for the purpose of debugging. Unify all of
that in a new helper so as to standardize on the details we collect.
BUG=chromium:417035
TEST=`./cbuildbot/run_tests` passes
TEST=`./lib/paygen/gslock_unittest.py --network` passes
Change-Id: Id1a8373e813647788830431cca6ca6dce9d92872
Reviewed-on: https://chromium-review.googlesource.com/225645
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/pushimage.py b/scripts/pushimage.py
index 32ce306..bf4ee69 100644
--- a/scripts/pushimage.py
+++ b/scripts/pushimage.py
@@ -22,7 +22,6 @@
from chromite.cbuildbot import constants
from chromite.lib import commandline
from chromite.lib import cros_build_lib
-from chromite.lib import git
from chromite.lib import gs
from chromite.lib import osutils
from chromite.lib import signing
@@ -173,18 +172,8 @@
tbs_path = '%s/tobesigned/%02i,%s' % (tbs_base, priority,
insns_path.replace('/', ','))
- with tempfile.NamedTemporaryFile(
- bufsize=0, prefix='pushimage.tbs.') as temp_tbs_file:
- lines = [
- 'PROG=%s' % __file__,
- 'USER=%s' % getpass.getuser(),
- 'HOSTNAME=%s' % cros_build_lib.GetHostName(fully_qualified=True),
- 'GIT_REV=%s' % git.RunGit(constants.CHROMITE_DIR,
- ['rev-parse', 'HEAD']).output.rstrip(),
- ]
- osutils.WriteFile(temp_tbs_file.name, '\n'.join(lines) + '\n')
- # The caller will catch gs.GSContextException for us.
- ctx.Copy(temp_tbs_file.name, tbs_path)
+ # The caller will catch gs.GSContextException for us.
+ ctx.Copy('-', tbs_path, input=cros_build_lib.MachineDetails())
return tbs_path