Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    def check_consistency():
        dotrc = Glo.dot_buildc_rc_path()
        if not os.path.exists(dotrc):
            print 'Can not found ~/.buildc.rc!'
            print 'Please run buildc init to generate this file!'
            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
Exemplo n.º 6
0
    def check_consistency():
        dotrc = Glo.dot_buildc_rc_path()
        if not os.path.exists(dotrc):
            print 'Can not found ~/.buildc.rc!'
            print 'Please run buildc init to generate this file!'
            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
Exemplo n.º 7
0
    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
Exemplo n.º 8
0
    def __check_buildc_cfg(cmode, lib_root_path = None):
        platform_info = Glo.CPU + '_' + cmode[0:2] + '_' + Glo.SYSTEM

        buildc_rc = Load.load_dot_buildc_rc(Glo.dot_buildc_rc_path())
        buildc_cfg = Load.load_buildc_cfg(Glo.buildc_cfg_path(), Glo.var_str())

        cache_libs = []
        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.get_cache_libs(None, cmode, cache_libs)

        libs_depend = []
        for (libname, libversion, archives) in buildc_cfg.external_libs:
            is_found = False
            for (cache_libname, cache_libversion, cache_path) in cache_libs:
                if libname == cache_libname and libversion == cache_libversion:
                    path = None
                    if lib_root_path == None:
                        path = cache_path + '/' + libname + '/' + libversion + '/' + platform_info
                    else:
                        path = lib_root_path + '/' + libname + '/' + libversion + '/' + platform_info

                    if not os.path.exists(cache_path + '/' + libname + '/' + libversion + '/' + platform_info):
                        print 'Can not found [' + cache_path + '/' + libname + '/' + libversion + '/' + platform_info + '] in local library cache!'
                        print 'Please make sure the library [' + cache_path + '/' + libname + '/' + libversion + '/' + platform_info + '] is available!'
                        continue

                    libs_depend.append((libname, libversion, archives, path))

                    is_found = True
                    break
            if not is_found:
                print 'Error: Can not found [' + libname + '] in local library cache!!!!'
                print 'Please make sure the library [' + libname + '] is available!'
                sys.exit(Errors.lib_not_found)

        return libs_depend
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
    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)
Exemplo n.º 11
0
    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
Exemplo n.º 12
0
    def __check_buildc_cfg(cmode, lib_root_path=None):
        platform_info = Glo.CPU + '_' + cmode[0:2] + '_' + Glo.SYSTEM

        buildc_rc = Load.load_dot_buildc_rc(Glo.dot_buildc_rc_path())
        buildc_cfg = Load.load_buildc_cfg(Glo.buildc_cfg_path(), Glo.var_str())

        cache_libs = []
        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.get_cache_libs(None, cmode, cache_libs)

        libs_depend = []
        for (libname, libversion, archives) in buildc_cfg.external_libs:
            is_found = False
            for (cache_libname, cache_libversion, cache_path) in cache_libs:
                if libname == cache_libname and libversion == cache_libversion:
                    path = None
                    if lib_root_path == None:
                        path = cache_path + '/' + libname + '/' + libversion + '/' + platform_info
                    else:
                        path = lib_root_path + '/' + libname + '/' + libversion + '/' + platform_info

                    if not os.path.exists(cache_path + '/' + libname + '/' +
                                          libversion + '/' + platform_info):
                        print 'Can not found [' + cache_path + '/' + libname + '/' + libversion + '/' + platform_info + '] in local library cache!'
                        print 'Please make sure the library [' + cache_path + '/' + libname + '/' + libversion + '/' + platform_info + '] is available!'
                        continue

                    libs_depend.append((libname, libversion, archives, path))

                    is_found = True
                    break
            if not is_found:
                print 'Error: Can not found [' + libname + '] in local library cache!!!!'
                print 'Please make sure the library [' + libname + '] is available!'
                sys.exit(Errors.lib_not_found)

        return libs_depend