Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: lib/cros_build_lib.py

Issue 6698017: Remove test keys from images we test with in the test harness. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Refactored public key logic into its own module Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/cros_build_lib.py
diff --git a/lib/cros_build_lib.py b/lib/cros_build_lib.py
index 3f1b8afe4a27a396ded139db5a3648d4a251c0b2..6014ebe07ebf988fd788de470555c2e3594ca4d7 100644
--- a/lib/cros_build_lib.py
+++ b/lib/cros_build_lib.py
@@ -11,6 +11,8 @@ import subprocess
import sys
_STDOUT_IS_TTY = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
+_CROSUTILS_DIRECTORY = os.path.realpath(os.path.dirname(os.path.dirname(
+ __file__)))
# TODO(sosa): Move logging to logging module.
@@ -297,3 +299,30 @@ def GetIPAddress(device='eth0'):
else:
Warning('Failed to find ip address in %s' % ifconfig_output)
return None
+
+
+def MountImage(image_path, root_dir, stateful_dir, read_only):
+ """Mounts a Chromium OS image onto mount dir points."""
+ from_dir = os.path.dirname(image_path)
+ image = os.path.basename(image_path)
+ extra_args = []
+ if read_only: extra_args.append('--read_only')
+ cmd = ['./mount_gpt_image.sh',
+ '--from=%s' % from_dir,
+ '--image=%s' % image,
+ '--rootfs_mountpt=%s' % root_dir,
+ '--stateful_mountpt=%s' % stateful_dir,
+ ]
+ cmd.extend(extra_args)
+ RunCommand(cmd, print_cmd=False, redirect_stdout=True, redirect_stderr=True,
+ cwd=_CROSUTILS_DIRECTORY)
+
+
+def UnmountImage(root_dir, stateful_dir):
+ """Unmounts a Chromium OS image specified by mount dir points."""
+ RunCommand(['./mount_gpt_image.sh',
+ '--unmount',
+ '--rootfs_mountpt=%s' % root_dir,
+ '--stateful_mountpt=%s' % stateful_dir,
+ ], print_cmd=False, redirect_stdout=True, redirect_stderr=True,
+ cwd=_CROSUTILS_DIRECTORY)
« bin/au_test_harness/public_key_manager.py ('K') | « bin/au_test_harness/public_key_manager.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698