def UpdateRevisionNumber(out_dir, revision_number): """Update the sdk_tools bundle to have the given revision number. This function finds all occurrences of the string "{REVISION}" in sdk_update_main.py and replaces them with |revision_number|. The only observable effect of this change should be that running: naclsdk -v will contain the new |revision_number|. Args: out_dir: The output directory containing the scripts to update. revision_number: The revision number as an integer, or None to use the current Chrome revision (as retrieved through svn/git). """ if revision_number is None: revision_number = build_version.ChromeRevision() SDK_UPDATE_MAIN = os.path.join(out_dir, 'nacl_sdk/sdk_tools/sdk_update_main.py') contents = open(SDK_UPDATE_MAIN, 'r').read().replace( '{REVISION}', str(revision_number)) open(SDK_UPDATE_MAIN, 'w').write(contents)
def MakeVersionJson(): time_format = '%Y/%m/%d %H:%M:%S' data = { 'chrome_version': build_version.ChromeVersionNoTrunk(), 'chrome_revision': build_version.ChromeRevision(), 'chrome_commit_position': build_version.ChromeCommitPosition(), 'nacl_revision': build_version.NaClRevision(), 'build_date': datetime.datetime.now().strftime(time_format)} dirname = os.path.dirname(VERSION_JSON) if not os.path.exists(dirname): buildbot_common.MakeDir(dirname) with open(VERSION_JSON, 'w') as outf: json.dump(data, outf, indent=2, separators=(',', ': '))
def UploadArchives(): major_version = build_version.ChromeMajorVersion() chrome_revision = build_version.ChromeRevision() commit_position = build_version.ChromeCommitPosition() git_sha = build_version.ParseCommitPosition(commit_position)[0] short_sha = git_sha[:9] archive_version = '%s-%s-%s' % (major_version, chrome_revision, short_sha) bucket_path = 'native-client-sdk/archives/%s' % archive_version for archive_name in all_archives: buildbot_common.Archive(archive_name, bucket_path, cwd=BUILD_ARCHIVE_DIR, step_link=False) sha1_filename = archive_name + '.sha1' buildbot_common.Archive(sha1_filename, bucket_path, cwd=BUILD_ARCHIVE_DIR, step_link=False)
def main(args): parser = optparse.OptionParser() parser.add_option('--tar', help='Force the tar step.', action='store_true') parser.add_option('--archive', help='Force the archive step.', action='store_true') parser.add_option('--gyp', help='Use gyp to build examples/libraries/Makefiles.', action='store_true') parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) parser.add_option('--build-ports', help='Build naclport bundle.', action='store_true') parser.add_option('--build-app-engine', help='Build AppEngine demos.', action='store_true') parser.add_option('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_option('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_option('--mac-sdk', help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass global options options, args = parser.parse_args(args[1:]) generate_make.use_gyp = options.gyp if buildbot_common.IsSDKBuilder(): options.archive = True options.build_ports = True options.build_app_engine = True options.tar = True toolchains = ['newlib', 'glibc', 'arm', 'pnacl', 'host'] print 'Building: ' + ' '.join(toolchains) if options.archive and not options.tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) chrome_revision = build_version.ChromeRevision() nacl_revision = build_version.NaClRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) tarname = 'naclsdk_' + getos.GetPlatform() + '.tar.bz2' tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, chrome_revision) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if not options.skip_toolchain: BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) BuildStepDownloadToolchains() BuildStepUntarToolchains(pepperdir, toolchains) BuildStepBuildToolchains(pepperdir, toolchains) BuildStepUpdateHelpers(pepperdir, True) BuildStepUpdateUserProjects(pepperdir, toolchains, options.build_experimental, True) BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir, 'src') GenerateNotice(pepperdir) # Verify the SDK contains what we expect. BuildStepVerifyFilelist(pepperdir) if options.tar: BuildStepTarBundle(pepper_ver, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': ports_tarfile = os.path.join(OUT_DIR, 'naclports.tar.bz2') BuildStepSyncNaClPorts() BuildStepBuildNaClPorts(pepper_ver, pepperdir) if options.tar: BuildStepTarNaClPorts(pepper_ver, ports_tarfile) if options.build_app_engine and getos.GetPlatform() == 'linux': BuildStepBuildAppEngine(pepperdir, chrome_revision) # Archive on non-trybots. if options.archive: BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': BuildStepArchiveBundle('naclports', pepper_ver, chrome_revision, nacl_revision, ports_tarfile) BuildStepArchiveSDKTools() return 0
def testChromeRevision(self): self.mockDefaultGitCommand() result = build_version.ChromeRevision() self.assertGitShowCalled() self.assertEqual(result, '292480')
def main(args): parser = optparse.OptionParser(description=__doc__) parser.add_option('--nacl-tree-path', help='Path to native client tree for bionic build.', dest='nacl_tree_path') parser.add_option('--qemu', help='Add qemu for ARM.', action='store_true') parser.add_option('--bionic', help='Add bionic build.', action='store_true') parser.add_option('--tar', help='Force the tar step.', action='store_true') parser.add_option('--archive', help='Force the archive step.', action='store_true') parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) parser.add_option('--build-ports', help='Build naclport bundle.', action='store_true') parser.add_option('--build-app-engine', help='Build AppEngine demos.', action='store_true') parser.add_option('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_option('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_option( '--mac-sdk', help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') parser.add_option( '--no-arm-trusted', action='store_true', help='Disable building of ARM trusted components (sel_ldr, etc).') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass global options options, args = parser.parse_args(args[1:]) if args: parser.error("Unexpected arguments: %s" % str(args)) if options.nacl_tree_path: options.bionic = True toolchain_build = os.path.join(options.nacl_tree_path, 'toolchain_build') print 'WARNING: Building bionic toolchain from NaCl checkout.' print 'This option builds bionic from the sources currently in the' print 'provided NativeClient checkout, and the results instead of ' print 'downloading a toolchain from the builder. This may result in a' print 'NaCl SDK that can not run on ToT chrome.' print 'NOTE: To clobber you will need to run toolchain_build_bionic.py' print 'directly from the NativeClient checkout.' print '' response = raw_input("Type 'y' and hit enter to continue.\n") if response != 'y' and response != 'Y': print 'Aborting.' return 1 # Get head version of NativeClient tree buildbot_common.BuildStep('Build bionic toolchain.') buildbot_common.Run( [sys.executable, 'toolchain_build_bionic.py', '-f'], cwd=toolchain_build) else: toolchain_build = None if buildbot_common.IsSDKBuilder(): options.archive = True options.build_ports = True # TODO(binji): re-enable app_engine build when the linux builder stops # breaking when trying to git clone from github. # See http://crbug.com/412969. options.build_app_engine = False options.tar = True # NOTE: order matters here. This will be the order that is specified in the # Makefiles; the first toolchain will be the default. toolchains = ['pnacl', 'newlib', 'glibc', 'arm', 'host'] # Changes for experimental bionic builder if options.bionic: toolchains.append('bionic') options.build_ports = False options.build_app_engine = False print 'Building: ' + ' '.join(toolchains) if options.archive and not options.tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) chrome_revision = build_version.ChromeRevision() nacl_revision = build_version.NaClRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) if options.bionic: tarname = 'naclsdk_bionic.tar.bz2' else: tarname = 'naclsdk_' + getos.GetPlatform() + '.tar.bz2' tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, chrome_revision) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if not options.skip_toolchain: BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) BuildStepDownloadToolchains(toolchains) if options.nacl_tree_path: # Instead of untarring, copy the raw bionic toolchain not_bionic = [i for i in toolchains if i != 'bionic'] BuildStepUntarToolchains(pepperdir, not_bionic) tcname = GetToolchainDirName('bionic', 'arm') srcdir = os.path.join(toolchain_build, 'out', tcname) bionicdir = os.path.join(pepperdir, 'toolchain', tcname) oshelpers.Copy(['-r', srcdir, bionicdir]) else: BuildStepUntarToolchains(pepperdir, toolchains) BuildStepBuildToolchains(pepperdir, toolchains) BuildStepUpdateHelpers(pepperdir, True) BuildStepUpdateUserProjects(pepperdir, toolchains, options.build_experimental, True) BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir, 'src') GenerateNotice(pepperdir) # Verify the SDK contains what we expect. if not options.bionic: BuildStepVerifyFilelist(pepperdir) if options.tar: BuildStepTarBundle(pepper_ver, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': ports_tarfile = os.path.join(OUT_DIR, 'naclports.tar.bz2') BuildStepSyncNaClPorts() BuildStepBuildNaClPorts(pepper_ver, pepperdir) if options.tar: BuildStepTarNaClPorts(pepper_ver, ports_tarfile) if options.build_app_engine and getos.GetPlatform() == 'linux': BuildStepBuildAppEngine(pepperdir, chrome_revision) if options.qemu: qemudir = os.path.join(NACL_DIR, 'toolchain', 'linux_arm-trusted') oshelpers.Copy(['-r', qemudir, pepperdir]) # Archive on non-trybots. if options.archive: BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': BuildStepArchiveBundle('naclports', pepper_ver, chrome_revision, nacl_revision, ports_tarfile) BuildStepArchiveSDKTools() return 0
def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--qemu', help='Add qemu for ARM.', action='store_true') parser.add_argument('--tar', help='Force the tar step.', action='store_true') parser.add_argument('--archive', help='Force the archive step.', action='store_true') parser.add_argument('--release', help='PPAPI release version.', dest='release', default=None) parser.add_argument('--build-app-engine', help='Build AppEngine demos.', action='store_true') parser.add_argument('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_argument('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_argument('--no-clean', dest='clean', action='store_false', help="Don't clean gn build directories") parser.add_argument( '--mac-sdk', help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') parser.add_argument( '--no-arm-trusted', action='store_true', help='Disable building of ARM trusted components (sel_ldr, etc).') parser.add_argument('--no-use-sysroot', action='store_true', help='Disable building against sysroot.') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass global options options = parser.parse_args(args) buildbot_common.BuildStep('build_sdk') if buildbot_common.IsSDKBuilder(): options.archive = True # TODO(binji): re-enable app_engine build when the linux builder stops # breaking when trying to git clone from github. # See http://crbug.com/412969. options.build_app_engine = False options.tar = True # NOTE: order matters here. This will be the order that is specified in the # Makefiles; the first toolchain will be the default. toolchains = ['pnacl', 'x86_glibc', 'arm_glibc', 'clang-newlib', 'host'] print 'Building: ' + ' '.join(toolchains) platform = getos.GetPlatform() if options.archive and not options.tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) chrome_revision = build_version.ChromeRevision() nacl_revision = build_version.NaClRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) tarname = 'naclsdk_%s.tar.bz2' % platform tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, chrome_revision) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if platform == 'linux': # Linux-only: make sure the debian/stable sysroot image is installed install_script = os.path.join(SRC_DIR, 'build', 'linux', 'sysroot_scripts', 'install-sysroot.py') buildbot_common.Run([sys.executable, install_script, '--arch=arm']) buildbot_common.Run([sys.executable, install_script, '--arch=i386']) buildbot_common.Run([sys.executable, install_script, '--arch=amd64']) if not options.skip_toolchain: BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) BuildStepDownloadToolchains(toolchains) BuildStepUntarToolchains(pepperdir, toolchains) if platform == 'linux': buildbot_common.Move( os.path.join(pepperdir, 'toolchain', 'arm_trusted'), os.path.join(OUT_DIR, 'arm_trusted')) if platform == 'linux': # Linux-only: Copy arm libraries from the arm_trusted package. These are # needed to be able to run sel_ldr_arm under qemu. arm_libs = [ 'lib/arm-linux-gnueabihf/librt.so.1', 'lib/arm-linux-gnueabihf/libpthread.so.0', 'lib/arm-linux-gnueabihf/libgcc_s.so.1', 'lib/arm-linux-gnueabihf/libc.so.6', 'lib/arm-linux-gnueabihf/ld-linux-armhf.so.3', 'lib/arm-linux-gnueabihf/libm.so.6', 'usr/lib/arm-linux-gnueabihf/libstdc++.so.6' ] arm_lib_dir = os.path.join(pepperdir, 'tools', 'lib', 'arm_trusted', 'lib') buildbot_common.MakeDir(arm_lib_dir) for arm_lib in arm_libs: arm_lib = os.path.join(OUT_DIR, 'arm_trusted', arm_lib) buildbot_common.CopyFile(arm_lib, arm_lib_dir) buildbot_common.CopyFile( os.path.join(OUT_DIR, 'arm_trusted', 'qemu-arm'), os.path.join(pepperdir, 'tools')) BuildStepBuildToolchains(pepperdir, toolchains, not options.skip_toolchain, options.clean) BuildStepUpdateHelpers(pepperdir, True) BuildStepUpdateUserProjects(pepperdir, toolchains, options.build_experimental, True) BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir) GenerateNotice(pepperdir) # Verify the SDK contains what we expect. BuildStepVerifyFilelist(pepperdir) if options.tar: BuildStepTarBundle(pepper_ver, tarfile) if platform == 'linux': BuildStepBuildPNaClComponent(pepper_ver, chrome_revision) if options.build_app_engine and platform == 'linux': BuildStepBuildAppEngine(pepperdir, chrome_revision) if options.qemu: qemudir = os.path.join(NACL_DIR, 'toolchain', 'linux_arm-trusted') oshelpers.Copy(['-r', qemudir, pepperdir]) # Archive the results on Google Cloud Storage. if options.archive: BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision, tarfile) # Only archive sdk_tools/naclport/pnacl_component on linux. if platform == 'linux': BuildStepArchiveSDKTools() BuildStepArchivePNaClComponent(chrome_revision) return 0
def main(args): parser = optparse.OptionParser() parser.add_option('--run-tests', help='Run tests. This includes building examples.', action='store_true') parser.add_option('--skip-tar', help='Skip generating a tarball.', action='store_true') parser.add_option('--archive', help='Force the archive step.', action='store_true') parser.add_option('--gyp', help='Use gyp to build examples/libraries/Makefiles.', action='store_true') parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) parser.add_option('--build-ports', help='Build naclport bundle.', action='store_true') parser.add_option('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_option('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_option('--mac_sdk', help='Set the mac_sdk (e.g. 10.6) to use when building with ninja.', dest='mac_sdk') global options options, args = parser.parse_args(args[1:]) platform = getos.GetPlatform() arch = 'x86' generate_make.use_gyp = options.gyp if buildbot_common.IsSDKBuilder(): options.run_tests = True options.archive = True options.build_ports = True if buildbot_common.IsSDKTrybot(): options.run_tests = True toolchains = ['newlib', 'glibc', 'arm', 'pnacl', 'host'] print 'Building: ' + ' '.join(toolchains) if options.archive and options.skip_tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) clnumber = build_version.ChromeRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) tarname = 'naclsdk_' + platform + '.tar.bz2' tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if options.run_tests: BuildStepRunUnittests() BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) if not options.skip_toolchain: BuildStepDownloadToolchains() BuildStepUntarToolchains(pepperdir, platform, arch, toolchains) BuildStepCopyTextFiles(pepperdir, pepper_ver, clnumber) BuildStepBuildToolchains(pepperdir, platform, toolchains) InstallCommonHeaders(os.path.join(pepperdir, 'include')) BuildStepUpdateHelpers(pepperdir, platform, True) BuildStepUpdateUserProjects(pepperdir, platform, toolchains, options.build_experimental, True) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir, platform, 'src') GenerateNotice(pepperdir) if not options.skip_tar: BuildStepTarBundle(pepper_ver, tarfile) if options.build_ports and platform == 'linux': ports_tarfile = os.path.join(OUT_DIR, 'naclports.tar.bz2') BuildStepSyncNaClPorts() BuildStepBuildNaClPorts(pepper_ver, pepperdir) if not options.skip_tar: BuildStepTarNaClPorts(pepper_ver, ports_tarfile) if options.run_tests: BuildStepTestSDK() # Archive on non-trybots. if options.archive: BuildStepArchiveBundle('build', pepper_ver, clnumber, tarfile) if platform == 'linux': BuildStepArchiveBundle('naclports', pepper_ver, clnumber, ports_tarfile) BuildStepArchiveSDKTools() return 0