示例#1
0
def main(args):
    sys.stdout.write('jenkins args:\n%s\n' % str(args))
    sys.stdout.flush()

    blender_branch = args.jenkins_blender_git_ref
    sys.stdout.write('Blender git ref:\t %s\n' % blender_branch)
    sys.stdout.flush()

    # minimal build is only true if build_mode == 'default'
    minimal_build = False
    if args.jenkins_build_mode == 'default':
        minimal_build = args.jenkins_minimal_build in ['1', 'yes', 'true']
        args.jenkins_build_mode = 'nightly'
        sys.stdout.write(
            '\n\tjenkins_build_mode is set to "default", building "nightly" version and *not* uploading\n'
        )
        sys.stdout.flush()

    dir_build = os.getcwd()
    os.environ['http_proxy'] = 'http://10.0.0.1:1234/'
    os.environ['https_proxy'] = 'https://10.0.0.1:1234/'
    os.environ['ftp_proxy'] = '10.0.0.1:1234'
    os.environ['socks_proxy'] = '10.0.0.1:1080'

    cgrepo = os.environ['VRAY_CGREPO_PATH']
    kdrive_os_dir_name = {
        utils.WIN: 'win',
        utils.LNX: 'linux',
        utils.MAC: 'mac',
    }[utils.get_host_os()]
    kdrive = os.path.join(cgrepo, 'sdk', kdrive_os_dir_name)

    if sys.platform == 'win32':
        setup_msvc_2013(kdrive)

    dir_source = os.path.join(args.jenkins_perm_path, 'blender-dependencies')
    if not os.path.exists(dir_source):
        os.makedirs(dir_source)
    else:
        # if job is interrupted while in git operation this file is left behind
        lock_file = os.path.join(dir_source, 'vrayserverzmq', '.git',
                                 'modules', 'extern', 'vray-zmq-wrapper',
                                 'modules', 'extern', 'cppzmq', 'index.lock')
        if os.path.exists(lock_file):
            utils.remove_path(lock_file)

    ### ADD NINJA TO PATH
    ninja_path = 'None'
    if sys.platform == 'win32':
        ninja_path = os.path.join(cgrepo, 'build_scripts', 'cmake', 'tools',
                                  'bin')
    else:
        ninja_path = os.path.join(os.environ['CI_ROOT'], 'ninja', 'ninja')
    sys.stdout.write('Ninja path [%s]\n' % ninja_path)
    sys.stdout.flush()
    os.environ['PATH'] = ninja_path + os.pathsep + os.environ['PATH']

    ### CLONE REPOS
    blender_modules = [
        "release/scripts/addons_contrib",
        "source/tools",
        "release/scripts/addons",
        'intern/vray_for_blender_rt/extern/vray-zmq-wrapper',
        'release/datafiles/locale',  # WITH_INTERNATIONAL
    ]

    os.chdir(dir_source)
    utils.remove_directory(os.path.join(dir_source, 'blender'))
    utils.get_repo('[email protected]:ChaosGroup/blender_with_vray_additions',
                   branch=blender_branch,
                   submodules=blender_modules,
                   target_name='blender')

    utils.get_repo(
        'ssh://[email protected]:2047/vray_for_blender_libs',
        target_name='blender-for-vray-libs')

    utils.get_repo(
        'ssh://[email protected]:2047/vray_for_blender_server.git',
        branch=args.jenkins_zmq_branch,
        submodules=['extern/vray-zmq-wrapper'],
        target_name='vrayserverzmq')

    os.chdir(dir_build)

    ### ADD APPSDK PATH
    bl_libs_os_dir_name = {
        # TODO: fix this for vc14
        utils.WIN: 'Windows',
        utils.LNX: 'Linux',
        utils.MAC: 'Darwin',
    }[utils.get_host_os()]
    appsdk_path = os.path.join(dir_source, 'blender-for-vray-libs',
                               bl_libs_os_dir_name, 'appsdk')
    appsdk_version = '20170307'  # re.match(r'.*?vray\d{5}-(\d{8})\.(?:tar\.xz|7z)*?', appsdk_remote_name).groups()[0]
    os.environ['CGR_APPSDK_PATH'] = appsdk_path
    os.environ['CGR_APPSDK_VERSION'] = appsdk_version
    os.environ['CGR_BUILD_TYPE'] = args.jenkins_build_type
    sys.stdout.write('CGR_APPSDK_PATH [%s], CGR_APPSDK_VERSION [%s]\n' %
                     (appsdk_path, appsdk_version))
    sys.stdout.flush()

    python_exe = sys.executable

    sys.stdout.write('jenkins args:\n%s\n' % str(args))
    sys.stdout.flush()

    cmd = [python_exe]
    cmd.append("vb25-patch/build.py")
    cmd.append("--jenkins")
    cmd.append('--dir_source=%s' % dir_source)
    cmd.append('--dir_build=%s' % dir_build)

    cmd.append('--github-src-branch=%s' % blender_branch)
    cmd.append(
        '--teamcity_zmq_server_hash=%s' %
        utils.get_git_head_hash(os.path.join(dir_source, 'vrayserverzmq')))

    cmd.append('--jenkins_kdrive_path=%s' % kdrive)
    os.environ['jenkins_kdrive_path'] = kdrive
    cmd.append('--jenkins_output=%s' % args.jenkins_output)

    dir_blender_libs = os.path.join(dir_source, 'prebuilt-libs')
    if not os.path.exists(dir_blender_libs):
        sys.stdout.write(
            'Missing prebuilt-libs path [%s], trying to create\n' %
            dir_blender_libs)
        sys.stdout.flush()
        os.makedirs(dir_blender_libs)
    cmd.append('--dir_blender_libs=%s' % dir_blender_libs)

    if args.jenkins_exporter_git_ref != 'master':
        cmd.append('--github-exp-branch=%s' % args.jenkins_exporter_git_ref)

    cmd.append('--build_clean')
    cmd.append('--with_ge')
    cmd.append('--with_player')
    cmd.append('--with_collada')
    cmd.append('--with_cycles')
    cmd.append('--with_tracker')
    if utils.get_host_os() == utils.WIN:
        cmd.append('--vc_2013')

    if minimal_build:
        cmd.append('--jenkins_minimal_build')
    cmd.append('--build_mode=%s' % args.jenkins_build_mode)
    cmd.append('--build_type=%s' % args.jenkins_build_type)
    cmd.append('--use_package')
    cmd.append('--use_installer=CGR')
    cmd.append(
        '--dir_cgr_installer=%s' %
        os.path.join(dir_source, 'blender-for-vray-libs', 'cgr_installer'))

    if args.jenkins_with_static_libc:
        cmd.append('--teamcity_with_static_libc')

    cmd.append('--dev_static_libs')

    cmd.append('--upblender=off')
    cmd.append('--uppatch=off')

    cmd.append('--gcc=gcc')
    cmd.append('--gxx=g++')

    cmd.append(
        '--dir_install=%s' %
        os.path.join(args.jenkins_output, 'install', 'vray_for_blender'))
    cmd.append(
        '--dir_release=%s' %
        os.path.join(args.jenkins_output, 'release', 'vray_for_blender'))

    sys.stdout.write('Calling builder:\n%s\n' % '\n\t'.join(cmd))
    sys.stdout.flush()

    return subprocess.call(cmd, cwd=dir_build)
