def main(target_dir, gitcookies):
    with git_utils.NewGitCheckout(repository=SKIA_REPO):
        # First verify that there are no gen_tasks diffs.
        gen_tasks = os.path.join(os.getcwd(), 'infra', 'bots', 'gen_tasks.go')
        try:
            subprocess.check_call(['go', 'run', gen_tasks, '--test'])
        except subprocess.CalledProcessError as e:
            print >> sys.stderr, (
                'gen_tasks.go failed, not uploading SKP update:\n\n%s' %
                e.output)
            sys.exit(1)

        # Skip GCE Auth in depot_tools/gerrit_utils.py. Use gitcookies instead.
        os.environ['SKIP_GCE_AUTH_FOR_GIT'] = 'True'
        os.environ['GIT_COOKIES_PATH'] = gitcookies
        os.environ['USE_CIPD_GCE_AUTH'] = 'True'
        # Upload the new version, land the update CL as the update-skps user.
        config_dict = {
            'user.name': SKIA_COMMITTER_NAME,
            'user.email': SKIA_COMMITTER_EMAIL,
            'http.cookiefile': gitcookies,
        }
        with git_utils.GitLocalConfig(config_dict):
            with git_utils.GitBranch(branch_name='update_skp_version',
                                     commit_msg=COMMIT_MSG,
                                     commit_queue=True):
                upload_script = os.path.join(os.getcwd(), 'infra', 'bots',
                                             'assets', 'skp', 'upload.py')
                subprocess.check_call(
                    ['python', upload_script, '-t', target_dir])
                subprocess.check_call(['go', 'run', gen_tasks])
                subprocess.check_call([
                    'git', 'add',
                    os.path.join('infra', 'bots', 'tasks.json')
                ])
Exemplo n.º 2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--gitcookies")
    parser.add_argument("--bookmaker_binary")
    parser.add_argument("--fiddlecli_output")
    args = parser.parse_args()

    with git_utils.NewGitCheckout(repository=SKIA_REPO):
        config_dict = {
            'user.name': SKIA_COMMITTER_NAME,
            'user.email': SKIA_COMMITTER_EMAIL,
            'http.cookiefile': args.gitcookies,
        }
        # Skip GCE Auth in depot_tools/gerrit_utils.py. Use gitcookies instead.
        os.environ['SKIP_GCE_AUTH_FOR_GIT'] = 'True'
        os.environ['GIT_COOKIES_PATH'] = args.gitcookies

        with git_utils.GitLocalConfig(config_dict):
            with git_utils.GitBranch(branch_name='update_md_files',
                                     commit_msg=COMMIT_MSG,
                                     commit_queue=True,
                                     upload=False,
                                     cc_list=CC_LIST) as git_branch:
                # Run bookmaker binary.
                cmd = [
                    args.bookmaker_binary,
                    '-b',
                    'docs',
                    '-f',
                    args.fiddlecli_output,
                    '-r',
                    'site/user/api',
                ]
                try:
                    subprocess.check_call(cmd)
                except subprocess.CalledProcessError as e:
                    print >> sys.stderr, (
                        'Running %s failed, not uploading markdowns update:\n\n%s'
                        % (cmd, e.output))
                    sys.exit(1)

                    # Verify that only files in the expected directory are going to be
                    # committed and uploaded.
                diff_files = subprocess.check_output(
                    ['git', 'diff', '--name-only'])
                for diff_file in diff_files.split():
                    if not diff_file.startswith('site/user/api/'):
                        print >> sys.stderr, (
                            'Some files in %s were not in the site/user/api dir. '
                            'Not uploading them' % diff_files)
                        sys.exit(1)
                if diff_files:
                    subprocess.check_call(['git', 'add', '-u'])
                    git_branch.commit_and_upload(False)
                else:
                    print 'No changes so nothing to upload.'
Exemplo n.º 3
0
def update_milestone(m):
  '''Update SkMilestone.h to match the given milestone number.'''
  with git_utils.NewGitCheckout(SKIA_REPO, local=_REPO_ROOT):
    with git_utils.GitBranch(
        'update_milestone', UPDATE_MILESTONE_COMMIT_MSG % m):
      with open(SK_MILESTONE_H, 'r+') as f:
        contents = re.sub(
            SK_MILESTONE_RE, SK_MILESTONE_TMPL % str(m), f.read(), flags=re.M)
        f.seek(0)
        f.write(contents)
        f.truncate()
      git.git('diff')
Exemplo n.º 4
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--bookmaker_binary")
    parser.add_argument("--fiddlecli_output")
    args = parser.parse_args()

    with git_utils.NewGitCheckout(repository=SKIA_REPO):
        with git_utils.GitBranch(branch_name='update_md_files',
                                 commit_msg=COMMIT_MSG,
                                 commit_queue=False,
                                 upload=False,
                                 cc_list=CC_LIST) as git_branch:
            # Run bookmaker binary.
            cmd = [
                args.bookmaker_binary,
                '-b',
                'docs',
                '-f',
                args.fiddlecli_output,
                '-r',
                'site/user/api',
            ]
            try:
                subprocess.check_call(cmd)
            except subprocess.CalledProcessError as e:
                print >> sys.stderr, (
                    'Running %s failed, not uploading markdowns update:\n\n%s'
                    % (cmd, e.output))
                sys.exit(1)

            # Verify that only files in the expected directory are going to be
            # committed and uploaded.
            diff_files = subprocess.check_output(
                ['git', 'diff', '--name-only'])
            for diff_file in diff_files.split():
                if not diff_file.startswith('site/user/api/'):
                    print >> sys.stderr, (
                        'Some files in %s were not in the site/user/api dir. '
                        'Not uploading them' % diff_files)
                    sys.exit(1)
            if diff_files:
                subprocess.check_call(['git', 'add', '-u'])
                git_branch.commit_and_upload(False)
            else:
                print 'No changes so nothing to upload.'
