def build_sde(): install_sde_deps() sde_tar = tarfile.open(get_sde_pkg_abs_path()) sde_home_absolute = get_sde_home_absolute() sde_build_flags = get_sde_build_flags() # Deletion is required otherwise moving the directories # in further steps might create issues. # And delete only when user have opted for not to resume build if sde_build_flags is not None and '-rb' not in sde_build_flags: try: print("Deleting previous installation at {}.".format( sde_home_absolute)) os.system('sudo rm -rf {}'.format(sde_home_absolute)) except FileNotFoundError: print('{} already deleted.'.format(sde_home_absolute)) # Extract tar here i.e. in APS one touch directory sde_tar.extractall() # In case SDE home is configured in yaml other than this directory, # If both paths are same following line doesn't cause any problem. if not os.path.exists(sde_home_absolute): shutil.move(get_sde_dir_name_in_tar(), sde_home_absolute) sde_tar.close() os.chdir(sde_home_absolute) build_opt = "-up" p4studio_build_profile = get_p4_studio_build_profile_name() if get_selected_profile_name() in [ constants.stratum_hw_profile_name, constants.stratum_sim_profile_name ]: p4studio_build_profile = stratum_profile if p4studio_build_profile == "" or p4studio_build_profile is None: build_opt = "" p4studio_build_profile = "" sde_install_cmd = "{0}/p4studio_build/p4studio_build.py {1} {2}".format( sde_home_absolute, build_opt, p4studio_build_profile) if sde_build_flags is not None: for flag in sde_build_flags: if flag: sde_install_cmd += ' ' + flag else: print('No build flag will be used for BF_SDE build.') os.environ[ constants.path_env_var_name] += os.pathsep + sde_home_absolute + \ '/install/bin/' print('Building sde with command {}'.format(sde_install_cmd)) os.system(sde_install_cmd) return True
def set_sde_env(): print("Setting environment for BF_SDE.") sde_home_absolute = get_sde_home_absolute() if validate_path_existence(sde_home_absolute, 'SDE'): set_env_var(constants.sde_env_var_name, sde_home_absolute) set_env_var(constants.sde_install_env_var_name, get_env_var(constants.sde_env_var_name) + '/install') print('Environment variables set: \n SDE: {0} \n SDE_INSTALL: {1}'. format(get_env_var(constants.sde_env_var_name), get_env_var(constants.sde_install_env_var_name))) return True return False
def run_sal(): print('Starting SAL reference application...') if get_selected_profile_name() == constants.sal_hw_profile_name and not load_and_verify_kernel_modules(): print("ERROR:Some kernel modules are not loaded.") exit(0) #os.environ['TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD'] = '64077925800531312640' set_env_var(constants.sal_home_env_var_name, sal_rel_dir) sal_executable = sal_rel_dir + '/build/salRefApp' sal_run_cmd='sudo -E LD_LIBRARY_PATH={0}:{1} {2}'.format( sal_rel_dir + '/lib', get_sde_home_absolute() + '/install/lib', sal_executable) print('Running SAL with command: {}'.format(sal_run_cmd)) os.system(sal_run_cmd)
def run_sal(): print('Starting SAL reference application...') set_sal_runtime_env() if get_selected_profile_name( ) == constants.sal_hw_profile_name and not load_and_verify_kernel_modules( ): print("ERROR:Some kernel modules are not loaded.") exit(0) sal_executable = sal_rel_dir + '/build/salRefApp' sal_run_cmd = 'sudo -E LD_LIBRARY_PATH={0}:{1}:{2} {3}'.format( sal_rel_dir + '/build', sal_rel_dir + '/lib', get_sde_home_absolute() + '/install/lib', sal_executable) print('Running SAL with command: {}'.format(sal_run_cmd)) os.system(sal_run_cmd)
def build_sde(): sde_tar = tarfile.open(get_sde_pkg_name()) sde_home_absolute = get_sde_home_absolute() sde_build_flags = get_sde_build_flags() # Deletion is required otherwise moving the directories # in further steps might create issues. # And delete only when user have opted for not to resume build if '-rb' not in sde_build_flags: try: print("Deleting previous installation at {}.".format( sde_home_absolute)) os.system('sudo rm -rf {}'.format(sde_home_absolute)) except FileNotFoundError as e: print('{} already deleted.'.format(sde_home_absolute)) # Extract tar here i.e. in APS one touch directory sde_tar.extractall() # In case SDE home is configured in yaml other than this directory, # If both paths are same following line doesn't cause any problem. if not os.path.exists(sde_home_absolute): shutil.move(get_sde_dir_name_in_tar(), sde_home_absolute) sde_tar.close() os.chdir(sde_home_absolute) build_opt = "-up" p4studio_build_profile = get_from_setting_dict('BF SDE', 'p4studio_build_profile') if get_selected_profile_name() in [ constants.stratum_hw_profile_name, constants.stratum_sim_profile_name ]: p4studio_build_profile = 'stratum_profile' if p4studio_build_profile == "": build_opt = "" sde_install_cmd = "./p4studio_build/p4studio_build.py {} {}".format( build_opt, p4studio_build_profile) for flag in sde_build_flags: if flag: sde_install_cmd += ' ' + flag print('Building sde with command {}'.format(sde_install_cmd)) os.system(sde_install_cmd)
def set_sde_env(): print("Setting environment for BF_SDE.") sde_home_absolute = get_sde_home_absolute() if validate_path_existence(sde_home_absolute, 'SDE'): set_env_var(constants.sde_env_var_name, sde_home_absolute) set_env_var(constants.sde_install_env_var_name, get_env_var(constants.sde_env_var_name) + '/install/') append_to_env_var( constants.path_env_var_name, get_env_var(constants.sde_install_env_var_name) + '/bin/') print( 'Environment variables set: \n SDE: {0} \n SDE_INSTALL: {1} \n PATH: {2}' .format(get_env_var(constants.sde_env_var_name), get_env_var(constants.sde_install_env_var_name), get_env_var(constants.path_env_var_name))) return True else: print('ERROR: SDE directory couldnt be found, exiting .') exit(0)
def set_sde_env(): print("Setting environment for BF_SDE.") sde_home_absolute = get_sde_home_absolute() if validate_path_existence(sde_home_absolute, 'SDE'): set_env_var(constants.sde_env_var_name, sde_home_absolute) set_env_var(constants.sde_install_env_var_name, get_env_var(constants.sde_env_var_name) + '/install') print('Environment variables set: \n SDE: {0} \n SDE_INSTALL: {1}'. format(get_env_var(constants.sde_env_var_name), get_env_var(constants.sde_install_env_var_name))) else: print('ERROR: SDE directory couldnt be found, exiting .') exit(0) if get_sde_profile_name() == constants.sde_hw_profile_name: print('Loading kernel modules.') if not load_and_verify_kernel_modules(): print("ERROR:Some kernel modules are not loaded.") exit(0) else: print('Running simulation, No need to load kernel modules.') return True
def build_sde(): #install_sde_deps() sde_tar = tarfile.open(get_sde_pkg_abs_path()) sde_home_absolute = get_sde_home_absolute() sde_build_flags = get_sde_build_flags() # Deletion is required otherwise moving the directories # in further steps might create issues. # And delete only when user have opted for not to resume build # if sde_build_flags is not None and '-rb' not in sde_build_flags \ # and '-bm' not in sde_build_flags: try: print( "Deleting previous installation at {}.".format(sde_home_absolute)) os.system('sudo rm -rf {}'.format(sde_home_absolute)) except FileNotFoundError: print('{} already deleted.'.format(sde_home_absolute)) # Extract tar here i.e. in APS one touch directory sde_tar.extractall() # In case SDE home is configured in yaml other than this directory, # If both paths are same following line doesn't cause any problem. if not os.path.exists(sde_home_absolute): shutil.move(get_sde_dir_name_in_tar(), sde_home_absolute) sde_tar.close() os.chdir(sde_home_absolute) p4studio_build_profile = get_abs_path(get_p4_studio_build_profile_name()) sde_install_cmd = "{0}/p4studio/p4studio profile apply {1}".format( sde_home_absolute, p4studio_build_profile) os.environ[ constants. path_env_var_name] += os.pathsep + sde_home_absolute + '/install/bin/' print('Building sde with command {}'.format(sde_install_cmd)) os.system(sde_install_cmd) return True