示例#2
0
def main(args):
    sys.stdout.write('jenkins args:\n%s\n' % str(args))
    sys.stdout.flush()

    gitRefs = {
        'blender': args.jenkins_blender_git_ref,
        'zmq': args.jenkins_zmq_branch,
        'libs': args.jenkins_libs_git_ref,
        'exporter': args.jenkins_exporter_git_ref,
        'svn_revision': '62167',
    }

    if args.jenkins_predefined_config == 'vb40':
        gitRefs = {
            'blender': 'dev/vray_for_blender/vb40',
            'zmq': 'dev/vray_for_blender/vb40',
            'libs': 'dev/vray_for_blender/vb40',
            'exporter': 'dev/vray_for_blender/vb40',
            'svn_revision': '62167',
        }
    elif args.jenkins_predefined_config == 'vb35':
        gitRefs = {
            'blender': 'dev/vray_for_blender/vb35',
            'zmq': 'master',
            'libs': 'master',
            'exporter': 'master',
            'svn_revision': '62167',
        }

    utils.stdout_log('GIT refs:')
    utils.stdout_log(json.dumps(gitRefs, indent=4))

    # minimal build is only true if build_mode == 'default'
    minimal_build = False
    if args.jenkins_build_mode == 'default':
        minimal_build = args.jenkins_minimal_build  in ['1', 'yes', 'true']
        args.jenkins_build_mode = 'nightly'
        sys.stdout.write('\n\tjenkins_build_mode is set to "default", building "nightly" version and *not* uploading\n')
        sys.stdout.flush()

    dir_build = os.getcwd()

    dir_source = os.path.join(args.jenkins_perm_path, 'blender-dependencies')
    if not os.path.exists(dir_source):
        os.makedirs(dir_source)
    else:
        # if job is interrupted while in git operation this file is left behind
        lock_file = os.path.join(dir_source, 'vrayserverzmq','.git','modules','extern','vray-zmq-wrapper','modules','extern','cppzmq','index.lock')
        if os.path.exists(lock_file):
            utils.remove_path(lock_file)

    ### CLONE REPOS
    blender_modules = [
        "release/scripts/addons_contrib",
        "source/tools",
        "release/scripts/addons",
        'intern/vray_for_blender_rt/extern/vray-zmq-wrapper',
        'release/datafiles/locale', # WITH_INTERNATIONAL
    ]

    os.chdir(dir_source)
    utils.get_repo('[email protected]:ChaosGroup/blender_with_vray_additions',
                   branch=gitRefs['blender'],
                   submodules=blender_modules,
                   target_name='blender')

    utils.get_repo('ssh://[email protected]:2047/vray_for_blender_libs',
                   branch=gitRefs['libs'],
                   target_name='blender-for-vray-libs')

    utils.get_repo('ssh://[email protected]:2047/vray_for_blender_server.git',
                   branch=gitRefs['zmq'],
                   submodules=['extern/vray-zmq-wrapper'],
                   target_name='vrayserverzmq')

    utils.get_repo('[email protected]:bintools',
                   target_name='bintools')

    ### ADD NINJA TO PATH
    ninja_path = 'None'
    if sys.platform == 'win32':
        ninja_path = os.path.join(dir_source, 'blender-for-vray-libs', 'Windows')
    else:
        ninja_path = os.path.join(os.environ['CI_ROOT'], 'ninja', 'ninja')
    sys.stdout.write('Ninja path [%s]\n' % ninja_path)
    sys.stdout.flush()
    os.environ['PATH'] = ninja_path + os.pathsep + os.environ['PATH']

    os.chdir(dir_build)

    ### ADD APPSDK PATH
    bl_libs_os_dir_name = {
        utils.WIN: 'Windows',
        utils.LNX: 'Linux',
        utils.MAC: 'Darwin',
    }[utils.get_host_os()]
    appsdk_path = os.path.join(dir_source, 'blender-for-vray-libs', bl_libs_os_dir_name, 'appsdk')
    appsdk_version = '20170307'# re.match(r'.*?vray\d{5}-(\d{8})\.(?:tar\.xz|7z)*?', appsdk_remote_name).groups()[0]
    os.environ['CGR_APPSDK_PATH'] = appsdk_path
    python_exe = sys.executable

    cmd = [python_exe]
    cmd.append("vb25-patch/build.py")
    cmd.append("--jenkins")
    cmd.append('--dir_source=%s' % dir_source)
    cmd.append('--dir_build=%s' % dir_build)

    cmd.append('--github-src-branch=%s' % gitRefs['blender'])
    cmd.append('--zmq_server_hash=%s' % utils.get_git_head_hash(os.path.join(dir_source, 'vrayserverzmq')))

    cmd.append('--jenkins_output=%s' % args.jenkins_output)
    cmd.append('--svn_revision=%s' % gitRefs['svn_revision'])

    dir_blender_libs = os.path.join(dir_source, 'prebuilt-libs')
    if not os.path.exists(dir_blender_libs):
        sys.stdout.write('Missing prebuilt-libs path [%s], trying to create\n' % dir_blender_libs)
        sys.stdout.flush()
        os.makedirs(dir_blender_libs)
    cmd.append('--dir_blender_libs=%s' % dir_blender_libs)

    if gitRefs['exporter'] != 'master':
        cmd.append('--github-exp-branch=%s' % gitRefs['exporter'])

    cmd.append('--build_clean')
    cmd.append('--with_ge')
    cmd.append('--with_player')
    cmd.append('--with_collada')
    cmd.append('--with_cycles')
    cmd.append('--with_tracker')
    if utils.get_host_os() == utils.WIN:
        cmd.append('--vc_2013')

    if minimal_build:
        cmd.append('--jenkins_minimal_build')
    cmd.append('--build_mode=%s' % args.jenkins_build_mode)
    cmd.append('--build_type=%s' % args.jenkins_build_type)
    cmd.append('--use_package')
    cmd.append('--use_installer=CGR')
    cmd.append('--dir_cgr_installer=%s' % os.path.join(dir_source, 'blender-for-vray-libs', 'cgr_installer'))

    if args.jenkins_with_static_libc:
        cmd.append('--with_static_libc')

    if args.jenkins_predefined_config == 'vb40':
        cmd.append('--target_version_suffix=%s' % 40)
    elif args.jenkins_predefined_config == 'vb35':
        cmd.append('--target_version_suffix=%s' % 35)

    cmd.append('--dev_static_libs')

    cmd.append('--upblender=off')
    cmd.append('--uppatch=off')

    cmd.append('--gcc=gcc')
    cmd.append('--gxx=g++')

    cmd.append('--dir_install=%s' % os.path.join(args.jenkins_output, 'install', 'vray_for_blender'))
    cmd.append('--dir_release=%s' % os.path.join(args.jenkins_output, 'release', 'vray_for_blender'))

    sys.stdout.write('Calling builder:\n%s\n' % '\n\t'.join(cmd))
    sys.stdout.flush()

    return subprocess.call(cmd, cwd=dir_build)
