def cache_update(cmode, ignore_error): 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) dotrepository = Glo.dot_buildc_repository_path() buildc_rc = Load.load_dot_buildc_rc(dotrc) cache_svn_tree = CacheSvnTree(buildc_rc.external_repositories) cache_svn_tree.import_format_tree_from_file(dotrepository) result = cache_svn_tree.check_tree_consistency() if result == False: return False result = cache_svn_tree.is_new_tree(None) if result == True: print "Warning: local cache does not need to be updated." return False cache_svn_tree.update_tree(None, cmode, ignore_error) cache_svn_tree.export_format_tree_to_file(dotrepository)
def __create_dot_repository(dotrc, dotrepository): buildc_rc = Load.load_dot_buildc_rc(dotrc) cache_svn_tree = CacheSvnTree(buildc_rc.external_repositories) cache_svn_tree.check_local_cache_conflict() cache_svn_tree.build_tree() cache_svn_tree.take_item_data_by_browse(None, SvnTree.default_empty_node, 1) cache_svn_tree.export_format_tree_to_file(dotrepository)
def cache_remove_by_cmode(cmode): 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) cache_svn_tree.remove_tree(None, cmode) cache_svn_tree.export_format_tree_to_file(dotrepository)
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