Exemplo n.º 5
0
def main(target_dir):
    # We're going to sync a new, clean Skia checkout to upload the CL to update
    # the SKPs. However, we want to use the scripts from the current checkout,
    # in order to facilitate running this as a try job.
    infrabots_dir = os.path.dirname(os.path.realpath(__file__))
    skp_dir = os.path.join(infrabots_dir, 'assets', 'skp')
    upload_py = os.path.join(skp_dir, 'upload.py')

    with git_utils.NewGitCheckout(repository=utils.SKIA_REPO):
        # First verify that there are no gen_tasks diffs.
        tmp_infrabots_dir = os.path.join(os.getcwd(), 'infra', 'bots')
        tmp_gen_tasks = os.path.join(tmp_infrabots_dir, 'gen_tasks.go')
        try:
            subprocess.check_call(['go', 'run', tmp_gen_tasks, '--test'])
        except subprocess.CalledProcessError as e:
            print >> sys.stderr, (
                'gen_tasks.go failed, not uploading SKP update:\n\n%s' %
                e.output)
            sys.exit(1)

        # Upload the new version, land the update CL as the recreate-skps user.
        with git_utils.GitBranch(branch_name='update_skp_version',
                                 commit_msg=COMMIT_MSG,
                                 commit_queue=True):
            upload_cmd = ['python', upload_py, '-t', target_dir]
            if args.chromium_path:
                chromium_revision = subprocess.check_output(
                    ['git', 'rev-parse', 'HEAD'],
                    cwd=args.chromium_path).rstrip()
                upload_cmd.extend([
                    '--extra_tags',
                    'chromium_revision:%s' % chromium_revision
                ])
            subprocess.check_call(upload_cmd)
            # We used upload.py from the repo that this script lives in, NOT the temp
            # repo we've created. Therefore, the VERSION file was written in that repo
            # so we need to copy it to the temp repo in order to commit it.
            src = os.path.join(skp_dir, 'VERSION')
            dst = os.path.join(os.getcwd(), 'infra', 'bots', 'assets', 'skp',
                               'VERSION')
            subprocess.check_call(['cp', src, dst])
            subprocess.check_call(['go', 'run', tmp_gen_tasks])
            subprocess.check_call(
                ['git', 'add',
                 os.path.join('infra', 'bots', 'tasks.json')])
def main():
  with git_utils.NewGitCheckout(repository=SKIA_REPO):
    # First verify that there are no gen_tasks diffs.
    gen_tasks = os.path.join(os.getcwd(), 'infra', 'bots', 'gen_tasks.go')
    try:
      subprocess.check_call(['go', 'run', gen_tasks, '--test'])
    except subprocess.CalledProcessError as e:
      print >> sys.stderr, (
         'gen_tasks.go failed, not updating Go DEPS:\n\n%s' % e.output)
      sys.exit(1)

    # Upload the new version, land the update CL as the update-go-deps user.
    with git_utils.GitBranch(branch_name='update_go_deps_version',
                             commit_msg=COMMIT_MSG,
                             commit_queue=True):
      script = os.path.join(
          os.getcwd(), 'infra', 'bots', 'assets', 'go_deps',
          'create_and_upload.py')
      subprocess.check_call(['python', script])
      subprocess.check_call(['go', 'run', gen_tasks])
      subprocess.check_call([
          'git', 'add', os.path.join('infra', 'bots', 'tasks.json')])
Exemplo n.º 7
0
def main(target_dir):
    subprocess.check_call(
        ['git', 'config', '--local', 'user.name', SKIA_COMMITTER_NAME])
    subprocess.check_call(
        ['git', 'config', '--local', 'user.email', SKIA_COMMITTER_EMAIL])
    if CHROMIUM_SKIA in subprocess.check_output(['git', 'remote', '-v']):
        subprocess.check_call(
            ['git', 'remote', 'set-url', 'origin', SKIA_REPO, CHROMIUM_SKIA])

    # Download CIPD.
    cipd_sha1 = os.path.join(os.getcwd(), 'infra', 'bots', 'tools', 'luci-go',
                             'linux64', 'cipd.sha1')
    subprocess.check_call([
        'download_from_google_storage', '-s', cipd_sha1, '--bucket',
        'chromium-luci'
    ])

    # First verify that there are no gen_tasks diffs.
    gen_tasks = os.path.join(os.getcwd(), 'infra', 'bots', 'gen_tasks.go')
    try:
        subprocess.check_call(['go', 'run', gen_tasks, '--test'])
    except subprocess.CalledProcessError as e:
        print >> sys.stderr, (
            'gen_tasks.go failed, not uploading SKP update:\n\n%s' % e.output)
        sys.exit(1)

    # Upload the new version, land the update CL.
    with git_utils.GitBranch(branch_name='update_skp_version',
                             commit_msg=COMMIT_MSG,
                             commit_queue=True):
        upload_script = os.path.join(os.getcwd(), 'infra', 'bots', 'assets',
                                     'skp', 'upload.py')
        subprocess.check_call(['python', upload_script, '-t', target_dir])
        subprocess.check_call(['go', 'run', gen_tasks])
        subprocess.check_call(
            ['git', 'add',
             os.path.join('infra', 'bots', 'tasks.json')])