Пример #1
0
def ChromeRevision():
  '''Extract chrome revision from svn.

  Returns:
    The Chrome revision as a string. e.g. "12345"
  '''
  return lastchange.FetchVersionInfo(None).revision
Пример #2
0
def main():
    parser = optparse.OptionParser()
    parser.add_option('', '--version-file')
    parser.add_option(
        '',
        '--directory',
        type='string',
        default='.',
        help='Path to directory where the cc/h  file should be created')
    options, _ = parser.parse_args()

    version = open(options.version_file, 'r').read().strip()
    revision = lastchange.FetchVersionInfo(None).revision

    if revision:
        match = re.match('([0-9a-fA-F]+)(-refs/heads/master@{#(\d+)})?',
                         revision)
        if match:
            git_hash = match.group(1)
            commit_position = match.group(3)
            if commit_position:
                version += '.' + commit_position
            version += ' (%s)' % git_hash
        else:
            version += ' (%s)' % revision

    global_string_map = {'kChromeDriverVersion': version}
    cpp_source.WriteSource('version', 'chrome/test/chromedriver',
                           options.directory, global_string_map)
Пример #3
0
def NaClRevision():
    '''Extract NaCl revision from svn.

  Returns:
    The NaCl revision as a string. e.g. "12345"
  '''
    nacl_dir = os.path.join(SRC_DIR, 'native_client')
    return lastchange.FetchVersionInfo(nacl_dir).revision
Пример #4
0
def ChromeVersion():
    '''Extract chrome version from src/chrome/VERSION + svn.

  Returns:
    Chrome version string or trunk + svn rev.
  '''
    info = lastchange.FetchVersionInfo(None)
    if info.url.startswith('/trunk/'):
        return 'trunk.%s' % info.revision
    else:
        return ChromeVersionNoTrunk()
Пример #5
0
def ChromeVersion():
    '''Extract chrome version from src/chrome/VERSION + svn.

  Returns:
    Chrome version string or trunk + svn rev.
  '''
    info = lastchange.FetchVersionInfo(None)
    if info.url.startswith('/trunk/'):
        return 'trunk.%s' % info.revision
    else:
        exec(open(VERSION_PATH, 'r').read())
        return '%s.%s.%s.%s' % (MAJOR, MINOR, BUILD, PATCH)
def main():
    parser = optparse.OptionParser()
    parser.add_option('', '--version-file')
    parser.add_option(
        '',
        '--directory',
        type='string',
        default='.',
        help='Path to directory where the cc/h  file should be created')
    options, args = parser.parse_args()

    version = open(options.version_file, 'r').read().strip()
    revision = lastchange.FetchVersionInfo(None).revision
    if revision:
        version += '.' + revision.strip()

    global_string_map = {'kChromeDriverVersion': version}
    cpp_source.WriteSource('version', 'chrome/test/chromedriver',
                           options.directory, global_string_map)
Пример #7
0
def _DoSVNKeys(plist, add_keys):
    """Adds the SVN information, visible in about:version, to property list. If
  |add_keys| is True, it will insert the keys, otherwise it will remove them."""
    scm_path, scm_revision = None, None
    if add_keys:
        version_info = lastchange.FetchVersionInfo(default_lastchange=None,
                                                   directory=TOP)
        scm_path, scm_revision = version_info.url, version_info.revision

    # See if the operation failed.
    _RemoveKeys(plist, 'SVNRevision')
    if scm_revision != None:
        plist['SVNRevision'] = scm_revision
    elif add_keys:
        print >> sys.stderr, 'Could not determine svn revision.  This may be OK.'

    if scm_path != None:
        plist['SVNPath'] = scm_path
    else:
        _RemoveKeys(plist, 'SVNPath')
Пример #8
0
def GetWebKitRevision(webkit_dir, version_file):
    """Get the WebKit revision, in the form 'trunk@1234'."""

    # "svn info" tells us what we want, but third_party/WebKit does *not*
    # point at the upstream repo.  So instead we run svn info on the directory
    # containing the versioning file (which is some subdirectory of WebKit).
    version_file_dir = os.path.dirname(version_file)
    version_info = lastchange.FetchVersionInfo(
        default_lastchange=None,
        directory=os.path.join(webkit_dir, version_file_dir),
        directory_regex_prior_to_src_url='webkit')

    if version_info.url == None:
        version_info.url = 'Unknown URL'
    version_info.url = version_info.url.strip('/')

    if version_info.revision == None:
        version_info.revision = '0'

    return "%s@%s" % (version_info.url, version_info.revision)
