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

Unified Diff: lib/cros_build_lib.py

Issue 6691047: Merge MVP script into cbuildbot. (Closed) Base URL: http://git.chromium.org/git/chromite.git@master
Patch Set: Implement Debug option for manifest_version Created 9 years, 8 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 8728fe3fb734b99ba3738c5520935e42200a92c2..739bdf98f723eb7f0fabb7b14c59ef2f15e68ac0 100644
--- a/lib/cros_build_lib.py
+++ b/lib/cros_build_lib.py
@@ -95,7 +95,10 @@ def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
# Print out the command before running.
if print_cmd:
- Info('RunCommand: %s' % cmd_str)
+ if cwd:
+ Info('RunCommand: %s in %s' % (cmd_str, cwd))
+ else:
+ Info('RunCommand: %s' % cmd_str)
cmd_result.cmd = cmd
try:
@@ -298,6 +301,24 @@ def GetCallerName():
return os.path.basename(top_frame.f_code.co_filename)
+def GetValueFromFile(filename, varname):
dgarrett 2011/04/11 20:53:13 This method was left over from DJMM's changes, but
+ """
+ Given a NAME, return the VALUE out of a file. (NAME=VALUE)
+ or the awk equivalent:
+ $ awk -F= '/varname=/ {print $2}' filename
+ """
+ if os.path.isfile(filename):
+ file_obj = open(filename, 'r')
+ else:
+ file_obj = filename
+
+ for line in file_obj:
+ if line.startswith(varname + '='):
+ pat = line.split('=', 1)[1]
+ break
+ return pat.strip()
+
+
class RunCommandException(Exception):
"""Raised when there is an error in OldRunCommand."""
def __init__(self, msg, cmd):
« buildbot/manifest_version_unittest.py ('K') | « buildbot/manifest_version_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698