示例#1
0
def create_commit_history():
    compiler_path = Utility.get_compiler_path()
    deploy_path = Utility.get_deploy_path()
    os.chdir(compiler_path)
    since = Utility.get_timestamp(time_fmt="%Y-%m-%d %H:%M",
                                  t=Env.BUILD_TIME - 3600 * 24 * 3)
    output = os.popen(Utility.Repo.log(since=since)).read()
    with open(os.path.join(deploy_path, "CommitHistory.txt"), "w") as wfile:
        wfile.write(output)
示例#2
0
def build_user():
    workspace_path = Utility.get_compiler_path()
    os.chdir(workspace_path)
    envsetup_command = "source build/envsetup.sh"
    link_command = "source build/link.sh"
    lunch_command = "lunch g2-user general"
    ulimit_command = "ulimit -c unlimited"
    update_command = "make update-api -j8"
    make_command = "make -j8"

    commands = [
        envsetup_command, link_command, lunch_command, ulimit_command,
        update_command, make_command
    ]
    command = " && ".join(commands)
    command_exit_code = Utility.execute_command(cmd=command)
    if command_exit_code != 0:
        JobFunc.RaiseException(IOError, "Build Error")
示例#3
0
def run(*args, **kwargs):
    JobFunc.SendJobStartMail()
    Utility.print_info(__file__, args, kwargs)
    workspace_path = Utility.get_compiler_path()
    Utility.create_folder(workspace_path)
    free, used, total = Utility.get_disk_usage(workspace_path)
    print "free:%s" % free
    print "used:%s" % used
    print "total:%s" % total
    if free < 200:
        JobFunc.RaiseException(MemoryError, "Insufficient disk space.")

    os.chdir(workspace_path)
    repo_init_command = Utility.Repo.init(
        url='ssh://[email protected]:29418/manifest',
        branch='C2_8.1_master')
    repo_init_exit_code = Utility.execute_command(repo_init_command)
    if repo_init_exit_code != 0:
        JobFunc.RaiseException(IOError, "Repo init error")

    repo_sync_command = Utility.Repo.sync()
    repo_sync_exit_code = Utility.execute_command(repo_sync_command)
    if repo_sync_exit_code != 0:
        JobFunc.RaiseException(IOError, "Repo sync error")
示例#4
0
def get_out_path():
    compiler_path = Utility.get_compiler_path()
    out_path = os.path.join(compiler_path, 'out', 'target', 'product', 'g2')
    return out_path
示例#5
0
def remove_out_folder():
    workspace_path = Utility.get_compiler_path()
    out_folder = os.path.join(workspace_path, "out")
    if os.path.exists(out_folder):
        shutil.rmtree(out_folder)