示例#3
0
def get_appsdk(appsdk_name, appsdk_version, dir_source):
    appsdk_os_dir_name = {
        utils.WIN: 'windows',
        utils.LNX: 'linux',
        utils.MAC: 'darwin',
    }[utils.get_host_os()]

    vray_ext = 'exe' if utils.get_host_os() == utils.WIN else 'bin'

    all_appsdk_root = os.path.join(dir_source, 'vray-appsdk')

    # clean all non-needed files
    for item in glob.glob('%s/*' % all_appsdk_root):
        item_name = os.path.basename(item)
        if re.match(r'^\d{8}$', item_name) is None:
            utils.remove_path(item)

    appsdk_path = os.path.join(all_appsdk_root, appsdk_version, appsdk_os_dir_name)
    appsdk_check = os.path.join(appsdk_path, 'bin', 'vray.%s' % vray_ext)
    download_appsdk = not os.path.exists(appsdk_check)

    if not download_appsdk:
        sys.stdout.write('Already have [%s]' % appsdk_name)
        sys.stdout.flush()
        return all_appsdk_root

    sys.stdout.write('Missing vray [%s]\n' % appsdk_check)
    sys.stdout.write('Creating dir [%s]\n' % appsdk_path)
    sys.stdout.flush()

    try:
        os.makedirs(appsdk_path)
    except:
        pass

    curl = 'curl -s -S -o %s ftp://%s:%[email protected]/vrayappsdk/%s/%s' % (
        appsdk_name,
        os.environ['NIGHTLIES_USER'],
        os.environ['NIGHTLIES_PASS'],
        appsdk_version,
        appsdk_name,
    )

    sys.stdout.write('Downloading appsdk:\n')
    sys.stdout.write('CURL [%s]\n' % curl)
    sys.stdout.flush()
    os.chdir(appsdk_path)
    os.system(curl)

    extract_cmds = {
        utils.WIN: ['7z x %s' % appsdk_name],
        utils.LNX: ['7z x %s' % appsdk_name],
        utils.MAC: ['7z x %s' % appsdk_name, 'mv *.tar appsdk.tar', '7z x appsdk.tar'],
    }[utils.get_host_os()]

    for cmd in extract_cmds:
        sys.stdout.write('Extract CMD [%s]\n' % cmd)
        sys.stdout.flush()
        os.system(cmd)

    tar_name = appsdk_name[0:-3]
    if utils.get_host_os() != utils.WIN and os.path.exists(os.path.join(appsdk_path, tar_name)):
        cmd = "7z x %s" % tar_name
        sys.stdout.write('Extract tar CMD [%s]\n' % cmd)
        sys.stdout.flush()
        os.system(cmd)

    utils.remove_path(os.path.join(appsdk_path, appsdk_name))
    return all_appsdk_root
