Exemplo n.º 1
0
def submodules_update(args, release_version, branch):
    print_stage("Updating Submodules")
    if make_utils.command_missing(args.git_command):
        sys.stderr.write("git not found, can't update code\n")
        sys.exit(1)

    # Update submodules to appropriate given branch,
    # falling back to master if none is given and/or found in a sub-repository.
    branch_fallback = "master"
    if not branch:
        branch = branch_fallback

    submodules = [
        ("release/scripts/addons", branch, branch_fallback),
        ("release/scripts/addons_contrib", branch, branch_fallback),
        ("release/datafiles/locale", branch, branch_fallback),
        ("source/tools", branch, branch_fallback),
    ]

    # Initialize submodules only if needed.
    for submodule_path, submodule_branch, submodule_branch_fallback in submodules:
        if not os.path.exists(os.path.join(submodule_path, ".git")):
            call([args.git_command, "submodule", "update", "--init", "--recursive"])
            break

    # Checkout appropriate branch and pull changes.
    skip_msg = ""
    for submodule_path, submodule_branch, submodule_branch_fallback in submodules:
        cwd = os.getcwd()
        try:
            os.chdir(submodule_path)
            msg = git_update_skip(args, check_remote_exists=False)
            if msg:
                skip_msg += submodule_path + " skipped: " + msg + "\n"
            else:
                # Find a matching branch that exists.
                call([args.git_command, "fetch", "origin"])
                if make_utils.git_branch_exists(args.git_command, submodule_branch):
                    pass
                elif make_utils.git_branch_exists(args.git_command, submodule_branch_fallback):
                    submodule_branch = submodule_branch_fallback
                else:
                    submodule_branch = None

                # Switch to branch and pull.
                if submodule_branch:
                    if make_utils.git_branch(args.git_command) != submodule_branch:
                        call([args.git_command, "checkout", submodule_branch])
                    call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
        finally:
            os.chdir(cwd)

    return skip_msg
Exemplo n.º 2
0
def submodules_update(args, release_version, branch):
    print_stage("Updating Submodules")
    if make_utils.command_missing(args.git_command):
        sys.stderr.write("git not found, can't update code\n")
        sys.exit(1)

    # Update submodules to latest master or appropriate release branch.
    if not release_version:
        branch = "master"

    submodules = [
        ("release/scripts/addons", branch),
        ("release/scripts/addons_contrib", branch),
        ("release/datafiles/locale", branch),
        ("source/tools", branch),
    ]

    # Initialize submodules only if needed.
    for submodule_path, submodule_branch in submodules:
        if not os.path.exists(os.path.join(submodule_path, ".git")):
            call([
                args.git_command, "submodule", "update", "--init",
                "--recursive"
            ])
            break

    # Checkout appropriate branch and pull changes.
    skip_msg = ""
    for submodule_path, submodule_branch in submodules:
        cwd = os.getcwd()
        try:
            os.chdir(submodule_path)
            msg = git_update_skip(args, check_remote_exists=False)
            if msg:
                skip_msg += submodule_path + " skipped: " + msg + "\n"
            else:
                if make_utils.git_branch(args.git_command) != submodule_branch:
                    call([args.git_command, "fetch", "origin"])
                    call([args.git_command, "checkout", submodule_branch])
                call([
                    args.git_command, "pull", "--rebase", "origin",
                    submodule_branch
                ])
        finally:
            os.chdir(cwd)

    return skip_msg
Exemplo n.º 3
0
def submodules_update(args, release_version):
    print_stage("Updating Submodules")
    if make_utils.command_missing(args.git_command):
        sys.stderr.write("git not found, can't update code\n")
        sys.exit(1)

    call([args.git_command, "submodule", "update", "--init", "--recursive"])
    if not release_version:
        # Update submodules to latest master if not building a specific release.
        # In that case submodules are set to a specific revision, which is checked
        # out by running "git submodule update".
        call([args.git_command, "submodule", "foreach", "git", "checkout", "master"])
        call([args.git_command, "submodule", "foreach", "git", "pull", "--rebase", "origin", "master"])