Пример #9
0
def main(args):
    parser = optparse.OptionParser()
    parser.add_option('--pnacl',
                      help='Enable pnacl build.',
                      action='store_true',
                      dest='pnacl',
                      default=False)
    parser.add_option('--examples',
                      help='Rebuild the examples.',
                      action='store_true',
                      dest='examples',
                      default=False)
    parser.add_option('--update',
                      help='Rebuild the updater.',
                      action='store_true',
                      dest='update',
                      default=False)
    parser.add_option('--skip-tar',
                      help='Skip generating a tarball.',
                      action='store_true',
                      dest='skip_tar',
                      default=False)
    parser.add_option('--archive',
                      help='Force the archive step.',
                      action='store_true',
                      dest='archive',
                      default=False)
    parser.add_option('--release',
                      help='PPAPI release version.',
                      dest='release',
                      default=None)

    options, args = parser.parse_args(args[1:])
    platform = getos.GetPlatform()
    arch = 'x86'

    builder_name = os.getenv('BUILDBOT_BUILDERNAME', '')
    if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0:
        options.pnacl = True

    if options.pnacl:
        toolchains = ['pnacl']
    else:
        toolchains = ['newlib', 'glibc']
    print 'Building: ' + ' '.join(toolchains)
    skip = options.examples or options.update

    skip_examples = skip
    skip_update = skip
    skip_untar = skip
    skip_build = skip
    skip_tar = skip or options.skip_tar

    if options.examples: skip_examples = False
    skip_update = not options.update

    if options.archive and (options.examples or options.skip_tar):
        parser.error('Incompatible arguments with archive.')

    pepper_ver = str(int(build_utils.ChromeMajorVersion()))
    clnumber = lastchange.FetchVersionInfo(None).revision
    if options.release:
        pepper_ver = options.release
    print 'Building PEPPER %s at %s' % (pepper_ver, clnumber)

    if not skip_build:
        buildbot_common.BuildStep('Rerun hooks to get toolchains')
        buildbot_common.Run(['gclient', 'runhooks'],
                            cwd=SRC_DIR,
                            shell=(platform == 'win'))

    buildbot_common.BuildStep('Clean Pepper Dir')
    pepperdir = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_ver)
    if not skip_untar:
        buildbot_common.RemoveDir(pepperdir)
        buildbot_common.MakeDir(os.path.join(pepperdir, 'toolchain'))
        buildbot_common.MakeDir(os.path.join(pepperdir, 'tools'))

    buildbot_common.BuildStep('Add Text Files')
    files = ['AUTHORS', 'COPYING', 'LICENSE', 'NOTICE', 'README']
    files = [os.path.join(SDK_SRC_DIR, filename) for filename in files]
    oshelpers.Copy(['-v'] + files + [pepperdir])

    # Clean out the temporary toolchain untar directory
    if not skip_untar:
        UntarToolchains(pepperdir, platform, arch, toolchains)

    if not skip_build:
        BuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains)

    buildbot_common.BuildStep('Copy make OS helpers')
    buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'),
                            os.path.join(pepperdir, 'tools'))
    if platform == 'win':
        buildbot_common.BuildStep('Add MAKE')
        http_download.HttpDownload(
            GSTORE + MAKE, os.path.join(pepperdir, 'tools', 'make.exe'))

    if not skip_examples:
        CopyExamples(pepperdir, toolchains)

    if not skip_tar:
        buildbot_common.BuildStep('Tar Pepper Bundle')
        tarname = 'naclsdk_' + platform + '.bz2'
        if 'pnacl' in toolchains:
            tarname = 'p' + tarname
        tarfile = os.path.join(OUT_DIR, tarname)
        buildbot_common.Run([
            sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile,
            'pepper_' + pepper_ver
        ],
                            cwd=NACL_DIR)

    # Archive on non-trybots.
    if options.archive or '-sdk' in os.environ.get('BUILDBOT_BUILDERNAME', ''):
        buildbot_common.BuildStep('Archive build')
        buildbot_common.Archive(
            tarname, 'nativeclient-mirror/nacl/nacl_sdk/%s' %
            build_utils.ChromeVersion(), OUT_DIR)

    if not skip_examples:
        buildbot_common.BuildStep('Test Build Examples')
        filelist = os.listdir(os.path.join(pepperdir, 'examples'))
        for filenode in filelist:
            dirnode = os.path.join(pepperdir, 'examples', filenode)
            makefile = os.path.join(dirnode, 'Makefile')
            if os.path.isfile(makefile):
                print "\n\nMake: " + dirnode
                buildbot_common.Run(['make', 'all', '-j8'],
                                    cwd=os.path.abspath(dirnode),
                                    shell=True)


