def __copy_dependent(dependence, svn_tree, buildc_rc, build_home, cmode, dirname): if dirname != "include" and dirname != "lib" and dirname != "": print 'dirname args invalid' sys.exit(Errors.args_invalid) (dep_libname, dep_libversion, dep_tagfile) = Glo.get_dependent_name_and_version(dependence) h_child_item = svn_tree.get_root_item() while(h_child_item != None): svn_root_path = svn_tree.get_item_text(h_child_item) full_svn_path = svn_root_path + '|' + dep_libname + '|' + dep_libversion + '|' + Glo.CPU + '_' + cmode[0:2] + '_' + Glo.SYSTEM leaf_node = svn_tree.find_item(full_svn_path, '|', False, 1) if leaf_node != None: cache_root_path = Glo.get_local_cache_path(svn_root_path, buildc_rc.external_repositories) if cache_root_path == None: print svn_root_path + ' does not exist in .buildc.rc' sys.exit(Errors.conf_item_not_found) lib_path = cache_root_path + '/' + dep_libname + '/' + dep_libversion + '/' + Glo.CPU + '_' + cmode[0:2] + '_' + Glo.SYSTEM + '/' + dirname deps_lib_path = build_home + '/src/deps/' + dep_libname + '/' + dep_libversion + '/' + Glo.CPU + '_' + cmode[0:2] + '_' + Glo.SYSTEM + '/' + dirname if dirname == "lib": Pack.__copy_dependent_file(lib_path, deps_lib_path, dep_tagfile) else: Pack.__copy_dependent_file(lib_path, deps_lib_path, None) return h_child_item = svn_tree.get_next_sibling_item(h_child_item) print('Can not found ' + dep_libname + '/' + dep_libversion + '/' + Glo.CPU + '_' + cmode[0:2] + '_' + Glo.SYSTEM + \ ' in external repositories.') sys.exit(Errors.file_or_dir_exists)
def cache_build_by_external_libs(external_libs, cmode, force_update=True): dotrc = Glo.dot_buildc_rc_path() if not os.path.exists(dotrc): print 'Can not found ' + dotrc print 'Please run buildc init and then config .buildc.rc!' sys.exit(Errors.conf_file_not_found) buildc_rc = Load.load_dot_buildc_rc(dotrc) dotrepository = Glo.dot_buildc_repository_path() cache_svn_tree = CacheSvnTree(buildc_rc.external_repositories) cache_svn_tree.import_format_tree_from_file(dotrepository) is_valid = True for dependence in external_libs: (dep_libname, dep_libversion ) = Glo.get_dependent_name_and_version(dependence)[0:2] print '\n===>Begin build library [' + dep_libname + ' ' + dep_libversion + ']' result = Cache.build_dependent_and_fault_tolerant( cache_svn_tree, True, dep_libname, dep_libversion, cmode, force_update) print '<=== End build library [' + dep_libname + ' ' + dep_libversion + ']' if result == False: is_valid = False break if is_valid == False: is_valid = True cache_svn_tree = CacheSvnTree(buildc_rc.external_repositories) cache_svn_tree.import_format_tree_from_file(dotrepository) for dependence in external_libs: (dep_libname, dep_libversion ) = Glo.get_dependent_name_and_version(dependence)[0:2] print '\n===>Begin build library [' + dep_libname + ' ' + dep_libversion + ']' result = Cache.build_dependent_and_fault_tolerant( cache_svn_tree, False, dep_libname, dep_libversion, cmode, force_update) print '<=== End build library [' + dep_libname + ' ' + dep_libversion + ']' if result == False: is_valid = False cache_svn_tree.export_format_tree_to_file(dotrepository) return is_valid
def cache_build_by_external_libs(external_libs, cmode, force_update = True): dotrc = Glo.dot_buildc_rc_path() if not os.path.exists(dotrc): print 'Can not found ' + dotrc print 'Please run buildc init and then config .buildc.rc!' sys.exit(Errors.conf_file_not_found) buildc_rc = Load.load_dot_buildc_rc(dotrc) dotrepository = Glo.dot_buildc_repository_path() cache_svn_tree = CacheSvnTree(buildc_rc.external_repositories) cache_svn_tree.import_format_tree_from_file(dotrepository) is_valid = True for dependence in external_libs: (dep_libname, dep_libversion) = Glo.get_dependent_name_and_version(dependence)[0:2] print '\n===>Begin build library [' + dep_libname + ' ' + dep_libversion + ']' result = Cache.build_dependent_and_fault_tolerant(cache_svn_tree, True, dep_libname, dep_libversion, cmode, force_update) print '<=== End build library [' + dep_libname + ' ' + dep_libversion + ']' if result == False: is_valid = False break if is_valid == False: is_valid = True cache_svn_tree = CacheSvnTree(buildc_rc.external_repositories) cache_svn_tree.import_format_tree_from_file(dotrepository) for dependence in external_libs: (dep_libname, dep_libversion) = Glo.get_dependent_name_and_version(dependence)[0:2] print '\n===>Begin build library [' + dep_libname + ' ' + dep_libversion + ']' result = Cache.build_dependent_and_fault_tolerant(cache_svn_tree, False, dep_libname, dep_libversion, cmode, force_update) print '<=== End build library [' + dep_libname + ' ' + dep_libversion + ']' if result == False: is_valid = False cache_svn_tree.export_format_tree_to_file(dotrepository) return is_valid
def __copy_dependent(dependence, svn_tree, buildc_rc, build_home, cmode, dirname): if dirname != "include" and dirname != "lib" and dirname != "": print 'dirname args invalid' sys.exit(Errors.args_invalid) (dep_libname, dep_libversion, dep_tagfile) = Glo.get_dependent_name_and_version(dependence) h_child_item = svn_tree.get_root_item() while (h_child_item != None): svn_root_path = svn_tree.get_item_text(h_child_item) full_svn_path = svn_root_path + '|' + dep_libname + '|' + dep_libversion + '|' + Glo.CPU + '_' + cmode[ 0:2] + '_' + Glo.SYSTEM leaf_node = svn_tree.find_item(full_svn_path, '|', False, 1) if leaf_node != None: cache_root_path = Glo.get_local_cache_path( svn_root_path, buildc_rc.external_repositories) if cache_root_path == None: print svn_root_path + ' does not exist in .buildc.rc' sys.exit(Errors.conf_item_not_found) lib_path = cache_root_path + '/' + dep_libname + '/' + dep_libversion + '/' + Glo.CPU + '_' + cmode[ 0:2] + '_' + Glo.SYSTEM + '/' + dirname deps_lib_path = build_home + '/src/deps/' + dep_libname + '/' + dep_libversion + '/' + Glo.CPU + '_' + cmode[ 0:2] + '_' + Glo.SYSTEM + '/' + dirname if dirname == "lib": Pack.__copy_dependent_file(lib_path, deps_lib_path, dep_tagfile) else: Pack.__copy_dependent_file(lib_path, deps_lib_path, None) return h_child_item = svn_tree.get_next_sibling_item(h_child_item) print('Can not found ' + dep_libname + '/' + dep_libversion + '/' + Glo.CPU + '_' + cmode[0:2] + '_' + Glo.SYSTEM + \ ' in external repositories.') sys.exit(Errors.file_or_dir_exists)