Exemplo n.º 4
0
def svn_update(args, release_version):
    svn_non_interactive = [args.svn_command, '--non-interactive']

    lib_dirpath = os.path.join(get_blender_git_root(), '..', 'lib')
    svn_url = make_utils.svn_libraries_base_url(release_version)

    # Checkout precompiled libraries
    if sys.platform == 'darwin':
        lib_platform = "darwin"
    elif sys.platform == 'win32':
        # Windows checkout is usually handled by bat scripts since python3 to run
        # this script is bundled as part of the precompiled libraries. However it
        # is used by the buildbot.
        lib_platform = "win64_vc14"
    elif args.use_centos_libraries:
        lib_platform = "linux_centos7_x86_64"
    else:
        # No precompiled libraries for Linux.
        lib_platform = None

    if lib_platform:
        lib_platform_dirpath = os.path.join(lib_dirpath, lib_platform)

        if not os.path.exists(lib_platform_dirpath):
            print_stage("Checking out Precompiled Libraries")

            if make_utils.command_missing(args.svn_command):
                sys.stderr.write("svn not found, can't checkout libraries\n")
                sys.exit(1)

            svn_url_platform = svn_url + lib_platform
            call(svn_non_interactive +
                 ["checkout", svn_url_platform, lib_platform_dirpath])

    if args.use_tests:
        lib_tests = "tests"
        lib_tests_dirpath = os.path.join(lib_dirpath, lib_tests)

        if not os.path.exists(lib_tests_dirpath):
            print_stage("Checking out Tests")

            if make_utils.command_missing(args.svn_command):
                sys.stderr.write("svn not found, can't checkout tests\n")
                sys.exit(1)

            svn_url_tests = svn_url + lib_tests
            call(svn_non_interactive +
                 ["checkout", svn_url_tests, lib_tests_dirpath])

    # Update precompiled libraries and tests
    print_stage("Updating Precompiled Libraries and Tests")

    if os.path.isdir(lib_dirpath):
        for dirname in os.listdir(lib_dirpath):
            dirpath = os.path.join(lib_dirpath, dirname)

            if dirname == ".svn":
                # Cleanup must be run from svn root directory if it exists.
                if not make_utils.command_missing(args.svn_command):
                    call(svn_non_interactive + ["cleanup", lib_dirpath])
                continue

            svn_dirpath = os.path.join(dirpath, ".svn")
            svn_root_dirpath = os.path.join(lib_dirpath, ".svn")

            if os.path.isdir(dirpath) and \
               (os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)):
                if make_utils.command_missing(args.svn_command):
                    sys.stderr.write("svn not found, can't update libraries\n")
                    sys.exit(1)

                # Cleanup to continue with interrupted downloads.
                if os.path.exists(svn_dirpath):
                    call(svn_non_interactive + ["cleanup", dirpath])
                # Switch to appropriate branch and update.
                call(svn_non_interactive +
                     ["switch", svn_url + dirname, dirpath])
                call(svn_non_interactive + ["update", dirpath])
Exemplo n.º 5
0
def blender_update(args):
    print_stage("Updating Blender Git Repository")
    call([args.git_command, "pull", "--rebase"])
Exemplo n.º 6
0
release_version = make_utils.git_branch_release_version(branch, tag)
lib_tests_dirpath = os.path.join('..', 'lib', "tests")

if not os.path.exists(lib_tests_dirpath):
    print("Tests files not found, downloading...")

    if make_utils.command_missing(svn_command):
        sys.stderr.write("svn not found, can't checkout test files\n")
        sys.exit(1)

    if make_utils.command_missing(cmake_command):
        sys.stderr.write("cmake not found, can't checkout test files\n")
        sys.exit(1)

    svn_url = make_utils.svn_libraries_base_url(release_version) + "/tests"
    call([svn_command, "checkout", svn_url, lib_tests_dirpath])

    # Run cmake again to detect tests files.
    os.chdir(build_dir)
    call([cmake_command, "."])

# Run tests
tests_dir = os.path.join(build_dir, "tests")
os.makedirs(tests_dir, exist_ok=True)

os.chdir(build_dir)
command = [ctest_command, ".", "--output-on-failure"]
if len(config):
    command += ["-C", config]
    tests_log = "log_" + config + ".txt"
