Example #1
0
def copy_binary_to_deploy(src_folder, dst_folder):
    Utility.create_folder(dst_folder)
    for f in os.listdir(src_folder):
        src = os.path.join(src_folder, f)
        dst = os.path.join(dst_folder, f)
        print "Copy \"%s\" to \"%s\"" % (src, dst)
        shutil.copyfile(src=src, dst=dst)
Example #2
0
def check_space_available(path):
    Utility.create_folder(path)
    free, used, total = Utility.get_disk_usage(path)
    ConsolePrint.info("free:%s" % free)
    ConsolePrint.info("used:%s" % used)
    ConsolePrint.info("total:%s" % total)
    if free < 200:
        JobFunc.RaiseException(MemoryError, "Insufficient disk space.")
Example #3
0
def copy_debug_info_to_deploy(src_folder, dst_folder):
    Utility.create_folder(dst_folder)
    src_folder = os.path.join(src_folder, 'obj', 'kernel', 'msm-4.4')
    for f in ['vmlinux', 'System.map']:
        src = os.path.join(src_folder, f)
        dst = os.path.join(dst_folder, f)
        print "Copy \"%s\" to \"%s\"" % (src, dst)
        shutil.copyfile(src=src, dst=dst)
Example #4
0
def copy_ota_to_deploy(src_folder, ota_folder, binary_folder):
    print binary_folder
    Utility.create_folder(ota_folder)
    zipfile_ota = os.path.join(src_folder, 'g2-ota-%s.zip' % BUILD_NUMBER)
    folder_intermediates = os.path.join(src_folder, 'obj', 'PACKAGING',
                                        'target_files_intermediates')
    zipfile_targetfile = os.path.join(folder_intermediates,
                                      'g2-target_files-%s.zip' % BUILD_NUMBER)
    # image_system = os.path.join(folder_intermediates, 'g2-target_files-%s' % BUILD_NUMBER, 'IMAGES', 'system.img')
    # image_vendor = os.path.join(folder_intermediates, 'g2-target_files-%s' % BUILD_NUMBER, 'IMAGES', 'vendor.img')
    # image_boot = os.path.join(folder_intermediates, 'g2-target_files-%s' % BUILD_NUMBER, 'IMAGES', 'boot.img')
    shutil.copyfile(src=zipfile_ota, dst=os.path.join(ota_folder, 'ota.zip'))
    shutil.copyfile(src=zipfile_targetfile,
                    dst=os.path.join(ota_folder, 'target_files.zip'))
Example #5
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")
Example #6
0
def copy_image(_type):
    u_disk1 = 'artosyn-upgrade-B2%sU.' % _type
    u_disk2 = 'B2%sU.' % _type
    full = 'B2%sF.' % _type
    # dst_folder = Utility.create_folder(os.path.join(JobFunc.get_deploy_path(_type), _type))
    deploy_path = JobFunc.get_deploy_path(_type)
    long_version = JobFunc.get_version_number(deploy_path)
    short_version = long_version.split('.')[-1]
    dst_folder = Utility.create_folder(path=os.path.join(deploy_path, long_version))
    for f in os.listdir(output_folder):
        if f.startswith(full):
            shutil.copy(src=os.path.join(output_folder, f),
                        dst=os.path.join(dst_folder, "B2%sF_%s.img" % (_type, short_version)))
        elif f.startswith(u_disk1) or f.startswith(u_disk2):
            shutil.copy(src=os.path.join(output_folder, f),
                        dst=os.path.join(dst_folder, "B2%sU_%s.img" % (_type, short_version)))
        else:
            print "wuyou debug:->%s" % f
    return dst_folder
Example #7
0
def create_deploy_folder(path, commit_msg):
    Utility.create_folder(path=path)
    write_commit_history(path=path, commit_msg=commit_msg)
    return generate_version_number(path=path)