summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src/build_tools
diff options
context:
space:
mode:
Diffstat (limited to 'native_client_sdk/src/build_tools')
-rw-r--r--native_client_sdk/src/build_tools/build.scons7
-rw-r--r--native_client_sdk/src/build_tools/build_utils.py13
-rwxr-xr-xnative_client_sdk/src/build_tools/buildbot_run.py20
-rwxr-xr-xnative_client_sdk/src/build_tools/generate_installers.py33
-rwxr-xr-xnative_client_sdk/src/build_tools/generate_windows_installer.py26
-rw-r--r--native_client_sdk/src/build_tools/install_nsis.py13
-rwxr-xr-xnative_client_sdk/src/build_tools/install_third_party.py6
-rw-r--r--native_client_sdk/src/build_tools/installer_contents.py53
-rwxr-xr-xnative_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py4
-rwxr-xr-xnative_client_sdk/src/build_tools/tests/build_utils_test.py2
-rwxr-xr-xnative_client_sdk/src/build_tools/tests/installer_contents_test.py2
-rwxr-xr-xnative_client_sdk/src/build_tools/tests/set_nacl_env_test.py6
12 files changed, 56 insertions, 129 deletions
diff --git a/native_client_sdk/src/build_tools/build.scons b/native_client_sdk/src/build_tools/build.scons
index d0d2185..16d86f1 100644
--- a/native_client_sdk/src/build_tools/build.scons
+++ b/native_client_sdk/src/build_tools/build.scons
@@ -132,7 +132,10 @@ if env['IS_WINDOWS']:
import gyp_extract
-ppapi_base = os.path.join(env['SRC_DIR'], 'ppapi')
+ppapi_base = os.path.join(env['ROOT_DIR'],
+ 'third_party',
+ 'native_client',
+ 'ppapi')
# Load ppapi_cpp.gypi
ppapi_cpp_gypi = gyp_extract.LoadGypFile(os.path.join(ppapi_base,
@@ -253,7 +256,7 @@ def build_nacl_tools(env, target, source):
'--jobs',
env['JOB_COUNT'],
'--nacl_dir',
- env['SRC_DIR'],
+ os.path.join(env['ROOT_DIR'], 'third_party', 'native_client'),
]
if env.GetOption('clean'):
make_nacl_tools_args.extend(['--clean'])
diff --git a/native_client_sdk/src/build_tools/build_utils.py b/native_client_sdk/src/build_tools/build_utils.py
index 60bdc80..28cd095 100644
--- a/native_client_sdk/src/build_tools/build_utils.py
+++ b/native_client_sdk/src/build_tools/build_utils.py
@@ -110,12 +110,7 @@ def NormalizeToolchain(toolchain=TOOLCHAIN_AUTODETECT,
variant=nacl_utils.DEFAULT_TOOLCHAIN_VARIANT):
if toolchain == TOOLCHAIN_AUTODETECT:
if base_dir is None:
- script_path = os.path.abspath(__file__)
- script_dir = os.path.dirname(script_path)
- sdk_src_dir = os.path.dirname(script_dir)
- sdk_dir = os.path.dirname(sdk_src_dir)
- src_dir = os.path.dirname(sdk_dir)
- base_dir = os.path.join(src_dir, 'native_client')
+ base_dir = os.getenv('NACL_SDK_ROOT', '')
normalized_toolchain = nacl_utils.ToolchainPath(base_dir=base_dir,
arch=arch,
variant=variant)
@@ -240,7 +235,11 @@ class BotAnnotator:
self._stream.flush()
def BuildStep(self, name):
- self.Print("@@@BUILD_STEP %s@@@" % name)
+ self.Print("BUILD_STEP %s" % name)
+ # mball: Disabling buildbot annotations because it's more confusing than
+ # useful when running multiple jobs simultaneously. To re-enable
+ # annotations, using the following line instead of the previous:
+ # self.Print("@@@BUILD_STEP %s@@@" % name)
def BuildStepFailure(self):
'''Signal a failure in the current build step to the annotator'''
diff --git a/native_client_sdk/src/build_tools/buildbot_run.py b/native_client_sdk/src/build_tools/buildbot_run.py
index a1fb494..ddaf723 100755
--- a/native_client_sdk/src/build_tools/buildbot_run.py
+++ b/native_client_sdk/src/build_tools/buildbot_run.py
@@ -10,11 +10,8 @@ import subprocess
import sys
# Add scons to the python path (as nacl_utils.py requires it).
-SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
-SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
-SDK_DIR = os.path.dirname(SDK_SRC_DIR)
-SRC_DIR = os.path.dirname(SDK_DIR)
-sys.path.append(os.path.join(SRC_DIR, 'third_party/scons-2.0.1/engine'))
+PARENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+sys.path.append(os.path.join(PARENT_DIR, 'third_party/scons-2.0.1/engine'))
import build_utils
@@ -37,11 +34,10 @@ def Archive(revision, chrome_milestone):
dst = 'naclsdk_linux.tgz'
bucket_path = 'nativeclient-mirror/nacl/nacl_sdk/pepper_%s_%s/%s' % (
chrome_milestone, revision, dst)
- full_src = os.path.join(SDK_DIR, src)
full_dst = 'gs://%s' % bucket_path
subprocess.check_call(
'/b/build/scripts/slave/gsutil cp -a public-read %s %s' % (
- full_src, full_dst), shell=True)
+ src, full_dst), shell=True)
url = 'https://commondatastorage.googleapis.com/%s' % bucket_path
print '@@@STEP_LINK@download@%s@@@' % url
sys.stdout.flush()
@@ -62,19 +58,11 @@ def main(argv):
sys.stdout.flush()
subprocess.check_call(' '.join(parameters), shell=True, cwd=parent_dir)
- print '@@@BUILD_STEP install third party@@@'
- sys.stdout.flush()
- subprocess.check_call(' '.join([
- sys.executable,
- 'build_tools/install_third_party.py',
- '--all-toolchains',
- ]), shell=True, cwd=parent_dir)
-
print '@@@BUILD_STEP generate sdk@@@'
sys.stdout.flush()
Run(params + ['-c'])
- Run(params + ['bot', '-j1'])
+ Run(params + ['bot'])
# Archive on non-trybots.
if '-sdk' in os.environ.get('BUILDBOT_BUILDERNAME', ''):
diff --git a/native_client_sdk/src/build_tools/generate_installers.py b/native_client_sdk/src/build_tools/generate_installers.py
index 9160a1d..b83f491 100755
--- a/native_client_sdk/src/build_tools/generate_installers.py
+++ b/native_client_sdk/src/build_tools/generate_installers.py
@@ -83,28 +83,19 @@ def main(argv):
else:
all_contents += installer_contents.LINUX_ONLY_CONTENTS
- total_contents = (
+ all_contents_string = string.join(
installer_contents.GetFilesFromPathList(all_contents) +
- installer_contents.GetDirectoriesFromPathList(all_contents)
- )
- for item in total_contents:
- itemf = installer_contents.FilterPathLayout(item)
- src = itemf[0]
- src_dir = os.path.join(tar_src_dir, itemf[1])
- dst_dir = os.path.join(installer_dir, itemf[2])
- print 'Tarring "%s" in "%s" then untarring in "%s"' % (
- src, src_dir, dst_dir)
- if not os.path.exists(dst_dir):
- os.makedirs(dst_dir)
- tar_cf = subprocess.Popen('tar cf - %s' % src,
- bufsize=-1,
- cwd=src_dir, env=env, shell=True,
- stdout=subprocess.PIPE)
- tar_xf = subprocess.Popen('tar xfv -',
- cwd=dst_dir, env=env, shell=True,
- stdin=tar_cf.stdout)
- assert tar_xf.wait() == 0
- assert tar_cf.poll() == 0
+ installer_contents.GetDirectoriesFromPathList(all_contents),
+ ' ')
+ tar_cf = subprocess.Popen('tar cf - %s' % all_contents_string,
+ bufsize=-1,
+ cwd=tar_src_dir, env=env, shell=True,
+ stdout=subprocess.PIPE)
+ tar_xf = subprocess.Popen('tar xfv -',
+ cwd=installer_dir, env=env, shell=True,
+ stdin=tar_cf.stdout)
+ assert tar_xf.wait() == 0
+ assert tar_cf.poll() == 0
# This loop prunes the result of os.walk() at each excluded dir, so that it
# doesn't descend into the excluded dir.
diff --git a/native_client_sdk/src/build_tools/generate_windows_installer.py b/native_client_sdk/src/build_tools/generate_windows_installer.py
index cf6db7d..a87b19e 100755
--- a/native_client_sdk/src/build_tools/generate_windows_installer.py
+++ b/native_client_sdk/src/build_tools/generate_windows_installer.py
@@ -38,7 +38,7 @@ def main(argv):
# Create a temporary directory using the version string, then move the
# contents of src to that directory, clean the directory of unwanted
# stuff and finally create an installer.
- temp_dir = '/naclsdk_temp'
+ temp_dir = os.path.join(script_dir, 'installers_temp')
installer_dir = os.path.join(temp_dir, version_dir)
bot.Print('generate_windows_installer chose installer directory: %s' %
(installer_dir))
@@ -53,15 +53,12 @@ def main(argv):
env['NACL_TARGET_PLATFORM'] = '.' # Use the repo's toolchain.
# Build the experimental projects.
- # DISABLED FOR NOW.
- if False:
- bot.BuildStep('build experimental')
- bot.Print('generate_windows_installer is '
- 'building the experimental projects.')
- experimental_path = os.path.join(home_dir, 'src', 'experimental')
- scons_path = os.path.join(experimental_path, 'scons.bat')
- scons_cmd = scons_path + ' --nacl-platform="."'
- subprocess.check_call(scons_cmd, cwd=experimental_path, env=env)
+ bot.BuildStep('build experimental')
+ bot.Print('generate_windows_installer is building the experimental projects.')
+ experimental_path = os.path.join(home_dir, 'src', 'experimental')
+ scons_path = os.path.join(experimental_path, 'scons.bat')
+ scons_cmd = scons_path + ' --nacl-platform="."'
+ subprocess.check_call(scons_cmd, cwd=experimental_path, env=env)
# On windows we use copytree to copy the SDK into the build location
# because there is no native tar and using cygwin's version has proven
@@ -77,11 +74,7 @@ def main(argv):
installer_contents.WINDOWS_ONLY_CONTENTS
for copy_source_dir in installer_contents.GetDirectoriesFromPathList(
all_contents):
- itemf = installer_contents.FilterPathLayout(copy_source_dir)
- dst_dir = os.path.join(installer_dir, itemf[2])
- if not os.path.exists(dst_dir):
- os.makedirs(dst_dir)
- copy_target_dir = os.path.join(dst_dir, itemf[0])
+ copy_target_dir = os.path.join(installer_dir, copy_source_dir)
bot.Print("Copying %s to %s" % (copy_source_dir, copy_target_dir))
shutil.copytree(copy_source_dir,
copy_target_dir,
@@ -89,8 +82,7 @@ def main(argv):
ignore=shutil.ignore_patterns(*IGNORE_PATTERN))
for copy_source_file in installer_contents.GetFilesFromPathList(
all_contents):
- itemf = installer_contents.FilterPathLayout(copy_source_file)
- copy_target_file = os.path.join(installer_dir, itemf[2], itemf[0])
+ copy_target_file = os.path.join(installer_dir, copy_source_file)
bot.Print("Copying %s to %s" % (copy_source_file, copy_target_file))
if not os.path.exists(os.path.dirname(copy_target_file)):
os.makedirs(os.path.dirname(copy_target_file))
diff --git a/native_client_sdk/src/build_tools/install_nsis.py b/native_client_sdk/src/build_tools/install_nsis.py
index 793d5c5..99f3bea 100644
--- a/native_client_sdk/src/build_tools/install_nsis.py
+++ b/native_client_sdk/src/build_tools/install_nsis.py
@@ -10,25 +10,18 @@ import subprocess
import zipfile
-SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
-SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
-SRC_DIR = os.path.dirname(os.path.dirname(SDK_SRC_DIR))
-THIRD_PARTY_DIR = os.path.join(SRC_DIR, 'third_party')
-BIN_DIR = os.path.join(THIRD_PARTY_DIR, 'nacl_sdk_binaries')
-
# The name of the archive that contains the AccessControl extensions.
-ACCESS_CONTROL_ZIP = os.path.join(BIN_DIR, 'AccessControl.zip')
+ACCESS_CONTROL_ZIP = 'AccessControl.zip'
# The AccessControl plugin. The installer check for this before installing.
ACCESS_CONTROL_DLL = 'AccessControl.dll'
# The name of the MkLnk extension DLL. This is checked into the SDK repo.
-MKLINK_DLL = os.path.join(SCRIPT_DIR,
- 'MkLink', 'Release Unicode', 'MkLink.dll')
+MKLINK_DLL = os.path.join('MkLink', 'Release Unicode', 'MkLink.dll')
# The NSIS compiler. The installer checks for this before installing.
NSIS_COMPILER = 'makensis.exe'
# The default directory name for the NSIS installation.
NSIS_DIR = 'NSIS'
# The name of the NSIS installer. This file is checked into the SDK repo.
-NSIS_INSTALLER = os.path.join(BIN_DIR, 'nsis-2.46-Unicode-setup.exe')
+NSIS_INSTALLER = 'nsis-2.46-Unicode-setup.exe'
def MakeDirsIgnoreExist(dir_path, mode=0755):
'''Recursively make a directory path.
diff --git a/native_client_sdk/src/build_tools/install_third_party.py b/native_client_sdk/src/build_tools/install_third_party.py
index 6510f4b6..431a684 100755
--- a/native_client_sdk/src/build_tools/install_third_party.py
+++ b/native_client_sdk/src/build_tools/install_third_party.py
@@ -19,10 +19,8 @@ from optparse import OptionParser
# Append to PYTHONPATH in this very non-compliant way so that this script can be
# run from a DEPS hook, where the normal path rules don't apply.
-SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
-SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
-SRC_DIR = os.path.dirname(os.path.dirname(SDK_SRC_DIR))
-THIRD_PARTY_DIR = os.path.join(SRC_DIR, 'third_party')
+SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
+THIRD_PARTY_DIR = os.path.join(os.path.dirname(SCRIPT_DIR), 'third_party')
SCONS_DIR = os.path.join(THIRD_PARTY_DIR, 'scons-2.0.1', 'engine')
sys.path.append(SCRIPT_DIR)
sys.path.append(SCONS_DIR)
diff --git a/native_client_sdk/src/build_tools/installer_contents.py b/native_client_sdk/src/build_tools/installer_contents.py
index 8304ce8..f9e5549 100644
--- a/native_client_sdk/src/build_tools/installer_contents.py
+++ b/native_client_sdk/src/build_tools/installer_contents.py
@@ -51,30 +51,29 @@ INSTALLER_CONTENTS = [
'project_templates/init_project.py',
'project_templates/scons',
'project_templates/vs/',
- '../../third_party/scons-2.0.1/',
+ 'third_party/scons-2.0.1/',
]
-INSTALLER_CONTENTS.append('%s/' % nacl_utils.ToolchainPath(
- base_dir='../../native_client', variant='newlib'))
-INSTALLER_CONTENTS.append('%s/' % nacl_utils.ToolchainPath(
- base_dir='../../native_client', variant='glibc'))
+INSTALLER_CONTENTS.append('%s/' % nacl_utils.ToolchainPath(base_dir='',
+ variant='newlib'))
+INSTALLER_CONTENTS.append('%s/' % nacl_utils.ToolchainPath(base_dir='',
+ variant='glibc'))
LINUX_ONLY_CONTENTS = [
- '../../ppapi/',
+ 'third_party/ppapi/',
]
MAC_ONLY_CONTENTS = [
- '../../ppapi/',
+ 'third_party/ppapi/',
]
WINDOWS_ONLY_CONTENTS = [
'examples/httpd.cmd',
'examples/scons.bat',
'project_templates/scons.bat',
-# Dropping debugger.
-# 'debugger/nacl-gdb_server/x64/Release/',
-# 'debugger/nacl-gdb_server/Release/',
-# 'debugger/nacl-bpad/x64/Release/'
+ 'debugger/nacl-gdb_server/x64/Release/',
+ 'debugger/nacl-gdb_server/Release/',
+ 'debugger/nacl-bpad/x64/Release/'
]
# These files are user-readable documentation files, and as such get some
@@ -179,35 +178,3 @@ def GetFilesFromPathList(path_list):
'''
return ConvertToOSPaths(
[dir for dir in path_list if not dir.endswith('/')])
-
-
-def FilterPathLayout(path):
- '''Given a path, decide how it should be copied.
-
- The SDK was originally layed out homogeneously with the generated
- installer. Inside the chromium tree, this is not longer desireable.
- This function compenstates.
-
- Args:
- path: A path to install.
-
- Returns:
- A list of [src path to tar, cwd when taring src, dst to untar in].
- '''
- # Toolchain moved up to top of tree.
- nacl_dir = '../../native_client/'.replace('/', os.sep)
- top_dir = '../../'.replace('/', os.sep)
- ppapi_dir = '../../ppapi/'.replace('/', os.sep)
-
- # Use toolchain from nacl_dir.
- if path.startswith(nacl_dir):
- return [os.path.join('.', path[len(nacl_dir):]), nacl_dir, '.']
- # Use ppapi directly, but put in third_party.
- if path.startswith(ppapi_dir):
- return [os.path.join('.', path[len(ppapi_dir):]), ppapi_dir,
- 'third_party/ppapi']
- # Third party is used from top of tree (for scons).
- if path.startswith(top_dir):
- return [os.path.join('.', path[len(top_dir):]), top_dir, '.']
- # Normal case.
- return [path, '.', '.']
diff --git a/native_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py b/native_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py
index f2a65a8..1cc3581 100755
--- a/native_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py
+++ b/native_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py
@@ -137,9 +137,7 @@ def GetNaclSdkRoot():
if 'NACL_SDK_ROOT' in os.environ:
return os.environ['NACL_SDK_ROOT']
else:
- SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
- SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(SCRIPT_DIR)))
- return os.path.join(SRC_DIR, 'native_client')
+ return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def GetToolchainPath(options):
diff --git a/native_client_sdk/src/build_tools/tests/build_utils_test.py b/native_client_sdk/src/build_tools/tests/build_utils_test.py
index 8f7ddb4..67f0092 100755
--- a/native_client_sdk/src/build_tools/tests/build_utils_test.py
+++ b/native_client_sdk/src/build_tools/tests/build_utils_test.py
@@ -45,7 +45,7 @@ class TestBuildUtils(unittest.TestCase):
stdout_mock = self.mock_factory.CreateMock(sys.stdout)
stdout_mock.write("My Bot Message\n")
stdout_mock.flush()
- stdout_mock.write("@@@BUILD_STEP MyBuildStep@@@\n")
+ stdout_mock.write("BUILD_STEP MyBuildStep\n")
stdout_mock.flush()
self.mock_factory.ReplayAll()
bot = build_utils.BotAnnotator(stdout_mock)
diff --git a/native_client_sdk/src/build_tools/tests/installer_contents_test.py b/native_client_sdk/src/build_tools/tests/installer_contents_test.py
index b1f903e..de07dd2 100755
--- a/native_client_sdk/src/build_tools/tests/installer_contents_test.py
+++ b/native_client_sdk/src/build_tools/tests/installer_contents_test.py
@@ -45,7 +45,7 @@ class TestInstallerContents(unittest.TestCase):
self.assertEqual(output[2], '')
self.assertEqual(output[3], os.path.join('abs', 'path'))
- def DISABLEDtestGetToolchainManifest(self):
+ def testGetToolchainManifest(self):
self.assertRaises(KeyError,
installer_contents.GetToolchainManifest,
'notatoolchain')
diff --git a/native_client_sdk/src/build_tools/tests/set_nacl_env_test.py b/native_client_sdk/src/build_tools/tests/set_nacl_env_test.py
index f1ad4e7..143a584 100755
--- a/native_client_sdk/src/build_tools/tests/set_nacl_env_test.py
+++ b/native_client_sdk/src/build_tools/tests/set_nacl_env_test.py
@@ -18,8 +18,6 @@ from build_tools.sdk_tools import set_nacl_env
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SDK_ROOT_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR))
-SRC_DIR = os.path.dirname(os.path.dirname(SDK_ROOT_DIR))
-NACL_DIR = os.path.join(SRC_DIR, 'native_client')
class FakeOptions(object):
@@ -33,14 +31,14 @@ class TestSetNaclEnv(unittest.TestCase):
self._options = FakeOptions()
self._options.host = 'mac'
self._options.lib_variant = 'newlib'
- self._options.sdk_root = NACL_DIR
+ self._options.sdk_root = SDK_ROOT_DIR
self._options.sdk_platform = 'pepper_17'
self._options.build_type = 'debug'
self._options.no_ppapi = False
self._options.merge = False
self._env = {}
- self._env['NACL_SDK_ROOT'] = NACL_DIR
+ self._env['NACL_SDK_ROOT'] = SDK_ROOT_DIR
self._temp_dir = tempfile.mkdtemp(prefix='tmp_set_nacl_env_test')