else:
Exemplo n.º 7
0
    else:
        # No precompiled libraries for Linux.
        lib_platform = None

    if lib_platform:
        lib_platform_dirpath = os.path.join(lib_dirpath, lib_platform)

        if not os.path.exists(lib_platform_dirpath):
            print_stage("Checking out Precompiled Libraries")

            if shutil.which(svn_command) is None:
                sys.stderr.write("svn not found, can't checkout libraries\n")
                sys.exit(1)

            svn_url_platform = svn_url + lib_platform
            call(svn_non_interactive +
                 ["checkout", svn_url_platform, lib_platform_dirpath])

    # Update precompiled libraries and tests
    print_stage("Updating Precompiled Libraries and Tests")

    if os.path.isdir(lib_dirpath):
        for dirname in os.listdir(lib_dirpath):
            if dirname == ".svn":
                continue

            dirpath = os.path.join(lib_dirpath, dirname)
            svn_dirpath = os.path.join(dirpath, ".svn")
            svn_root_dirpath = os.path.join(lib_dirpath, ".svn")

            if os.path.isdir(dirpath) and \
               (os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)):
Exemplo n.º 8
0
def svn_update(args):
    svn_non_interactive = [args.svn_command, '--non-interactive']

    lib_dirpath = os.path.join(get_cycles_git_root(), '..', 'lib')
    svn_url = make_utils.svn_libraries_base_url()

    # Checkout precompiled libraries
    if sys.platform == 'darwin':
        if platform.machine() == 'x86_64':
            lib_platform = "darwin"
        elif platform.machine() == 'arm64':
            lib_platform = "darwin_arm64"
        else:
            lib_platform = None
    elif sys.platform == 'win32' and platform.machine() == 'AMD64':
        lib_platform = "win64_vc15"
    elif sys.platform == 'linux' and platform.machine() == 'x86_64':
        lib_platform = "linux_centos7_x86_64"
    else:
        lib_platform = None

    if lib_platform:
        lib_platform_dirpath = os.path.join(lib_dirpath, lib_platform)

        if not os.path.exists(lib_platform_dirpath):
            print_stage("Checking out Precompiled Libraries")

            if make_utils.command_missing(args.svn_command):
                sys.stderr.write("svn not found, can't checkout libraries\n")
                sys.exit(1)

            svn_url_platform = svn_url + lib_platform
            call(svn_non_interactive +
                 ["checkout", svn_url_platform, lib_platform_dirpath])

    # Update precompiled libraries and tests
    print_stage("Updating Precompiled Libraries")

    if os.path.isdir(lib_dirpath):
        for dirname in os.listdir(lib_dirpath):
            dirpath = os.path.join(lib_dirpath, dirname)

            if dirname == ".svn":
                # Cleanup must be run from svn root directory if it exists.
                if not make_utils.command_missing(args.svn_command):
                    call(svn_non_interactive + ["cleanup", lib_dirpath])
                continue

            svn_dirpath = os.path.join(dirpath, ".svn")
            svn_root_dirpath = os.path.join(lib_dirpath, ".svn")

            if (os.path.isdir(dirpath)
                    and (os.path.exists(svn_dirpath)
                         or os.path.exists(svn_root_dirpath))):
                if make_utils.command_missing(args.svn_command):
                    sys.stderr.write("svn not found, can't update libraries\n")
                    sys.exit(1)

                # Cleanup to continue with interrupted downloads.
                if os.path.exists(svn_dirpath):
                    call(svn_non_interactive + ["cleanup", dirpath])
                # Switch to appropriate branch and update.
                call(svn_non_interactive +
                     ["switch", svn_url + dirname, dirpath],
                     exit_on_error=False)
                call(svn_non_interactive + ["update", dirpath])
Exemplo n.º 9
0
def cycles_update(args):
    print_stage("Updating Cycles Git Repository")
    call([args.git_command, "pull", "--rebase"])
Exemplo n.º 10
0
svn_command = args.svn_command
ctest_command = args.ctest_command
cmake_command = args.cmake_command
build_dir = args.build_directory

if shutil.which(ctest_command) is None:
    sys.stderr.write("ctest not found, can't run tests\n")
    sys.exit(1)

# Test if we are building a specific release version.
release_version = make_utils.git_branch_release_version(git_command)
lib_tests_dirpath = os.path.join('..', 'lib', "tests")

if not os.path.exists(lib_tests_dirpath):
    print("Tests files not found, downloading...")

    if shutil.which(svn_command) is None:
        sys.stderr.write("svn not found, can't checkout test files\n")
        sys.exit(1)

    svn_url = make_utils.svn_libraries_base_url(release_version) + "/tests"
    call([svn_command, "checkout", svn_url, lib_tests_dirpath])

    # Run cmake again to detect tests files.
    os.chdir(build_dir)
    call([cmake_command, "."])

# Run tests
os.chdir(build_dir)
call([ctest_command, ".", "--output-on-failure"])