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

Unified Diff: native_client_sdk/src/build_tools/buildbot_run.py

Issue 9159067: Small cleanup (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 8 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/build_tools/buildbot_run.py
===================================================================
--- native_client_sdk/src/build_tools/buildbot_run.py (revision 119894)
+++ native_client_sdk/src/build_tools/buildbot_run.py (working copy)
@@ -3,14 +3,31 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-'''Entry point for both build and try bots'''
+'''Entry point for both build and try bots
-import build_utils
-import lastchange
+This script is invoked from XXX, usually without arguments
+to package an NNaCl SDK. It automatically determines whether
+this SDK is for mac, win, linux.
+
+If the script is invoked with the single argument 'pnacl'
sehr (please use chromium) 2012/01/31 16:38:11 Ultra-nit: two spaces should be one.
robertm 2012/01/31 17:29:48 Done.
+an PNaCl SDK is build instead.
+
+The script inspects the following environment variables:
+
+BUILDBOT_BUILDERNAME to determine whether the script is run locally
+and whether it should upload an SDK to file storage (GSTORE)
+'''
+
+# std python includes
import os
import subprocess
import sys
+# local includes
+import build_utils
+import lastchange
+
+
# Create the various paths of interest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
@@ -25,35 +42,37 @@
sys.path.append(os.path.join(SDK_SRC_DIR, 'tools'))
sys.path.append(os.path.join(NACL_DIR, 'build'))
-
+import getos
import http_download
-from getos import GetPlatform
import oshelpers
GSTORE = 'http://commondatastorage.googleapis.com/nativeclient-mirror/nacl/'
MAKE = 'nacl_sdk/make_3_81/make.exe'
-GSUTIL = '/b/build/scripts/slave/gsutil'
+# For buildbots assume gsutil is stored in the build directory.
+BOT_GSUTIL = '/b/build/scripts/slave/gsutil'
+# For loca runs just make sure gsutil is in your PATH
sehr (please use chromium) 2012/01/31 16:38:11 s/loca/local/ and add . at the end.
robertm 2012/01/31 17:29:48 Done.
+LOCAL_GSUTIL = 'gsutil'
def ErrorExit(msg):
- """Write and error to stderr, then exit with 1 signaling failure."""
+ '''Write and error to stderr, then exit with 1 signaling failure.'''
sys.stderr.write(msg + '\n')
sys.exit(1)
def BuildStep(name):
- """Annotate a buildbot build step."""
+ '''Annotate a buildbot build step.'''
sys.stdout.flush()
print '\n@@@BUILD_STEP %s@@@' % name
sys.stdout.flush()
def Run(args, cwd=None, shell=False):
- """Start a process with the provided arguments.
+ '''Start a process with the provided arguments.
Starts a process in the provided directory given the provided arguments. If
shell is not False, the process is launched via the shell to provide shell
interpretation of the arguments. Shell behavior can differ between platforms
- so this should be avoided when not using platform dependent shell scripts."""
+ so this should be avoided when not using platform dependent shell scripts.'''
print 'Running: ' + ' '.join(args)
sys.stdout.flush()
subprocess.check_call(args, cwd=cwd, shell=shell)
@@ -61,18 +80,16 @@
def Archive(filename):
- """Upload the given filename to Google Store."""
+ '''Upload the given filename to Google Store.'''
chrome_version = build_utils.ChromeVersion()
bucket_path = 'nativeclient-mirror/nacl/nacl_sdk/%s/%s' % (
chrome_version, filename)
full_dst = 'gs://%s' % bucket_path
if os.environ.get('BUILDBOT_BUILDERNAME', ''):
- # For buildbots assume gsutil is stored in the build directory.
- gsutil = '/b/build/scripts/slave/gsutil'
+ gsutil = BOT_GSUTIL
else:
- # For non buildpots, you must have it in your path.
- gsutil = 'gsutil'
+ gsutil = LOCAL_GSUTIL
subprocess.check_call(
'%s cp -a public-read %s %s' % (
@@ -83,17 +100,17 @@
def AddMakeBat(makepath):
- """Create a simple batch file to execute Make.
+ '''Create a simple batch file to execute Make.
Creates a simple batch file named make.bat for the Windows platform at the
- given path, pointing to the Make executable in the SDK."""
+ given path, pointing to the Make executable in the SDK.'''
fp = open(os.path.join(makepath, 'make.bat'), 'wb')
fp.write('@..\\..\\tools\\make.exe %*\n')
fp.close()
def CopyDir(src, dst, excludes=['.svn']):
- """Recursively copy a directory using."""
+ '''Recursively copy a directory using.'''
args = ['-r', src, dst]
for exc in excludes:
args.append('--exclude=' + exc)
@@ -101,17 +118,17 @@
oshelpers.Copy(args)
def RemoveDir(dst):
- """Remove the provided path."""
+ '''Remove the provided path.'''
print "rm -fr " + dst
oshelpers.Remove(['-fr', dst])
def MakeDir(dst):
- """Create the path including all parent directories as needed."""
+ '''Create the path including all parent directories as needed.'''
print "mkdir -p " + dst
oshelpers.Mkdir(['-p', dst])
def MoveDir(src, dst):
- """Move the path src to dst."""
+ '''Move the path src to dst.'''
print "mv -fr %s %s" % (src, dst)
oshelpers.Move(['-f', src, dst])
@@ -160,7 +177,7 @@
def GetBuildArgs(tcname, tcpath, arch, xarch=None):
- """Return list of scons build arguments to generate user libraries."""
+ '''Return list of scons build arguments to generate user libraries.'''
scons = GetScons()
mode = '--mode=opt-host,nacl'
arch_name = GetArchName(arch, xarch)
@@ -202,7 +219,7 @@
def InstallHeaders(tc_dst_inc, pepper_ver, tc_name):
- """Copies NaCl headers to expected locations in the toolchain."""
+ '''Copies NaCl headers to expected locations in the toolchain.'''
tc_map = header_map[tc_name]
for filename in tc_map:
src = os.path.join(NACL_DIR, tc_map[filename])
@@ -262,9 +279,10 @@
os.path.join(tc_dst_inc, 'KHR'))
-def main():
- platform = GetPlatform()
+def main(argv):
+ platform = getos.GetPlatform()
arch = 'x86'
+ # the vars below are intended for debugging
skip_untar = 0
skip_build = 0
skip_tar = 0
@@ -290,7 +308,7 @@
tmpdir = os.path.join(SRC_DIR, 'out', 'tc_temp')
cygtar = os.path.join(NACL_DIR, 'build', 'cygtar.py')
- # Clean out the temporary toolchain untar directory
+ # Clean out the temporary toolchain untar directory
if not skip_untar:
RemoveDir(tmpdir)
MakeDir(tmpdir)
@@ -383,5 +401,4 @@
if __name__ == '__main__':
- sys.exit(main())
-
+ sys.exit(main(sys.argv))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698