def main(args):
    sys.stdout.write('jenkins args:\n%s\n' % str(args))
    sys.stdout.flush()

    gitRefs = {
        'blender': args.jenkins_blender_git_ref,
        'zmq': args.jenkins_zmq_branch,
        'libs': args.jenkins_libs_git_ref,
        'exporter': args.jenkins_exporter_git_ref,
        'svn_revision': '62167',
    }

    if args.jenkins_predefined_config == 'vb40':
        gitRefs = {
            'blender': 'dev/vray_for_blender/vb40',
            'zmq': 'dev/vray_for_blender/vb40',
            'libs': 'dev/vray_for_blender/vb40',
            'exporter': 'dev/vray_for_blender/vb40',
            'svn_revision': '62167',
        }
    elif args.jenkins_predefined_config == 'vb35':
        gitRefs = {
            'blender': 'dev/vray_for_blender/vb35',
            'zmq': 'master',
            'libs': 'master',
            'exporter': 'master',
            'svn_revision': '62167',
        }

    utils.stdout_log('GIT refs:')
    utils.stdout_log(json.dumps(gitRefs, indent=4))

    # minimal build is only true if build_mode == 'default'
    minimal_build = False
    if args.jenkins_build_mode == 'default':
        minimal_build = args.jenkins_minimal_build in ['1', 'yes', 'true']
        args.jenkins_build_mode = 'nightly'
        sys.stdout.write(
            '\n\tjenkins_build_mode is set to "default", building "nightly" version and *not* uploading\n'
        )
        sys.stdout.flush()

    dir_build = os.getcwd()

    dir_source = os.path.join(args.jenkins_perm_path, 'blender-dependencies')
    if not os.path.exists(dir_source):
        os.makedirs(dir_source)
    else:
        # if job is interrupted while in git operation this file is left behind
        lock_file = os.path.join(dir_source, 'vrayserverzmq', '.git',
                                 'modules', 'extern', 'vray-zmq-wrapper',
                                 'modules', 'extern', 'cppzmq', 'index.lock')
        if os.path.exists(lock_file):
            utils.remove_path(lock_file)

    ### CLONE REPOS
    blender_modules = [
        "release/scripts/addons_contrib",
        "source/tools",
        "release/scripts/addons",
        'intern/vray_for_blender_rt/extern/vray-zmq-wrapper',
        'release/datafiles/locale',  # WITH_INTERNATIONAL
    ]

    os.chdir(dir_source)
    utils.get_repo('[email protected]:ChaosGroup/blender_with_vray_additions',
                   branch=gitRefs['blender'],
                   submodules=blender_modules,
                   target_name='blender')

    utils.get_repo(
        'ssh://[email protected]:2047/vray_for_blender_libs',
        branch=gitRefs['libs'],
        target_name='blender-for-vray-libs')

    utils.get_repo(
        'ssh://[email protected]:2047/vray_for_blender_server.git',
        branch=gitRefs['zmq'],
        submodules=['extern/vray-zmq-wrapper'],
        target_name='vrayserverzmq')

    utils.get_repo('[email protected]:bintools',
                   target_name='bintools')

    ### ADD NINJA TO PATH
    ninja_path = 'None'
    if sys.platform == 'win32':
        ninja_path = os.path.join(dir_source, 'blender-for-vray-libs',
                                  'Windows')
    else:
        ninja_path = os.path.join(os.environ['CI_ROOT'], 'ninja', 'ninja')
    sys.stdout.write('Ninja path [%s]\n' % ninja_path)
    sys.stdout.flush()
    os.environ['PATH'] = ninja_path + os.pathsep + os.environ['PATH']

    os.chdir(dir_build)

    ### ADD APPSDK PATH
    bl_libs_os_dir_name = {
        utils.WIN: 'Windows',
        utils.LNX: 'Linux',
        utils.MAC: 'Darwin',
    }[utils.get_host_os()]
    appsdk_path = os.path.join(dir_source, 'blender-for-vray-libs',
                               bl_libs_os_dir_name, 'appsdk')
    appsdk_version = '20170307'  # re.match(r'.*?vray\d{5}-(\d{8})\.(?:tar\.xz|7z)*?', appsdk_remote_name).groups()[0]
    os.environ['CGR_APPSDK_PATH'] = appsdk_path
    python_exe = sys.executable

    cmd = [python_exe]
    cmd.append("vb25-patch/build.py")
    cmd.append("--jenkins")
    cmd.append('--dir_source=%s' % dir_source)
    cmd.append('--dir_build=%s' % dir_build)

    cmd.append('--github-src-branch=%s' % gitRefs['blender'])
    cmd.append(
        '--zmq_server_hash=%s' %
        utils.get_git_head_hash(os.path.join(dir_source, 'vrayserverzmq')))

    cmd.append('--jenkins_output=%s' % args.jenkins_output)
    cmd.append('--svn_revision=%s' % gitRefs['svn_revision'])

    dir_blender_libs = os.path.join(dir_source, 'prebuilt-libs')
    if not os.path.exists(dir_blender_libs):
        sys.stdout.write(
            'Missing prebuilt-libs path [%s], trying to create\n' %
            dir_blender_libs)
        sys.stdout.flush()
        os.makedirs(dir_blender_libs)
    cmd.append('--dir_blender_libs=%s' % dir_blender_libs)

    if gitRefs['exporter'] != 'master':
        cmd.append('--github-exp-branch=%s' % gitRefs['exporter'])

    cmd.append('--build_clean')
    cmd.append('--with_ge')
    cmd.append('--with_player')
    cmd.append('--with_collada')
    cmd.append('--with_cycles')
    cmd.append('--with_tracker')
    if utils.get_host_os() == utils.WIN:
        cmd.append('--vc_2013')

    if minimal_build:
        cmd.append('--jenkins_minimal_build')
    cmd.append('--build_mode=%s' % args.jenkins_build_mode)
    cmd.append('--build_type=%s' % args.jenkins_build_type)
    cmd.append('--use_package')
    cmd.append('--use_installer=CGR')
    cmd.append(
        '--dir_cgr_installer=%s' %
        os.path.join(dir_source, 'blender-for-vray-libs', 'cgr_installer'))

    if args.jenkins_with_static_libc:
        cmd.append('--with_static_libc')

    if args.jenkins_predefined_config == 'vb40':
        cmd.append('--target_version_suffix=%s' % 40)
    elif args.jenkins_predefined_config == 'vb35':
        cmd.append('--target_version_suffix=%s' % 35)

    cmd.append('--dev_static_libs')

    cmd.append('--upblender=off')
    cmd.append('--uppatch=off')

    cmd.append('--gcc=gcc')
    cmd.append('--gxx=g++')

    cmd.append(
        '--dir_install=%s' %
        os.path.join(args.jenkins_output, 'install', 'vray_for_blender'))
    cmd.append(
        '--dir_release=%s' %
        os.path.join(args.jenkins_output, 'release', 'vray_for_blender'))

    sys.stdout.write('Calling builder:\n%s\n' % '\n\t'.join(cmd))
    sys.stdout.flush()

    return subprocess.call(cmd, cwd=dir_build)
