Пример #1
0
import requests
import re
import shutil
import subprocess
import sys
import tempfile

from lib.config import (PLATFORM, get_target_arch, get_env_var, get_zip_name,
                        product_name, project_name, SOURCE_ROOT, dist_dir,
                        output_dir, get_brave_version, get_raw_version)
from lib.util import execute, parse_version, scoped_cwd, s3put
from lib.helpers import *

from lib.github import GitHub

DIST_NAME = get_zip_name(project_name(), get_brave_version())
SYMBOLS_NAME = get_zip_name(project_name(), get_brave_version(), 'symbols')
DSYM_NAME = get_zip_name(project_name(), get_brave_version(), 'dsym')
PDB_NAME = get_zip_name(project_name(), get_brave_version(), 'pdb')

if os.environ.get('DEBUG_HTTP_HEADERS') == 'true':
    try:
        from http.client import HTTPConnection  # python3
    except ImportError:
        from httplib import HTTPConnection  # python2


def main():
    args = parse_args()
    print('[INFO] Running upload...')
Пример #2
0
def create_release_draft(github, tag):
    name = '{0} {1}'.format(project_name(), tag)
    body = '(placeholder)'
    data = dict(tag_name=tag, name=name, body=body, draft=True)
    r = github.repos(BRAVE_REPO).releases.post(data=data)
    return r
Пример #3
0
def main():
    args = parse_args()
    print('[INFO] Running upload...')

    # Enable urllib3 debugging output
    if os.environ.get('DEBUG_HTTP_HEADERS') == 'true':
        logging.basicConfig(level=logging.DEBUG)
        logging.getLogger("urllib3").setLevel(logging.DEBUG)
        logging.debug(
            "DEBUG_HTTP_HEADERS env var is enabled, logging HTTP headers")
        debug_requests_on()

    # BRAVE_REPO is defined in lib/helpers.py for now
    repo = GitHub(get_env_var('GITHUB_TOKEN')).repos(BRAVE_REPO)

    tag = get_brave_version()
    release = get_release(repo, tag, allow_published_release_updates=False)

    if not release:
        print("[INFO] No existing release found, creating new "
              "release for this upload")
        release = create_release_draft(repo, tag)

    d_dir = dist_dir(args.target_os, args.target_arch)
    o_dir = output_dir(args.target_os, args.target_arch)

    DIST_NAME = get_zip_name(project_name(), get_brave_version(),
                             args.target_arch)
    SYMBOLS_NAME = get_zip_name(project_name(), get_brave_version(),
                                args.target_arch, 'symbols')
    DSYM_NAME = get_zip_name(project_name(), get_brave_version(),
                             args.target_arch, 'dsym')
    PDB_NAME = get_zip_name(project_name(), get_brave_version(),
                            args.target_arch, 'pdb')

    print('[INFO] Uploading release {}'.format(release['tag_name']))
    # Upload Brave with GitHub Releases API.
    if args.target_os != 'android':
        upload_brave(repo,
                     release,
                     os.path.join(d_dir, DIST_NAME),
                     force=args.force)
        upload_brave(repo,
                     release,
                     os.path.join(d_dir, SYMBOLS_NAME),
                     force=args.force)
    else:
        o_dir = o_dir + '/apks'
    # if PLATFORM == 'darwin':
    #     upload_brave(repo, release, os.path.join(d_dir, DSYM_NAME))
    # elif PLATFORM == 'win32':
    #     upload_brave(repo, release, os.path.join(d_dir, PDB_NAME))

    pkgs = get_brave_packages(o_dir, release_channel(), get_raw_version(),
                              args.target_os, args.target_arch,
                              args.target_apk_base)

    for pkg in pkgs:
        upload_brave(repo, release, os.path.join(o_dir, pkg), force=args.force)

    # mksnapshot = get_zip_name('mksnapshot', get_brave_version(), args.target_arch)
    # upload_brave(repo, release, os.path.join(d_dir, mksnapshot))

    # if PLATFORM == 'win32' and not tag_exists:
    #     # Upload PDBs to Windows symbol server.
    #     run_python_script('upload-windows-pdb.py')

    if os.environ.get('DEBUG_HTTP_HEADERS') == 'true':
        debug_requests_off()
    print('[INFO] Finished upload')
Пример #4
0
def create_release_draft(github, tag):
  name = '{0} {1}'.format(project_name(), tag)
  body = '(placeholder)'
  data = dict(tag_name=tag, name=name, body=body, draft=True)
  r = github.repos(ELECTRON_REPO).releases.post(data=data)
  return r
Пример #5
0
import subprocess
import sys
import tempfile

from io import StringIO
from lib.config import PLATFORM, DIST_URL, get_target_arch, get_chromedriver_version, \
                       get_env_var, s3_config, get_zip_name, product_name, project_name, \
                       SOURCE_ROOT, dist_dir, get_electron_version
from lib.util import execute, parse_version, scoped_cwd, s3put

from lib.github import GitHub


ELECTRON_REPO = "brave/electron"

DIST_NAME = get_zip_name(project_name(), get_electron_version())
SYMBOLS_NAME = get_zip_name(project_name(), get_electron_version(), 'symbols')
DSYM_NAME = get_zip_name(project_name(), get_electron_version(), 'dsym')
PDB_NAME = get_zip_name(project_name(), get_electron_version(), 'pdb')


def main():
  args = parse_args()

  if not args.publish_release:
    build_version = get_electron_build_version()
    if not get_electron_version().startswith(build_version):
      error = 'Tag name ({0}) should match build version ({1})\n'.format(
          get_electron_version(), build_version)
      sys.stderr.write(error)
      sys.stderr.flush()
Пример #6
0
def get_names_from_gyp():
  return (project_name(), product_name())