# Build SDK Tools
    if not skip_update:
        BuildUpdater()

    return 0
Пример #10
0
 def _GetRevision(self):
     return lastchange.FetchVersionInfo(None).revision
Пример #11
0
def main(args):
    parser = optparse.OptionParser()
    parser.add_option('--pnacl',
                      help='Enable pnacl build.',
                      action='store_true',
                      dest='pnacl',
                      default=False)
    parser.add_option('--examples',
                      help='Only build the examples.',
                      action='store_true',
                      dest='only_examples',
                      default=False)
    parser.add_option('--update',
                      help='Only build the updater.',
                      action='store_true',
                      dest='only_updater',
                      default=False)
    parser.add_option('--skip-tar',
                      help='Skip generating a tarball.',
                      action='store_true',
                      dest='skip_tar',
                      default=False)
    parser.add_option('--archive',
                      help='Force the archive step.',
                      action='store_true',
                      dest='archive',
                      default=False)
    parser.add_option('--release',
                      help='PPAPI release version.',
                      dest='release',
                      default=None)

    options, args = parser.parse_args(args[1:])
    platform = getos.GetPlatform()
    arch = 'x86'

    builder_name = os.getenv('BUILDBOT_BUILDERNAME', '')
    if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0:
        options.pnacl = True

    if options.pnacl:
        toolchains = ['pnacl']
    else:
        toolchains = ['newlib', 'glibc']
    print 'Building: ' + ' '.join(toolchains)
    skip = options.only_examples or options.only_updater

    skip_examples = skip and not options.only_examples
    skip_update = skip and not options.only_updater
    skip_untar = skip
    skip_build = skip
    skip_test_updater = skip
    skip_tar = skip or options.skip_tar

    if options.archive and (options.only_examples or options.skip_tar):
        parser.error('Incompatible arguments with archive.')

    pepper_ver = str(int(build_utils.ChromeMajorVersion()))
    pepper_old = str(int(build_utils.ChromeMajorVersion()) - 1)
    clnumber = lastchange.FetchVersionInfo(None).revision
    if options.release:
        pepper_ver = options.release
    print 'Building PEPPER %s at %s' % (pepper_ver, clnumber)

    if not skip_build:
        buildbot_common.BuildStep('Rerun hooks to get toolchains')
        buildbot_common.Run(['gclient', 'runhooks'],
                            cwd=SRC_DIR,
                            shell=(platform == 'win'))

    buildbot_common.BuildStep('Clean Pepper Dirs')
    pepperdir = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_ver)
    pepperold = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_old)
    buildbot_common.RemoveDir(pepperold)
    if not skip_untar:
        buildbot_common.RemoveDir(pepperdir)
        buildbot_common.MakeDir(os.path.join(pepperdir, 'toolchain'))
        buildbot_common.MakeDir(os.path.join(pepperdir, 'tools'))
    else:
        buildbot_common.MakeDir(pepperdir)

    if not skip_build:
        buildbot_common.BuildStep('Add Text Files')
        files = ['AUTHORS', 'COPYING', 'LICENSE', 'NOTICE', 'README']
        files = [os.path.join(SDK_SRC_DIR, filename) for filename in files]
        oshelpers.Copy(['-v'] + files + [pepperdir])

    # Clean out the temporary toolchain untar directory
    if not skip_untar:
        UntarToolchains(pepperdir, platform, arch, toolchains)

    if not skip_build:
        BuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains)

    if not skip_build:
        buildbot_common.BuildStep('Copy make OS helpers')
        buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'),
                                os.path.join(pepperdir, 'tools'))
        if platform == 'win':
            buildbot_common.BuildStep('Add MAKE')
            http_download.HttpDownload(
                GSTORE + MAKE, os.path.join(pepperdir, 'tools', 'make.exe'))
            rename_list = [
                'ncval_x86_32', 'ncval_x86_64', 'sel_ldr_x86_32',
                'sel_ldr_x86_64'
            ]
            tools = os.path.join(pepperdir, 'tools')
            for name in rename_list:
                src = os.path.join(pepperdir, 'tools', name)
                dst = os.path.join(pepperdir, 'tools', name + '.exe')
                buildbot_common.Move(src, dst)

    if not skip_examples:
        CopyExamples(pepperdir, toolchains)

    tarname = 'naclsdk_' + platform + '.bz2'
    if 'pnacl' in toolchains:
        tarname = 'p' + tarname
    tarfile = os.path.join(OUT_DIR, tarname)

    if not skip_tar:
        buildbot_common.BuildStep('Tar Pepper Bundle')
        buildbot_common.Run([
            sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile,
            'pepper_' + pepper_ver
        ],
                            cwd=NACL_DIR)

    # build sdk update
    if not skip_update:
        BuildUpdater()

    # start local server sharing a manifest + the new bundle
    if not skip_test_updater:
        buildbot_common.BuildStep('Move bundle to localserver dir')
        buildbot_common.MakeDir(SERVER_DIR)
        buildbot_common.Move(tarfile, SERVER_DIR)
        tarfile = os.path.join(SERVER_DIR, tarname)

        server = None
        try:
            buildbot_common.BuildStep('Run local server')
            server = LocalHTTPServer(SERVER_DIR)

            buildbot_common.BuildStep('Generate manifest')
            with open(tarfile, 'rb') as tarfile_stream:
                archive_sha1, archive_size = manifest_util.DownloadAndComputeHash(
                    tarfile_stream)
            archive = manifest_util.Archive(manifest_util.GetHostOS())
            archive.CopyFrom({
                'url': server.GetURL(tarname),
                'size': archive_size,
                'checksum': {
                    'sha1': archive_sha1
                }
            })
            bundle = manifest_util.Bundle('pepper_' + pepper_ver)
            bundle.CopyFrom({
                'revision':
                clnumber,
                'repath':
                'pepper_' + pepper_ver,
                'version':
                pepper_ver,
                'description':
                'Chrome %s bundle, revision %s' % (pepper_ver, clnumber),
                'stability':
                'dev',
                'recommended':
                'no',
                'archives': [archive]
            })
            manifest = manifest_util.SDKManifest()
            manifest.SetBundle(bundle)
            manifest_name = 'naclsdk_manifest2.json'
            with open(os.path.join(SERVER_DIR, manifest_name), 'wb') as \
                manifest_stream:
                manifest_stream.write(manifest.GetDataAsString())

            # use newly built sdk updater to pull this bundle
            buildbot_common.BuildStep('Update from local server')
            updater_py = os.path.join(OUT_DIR, 'nacl_sdk', 'sdk_tools',
                                      'sdk_update.py')
            buildbot_common.Run([
                sys.executable, updater_py, '-U',
                server.GetURL(manifest_name), 'update', 'pepper_' + pepper_ver
            ])

            # If we are testing examples, do it in the newly pulled directory.
            pepperdir = os.path.join(OUT_DIR, 'nacl_sdk',
                                     'pepper_' + pepper_ver)

        # kill server
        finally:
            if server:
                server.Shutdown()

    # build examples.
    if not skip_examples:
        buildbot_common.BuildStep('Test Build Examples')
        filelist = os.listdir(os.path.join(pepperdir, 'examples'))
        for filenode in filelist:
            dirnode = os.path.join(pepperdir, 'examples', filenode)
            makefile = os.path.join(dirnode, 'Makefile')
            if os.path.isfile(makefile):
                print "\n\nMake: " + dirnode
                buildbot_common.Run(['make', 'all', '-j8'],
                                    cwd=os.path.abspath(dirnode),
                                    shell=True)

    # Archive on non-trybots.
    buildername = os.environ.get('BUILDBOT_BUILDERNAME', '')
    if options.archive or '-sdk' in buildername:
        buildbot_common.BuildStep('Archive build')
        bucket_path = 'nativeclient-mirror/nacl/nacl_sdk/%s' % \
            build_utils.ChromeVersion()
        buildbot_common.Archive(tarname, bucket_path, os.path.dirname(tarfile))

        if not skip_update:
            # Only push up sdk_tools.tgz on the linux buildbot.
            if buildername == 'linux-sdk-multi':
                sdk_tools = os.path.join(OUT_DIR, 'sdk_tools.tgz')
                buildbot_common.Archive('sdk_tools.tgz',
                                        bucket_path,
                                        OUT_DIR,
                                        step_link=False)

        # generate "manifest snippet" for this archive.
        if not skip_test_updater:
            archive = bundle.GetArchive(manifest_util.GetHostOS())
            archive.url = 'https://commondatastorage.googleapis.com/' \
                'nativeclient-mirror/nacl/nacl_sdk/%s/%s' % (
                    build_utils.ChromeVersion(), tarname)
            manifest_snippet_file = os.path.join(OUT_DIR, tarname + '.json')
            with open(manifest_snippet_file, 'wb') as manifest_snippet_stream:
                manifest_snippet_stream.write(bundle.ToJSON())

            buildbot_common.Archive(tarname + '.json',
                                    bucket_path,
                                    OUT_DIR,
                                    step_link=False)

    return 0