示例#5
0
def main(args):
    sys.stdout.write('jenkins args:\n%s\n' % str(args))
    sys.stdout.flush()

    dir_build = os.getcwd()
    os.environ['http_proxy'] = '10.0.0.1:1234'
    os.environ['https_proxy'] = '10.0.0.1:1234'
    os.environ['ftp_proxy'] = '10.0.0.1:1234'
    os.environ['socks_proxy'] = '10.0.0.1:1080'

    os.environ['http_proxy'] = 'http://10.0.0.1:1234/'
    os.environ['https_proxy'] = 'https://10.0.0.1:1234/'

    cgrepo = os.environ['VRAY_CGREPO_PATH']
    kdrive_os_dir_name = {
        utils.WIN: 'win',
        utils.LNX: 'linux',
        utils.MAC: 'mac',
    }[utils.get_host_os()]
    kdrive = os.path.join(cgrepo, 'sdk', kdrive_os_dir_name)

    if sys.platform == 'win32':
        setup_msvc_2013(kdrive)

    dir_source = os.path.join(args.jenkins_perm_path, 'blender-dependencies')
    if not os.path.exists(dir_source):
        os.makedirs(dir_source)

    blender_branch = 'dev/vray_for_blender/vb35'

    ### GET APPSDK
    appsdk_remote_name = {
        utils.WIN: 'appsdk-win-qt-nightly-1.11.00-vray34501-20161110.7z',
        utils.LNX: 'appsdk-linux-qt-nightly-1.11.00-vray34501-20161110.tar.xz',
        utils.MAC: 'appsdk-mac-qt-nightly-1.11.00-vray34501-20161110.tar.xz',
    }[utils.get_host_os()]

    if args.jenkins_appsdk_remote_name != '':
        appsdk_remote_name = args.jenkins_appsdk_remote_name

    appsdk_version = re.match(r'.*?vray\d{5}-(\d{8})\.(?:tar\.xz|7z)*?', appsdk_remote_name).groups()[0]

    appsdk_path = get_appsdk(appsdk_remote_name, appsdk_version, dir_source)

    sys.stdout.write('CGR_APPSDK_PATH [%s], CGR_APPSDK_VERSION [%s]\n' % (appsdk_path, appsdk_version))
    os.environ['CGR_BUILD_TYPE'] = args.jenkins_build_type
    os.environ['CGR_APPSDK_PATH'] = appsdk_path
    os.environ['CGR_APPSDK_VERSION'] = appsdk_version

    ### ADD NINJA TO PATH
    ninja_path = 'None'
    if sys.platform == 'win32':
        ninja_path = os.path.join(cgrepo, 'build_scripts', 'cmake', 'tools', 'bin')
    else:
        ninja_path = os.path.join(os.environ['CI_ROOT'], 'ninja', 'ninja')
    sys.stdout.write('Ninja path [%s]\n' % ninja_path)
    sys.stdout.flush()
    os.environ['PATH'] = ninja_path + os.pathsep + os.environ['PATH']

    ### CLONE REPOS
    blender_modules = [
        "release/scripts/addons_contrib",
        "source/tools",
        "release/scripts/addons",
        'intern/vray_for_blender_rt/extern/vray-zmq-wrapper',
    ]

    os.chdir(dir_source)
    utils.get_repo('[email protected]:bdancer/blender-for-vray', branch=blender_branch, submodules=blender_modules, target_name='blender')
    utils.get_repo('[email protected]:ChaosGroup/blender-for-vray-libs')
    utils.get_repo('[email protected]:bdancer/vrayserverzmq', submodules=['extern/vray-zmq-wrapper'])

    os.chdir(dir_build)
    ### CLONE REPOS

    python_exe = sys.executable

    sys.stdout.write('jenkins args:\n%s\n' % str(args))
    sys.stdout.flush()

    cmd = [python_exe]
    cmd.append("vb25-patch/build.py")
    cmd.append("--jenkins")
    cmd.append('--dir_source=%s' % dir_source)
    cmd.append('--dir_build=%s' % dir_build)

    cmd.append('--github-src-branch=%s' % blender_branch)
    cmd.append('--teamcity_zmq_server_hash=%s' % utils.get_git_head_hash(os.path.join(dir_source, 'vrayserverzmq')))

    cmd.append('--jenkins_kdrive_path=%s' % kdrive)
    os.environ['jenkins_kdrive_path'] = kdrive
    cmd.append('--jenkins_output=%s' % args.jenkins_output)


    dir_blender_libs = os.path.join(dir_source, 'prebuilt-libs')
    if not os.path.exists(dir_blender_libs):
        sys.stdout.write('Missing prebuilt-libs path [%s], trying to create\n' % dir_blender_libs)
        sys.stdout.flush()
        os.makedirs(dir_blender_libs)
    cmd.append('--dir_blender_libs=%s' % dir_blender_libs)

    cmd.append('--build_clean')
    cmd.append('--with_ge')
    cmd.append('--with_player')
    cmd.append('--with_collada')
    cmd.append('--with_cycles')
    cmd.append('--with_tracker')
    if utils.get_host_os() == utils.WIN:
        cmd.append('--vc_2013')

    cmd.append('--build_mode=release')
    cmd.append('--build_type=%s' % args.jenkins_build_type)
    cmd.append('--use_package')
    cmd.append('--use_installer=CGR')
    cmd.append('--dir_cgr_installer=%s' % os.path.join(dir_source, 'blender-for-vray-libs', 'cgr_installer'))

    if args.jenkins_with_static_libc:
        cmd.append('--teamcity_with_static_libc')

    cmd.append('--dev_static_libs')

    cmd.append('--upblender=off')
    cmd.append('--uppatch=off')

    cmd.append('--gcc=gcc')
    cmd.append('--gxx=g++')

    cmd.append('--dir_install=%s' % os.path.join(args.jenkins_output, 'install', 'vray_for_blender'))
    cmd.append('--dir_release=%s' % os.path.join(args.jenkins_output, 'release', 'vray_for_blender'))

    sys.stdout.write('Calling builder:\n%s\n' % '\n\t'.join(cmd))
    sys.stdout.flush()

    return subprocess.call(cmd, cwd=dir_build)