Example #1
0
def rebuild_private_api(sdk, include_private_framework=False):
    '''
    set_E private api
    undocument_api = set_B - set_C
    set_E = set_A - set_C - undocument_api = set_A - set_B
    if include_private_framework: set_E = set_E + set_D
    '''
    # first flush the table data
    api_dbs.delete_apis_by_sdk('framework_private_apis', sdk_version['sdk'])
    api_dbs.delete_apis_by_sdk('private_apis', sdk_version['sdk'])

    framework_dump_private_apis = []
    framework_dump_apis = api_dbs.get_framework_dump_apis(sdk_version['sdk'])

    pub_cnt = 0
    pri_cnt = 0
    __cnt = 0
    for api in framework_dump_apis:
        if api['api_name'] and api['api_name'][0:1] == '_':
            __cnt = __cnt + 1
            framework_dump_private_apis.append(api)
            continue
        #对于不以下划线开头的
        r = api_dbs.is_api_exist_in('framework_header_apis', api)
        if r:
            pub_cnt = pub_cnt + 1
        else:
            r = api_dbs.is_api_exist_in('document_apis', api)
            if r:
                pub_cnt = pub_cnt + 1
            else:
                pri_cnt = pri_cnt + 1
                framework_dump_private_apis.append(api)

    print 'pub_cnt:', pub_cnt
    print 'pri_cnt:', pri_cnt
    print '__cnt:', __cnt

    print 'private api lengh:', len(framework_dump_private_apis)
    print 'start group by...'
    #去除重复
    framework_dump_private_apis = api_utils.deduplication_api_list(
        framework_dump_private_apis)
    print 'deduplication private api len:', len(framework_dump_private_apis)

    rst = api_dbs.insert_apis('private_apis', framework_dump_private_apis)
    print 'insert into db private_apis, len:', rst

    rst = api_dbs.insert_apis('framework_private_apis',
                              framework_dump_private_apis)
    print 'insert into db framework_private_apis, len:', rst

    if include_private_framework:
        private_framework_apis = api_dbs.get_private_framework_dump_apis(
            sdk_version['sdk'])
        rst = api_dbs.insert_apis('private_apis', framework_dump_private_apis)
        print 'insert into db private_apis, len:', rst
    return True
def rebuild_private_api(sdk, include_private_framework=False):
    """
    set_E private api
    undocument_api = set_B - set_C
    set_E = set_A - set_C - undocument_api = set_A - set_B
    if include_private_framework: set_E = set_E + set_D
    """
    # first flush the table data
    api_dbs.delete_apis_by_sdk("framework_private_apis", sdk_version["sdk"])
    api_dbs.delete_apis_by_sdk("private_apis", sdk_version["sdk"])

    framework_dump_private_apis = []
    framework_dump_apis = api_dbs.get_framework_dump_apis(sdk_version["sdk"])

    pub_cnt = 0
    pri_cnt = 0
    __cnt = 0
    for api in framework_dump_apis:
        if api["api_name"] and api["api_name"][0:1] == "_":
            __cnt = __cnt + 1
            framework_dump_private_apis.append(api)
            continue
        # 对于不以下划线开头的
        r = api_dbs.is_api_exist_in("framework_header_apis", api)
        if r:
            pub_cnt = pub_cnt + 1
        else:
            r = api_dbs.is_api_exist_in("document_apis", api)
            if r:
                pub_cnt = pub_cnt + 1
            else:
                pri_cnt = pri_cnt + 1
                framework_dump_private_apis.append(api)

    print "pub_cnt:", pub_cnt
    print "pri_cnt:", pri_cnt
    print "__cnt:", __cnt

    print "private api lengh:", len(framework_dump_private_apis)
    print "start group by..."
    # 去除重复
    framework_dump_private_apis = api_utils.deduplication_api_list(framework_dump_private_apis)
    print "deduplication private api len:", len(framework_dump_private_apis)

    rst = api_dbs.insert_apis("private_apis", framework_dump_private_apis)
    print "insert into db private_apis, len:", rst

    rst = api_dbs.insert_apis("framework_private_apis", framework_dump_private_apis)
    print "insert into db framework_private_apis, len:", rst

    if include_private_framework:
        private_framework_apis = api_dbs.get_private_framework_dump_apis(sdk_version["sdk"])
        rst = api_dbs.insert_apis("private_apis", framework_dump_private_apis)
        print "insert into db private_apis, len:", rst
    return True
def rebuild_private_api(sdk, include_private_framework = False):
    '''
    set_E private api
    undocument_api = set_B - set_C
    set_E = set_A - set_C - undocument_api = set_A - set_B
    if include_private_framework: set_E = set_E + set_D
    '''
    # first flush the table data
    api_dbs.delete_apis_by_sdk('framework_private_apis', sdk_version['sdk'])
    api_dbs.delete_apis_by_sdk('private_apis', sdk_version['sdk'])

    framework_dump_private_apis = []
    framework_dump_apis = api_dbs.get_framework_dump_apis(sdk_version['sdk'])
    
    pub_cnt = 0
    pri_cnt = 0
    __cnt = 0
    for api in framework_dump_apis:
        if api['api_name'] and api['api_name'][0:1] == '_':
            __cnt = __cnt + 1
            framework_dump_private_apis.append(api)
            continue
        #对于不以下划线开头的
        r = api_dbs.is_api_exist_in('framework_header_apis', api)
        if r:
            pub_cnt = pub_cnt + 1
        else:
            r = api_dbs.is_api_exist_in('document_apis', api)
            if r:
                pub_cnt = pub_cnt + 1
            else:
                pri_cnt = pri_cnt + 1
                framework_dump_private_apis.append(api)

    print 'pub_cnt:', pub_cnt
    print 'pri_cnt:', pri_cnt
    print '__cnt:', __cnt

    print 'private api lengh:', len(framework_dump_private_apis)
    print 'start group by...'
    #去除重复
    framework_dump_private_apis = api_utils.deduplication_api_list(framework_dump_private_apis)
    print 'deduplication private api len:', len(framework_dump_private_apis)

    rst = api_dbs.insert_apis('private_apis', framework_dump_private_apis)
    print 'insert into db private_apis, len:', rst

    rst = api_dbs.insert_apis('framework_private_apis', framework_dump_private_apis)
    print 'insert into db framework_private_apis, len:', rst

    if include_private_framework:
        private_framework_apis = api_dbs.get_private_framework_dump_apis(sdk_version['sdk'])
        rst = api_dbs.insert_apis('private_apis', framework_dump_private_apis)
        print 'insert into db private_apis, len:', rst
    return True
def rebuild_sdk_private_api(sdk_version):
    api_dbs.delete_apis_by_sdk('framework_private_apis', sdk_version['sdk'])
    api_dbs.delete_apis_by_sdk('private_apis', sdk_version['sdk'])

    print rebuild_framework_header_api(sdk_version['sdk'], sdk_version['framework'])
    print rebuild_dump_framework_api(sdk_version['sdk'], sdk_version['framework'])
    print rebuild_dump_private_framework_api(sdk_version['sdk'], sdk_version['private_framework'])



    #清理私有api最终结果库
    api_dbs.clean_table('private_apis')

    #通过计算,获得私有api,并保存到数据库汇总
    private_framework_apis = api_dbs.get_private_framework_dump_apis(sdk_version['sdk'])

    #1. private_framework_api 转存到private表中
    print 'One private api. count: ', api_dbs.insert_apis('private_apis', private_framework_apis)

    #2. framework_dump - framework_header
    #3. framework_dump中_开头的api
    framework_dump_private_apis = []
    framework_dump_apis = api_dbs.get_framework_dump_apis(sdk_version['sdk'])

    len_framework_dump_apis = len(framework_dump_apis)
    for count in range(len_framework_dump_apis):
        api = framework_dump_apis[count]
        if api['api_name'] and api['api_name'][0:1] == '_':
            print 'api start with `_`\tclass_name:%s\tapi_name:%s\tsdk version:%s ... %d/%d' % (api['class_name'], api['api_name'], api['sdk'], count, len_framework_dump_apis)
            framework_dump_private_apis.append(api)
            continue
        #对于不以下划线开头的
        r = api_dbs.is_api_exist_in('framework_header_apis', api['api_name'], api['class_name'], api['sdk'])
        if r:
            print 'api is public in public framework\tclass_name:%s\tapi_name:%s\tsdk version:%s ... %d/%d' % (api['class_name'], api['api_name'], api['sdk'], count, len_framework_dump_apis)
            pass
        else:
            print 'api is private in public framework\tclass_name:%s\tapi_name:%s\tsdk version:%s ... %d/%d' % (api['class_name'], api['api_name'], api['sdk'], count, len_framework_dump_apis)
            framework_dump_private_apis.append(api)

    #framework_dump_private_apis = framework_dump_private_apis + list(private_framework_apis)
    print 'count of private apis in Public Framework:', len(framework_dump_private_apis)
    print 'start group by...'
    framework_dump_private_apis = api_utils.deduplication_api_list(framework_dump_private_apis)
    print 'deduplication private api len:', len(framework_dump_private_apis)
    rst = api_dbs.insert_apis('private_apis', framework_dump_private_apis)
    print 'insert into db private_apis, len:', rst
    rst = api_dbs.insert_apis('framework_private_apis', framework_dump_private_apis)
    print 'insert into db framework_private_apis, len:', rst
def rebuild_framework_header_api(sdk, framework_folder):
    api_dbs.delete_apis_by_sdk('framework_header_apis', sdk)

    framework_header_apis = api_utils.framework_header_apis(
        sdk, framework_folder)

    return api_dbs.insert_apis('framework_header_apis', framework_header_apis)
def rebuild_dump_framework_api(sdk, framework_folder):
    api_dbs.delete_apis_by_sdk('framework_dump_apis', sdk)
    
    framework_dump_header_apis = api_utils.framework_dump_apis(sdk, framework_folder)
    #for api in framework_dump_header_apis:
    #    print api
    
    return api_dbs.insert_apis('framework_dump_apis', framework_dump_header_apis)
def rebuild_document_api(sdk, docset):
    #先删除对应的sdk document api数据
    # api_dbs.delete_apis_by_sdk('document_apis', sdk)
    # document_apis = api_utils.document_apis(sdk, docset, "('instp')")
    # print "%s 新增:" % ("document_apis")
    # print api_dbs.insert_apis('document_apis', document_apis)


    for build_type in config.build_type_list:
        if (build_type == "structdata"):
            print "111"
        table_name = "document_apis_type_%s" % (build_type)
        api_dbs.create_document_type_table(table_name)
        api_dbs.delete_apis_by_sdk(table_name, sdk)
        document_apis = api_utils.document_apis(sdk, docset, "('%s')" % (build_type))
        print "%s 新增:" % (table_name)
        print api_dbs.insert_apis(table_name, document_apis)
def rebuild_document_api(sdk, docset):
    #先删除对应的sdk document api数据
    # api_dbs.delete_apis_by_sdk('document_apis', sdk)
    # document_apis = api_utils.document_apis(sdk, docset, "('instp')")
    # print "%s 新增:" % ("document_apis")
    # print api_dbs.insert_apis('document_apis', document_apis)

    for build_type in config.build_type_list:
        if (build_type == "structdata"):
            print "111"
        table_name = "document_apis_type_%s" % (build_type)
        api_dbs.create_document_type_table(table_name)
        api_dbs.delete_apis_by_sdk(table_name, sdk)
        document_apis = api_utils.document_apis(sdk, docset,
                                                "('%s')" % (build_type))
        print "%s 新增:" % (table_name)
        print api_dbs.insert_apis(table_name, document_apis)
def rebuild_document_api(sdk, docset):
    #先删除对应的sdk document api数据
    api_dbs.delete_apis_by_sdk('document_apis', sdk)

    document_apis = api_utils.document_apis(sdk, docset)
    #for api in document_apis:
    #    print api

    return api_dbs.insert_apis('document_apis', document_apis)
def rebuild_document_api(sdk, docset):
    #先删除对应的sdk document api数据
    api_dbs.delete_apis_by_sdk('document_apis', sdk)
    
    document_apis = api_utils.document_apis(sdk, docset)
    #for api in document_apis:
    #    print api
        
    return api_dbs.insert_apis('document_apis', document_apis)
def rebuild_dump_private_framework_api(sdk, framework_folder):
    api_dbs.delete_apis_by_sdk('private_framework_dump_apis', sdk)
    
    pri_framework_dump_apis = api_utils.private_framework_dump_apis(sdk, framework_folder)
    pri_framework_dump_apis = api_utils.deduplication_api_list(pri_framework_dump_apis)
    #for api in pri_framework_dump_apis:
    #    print api
    
    return api_dbs.insert_apis('private_framework_dump_apis', pri_framework_dump_apis)
def rebuild_sdk_private_api(sdk_version):
    api_dbs.delete_apis_by_sdk('framework_private_apis', sdk_version['sdk'])
    api_dbs.delete_apis_by_sdk('private_apis', sdk_version['sdk'])
    #     print rebuild_framework_header_api(sdk_version['sdk'], sdk_version['framework'])
    #     print rebuild_dump_framework_api(sdk_version['sdk'], sdk_version['framework'])
    #     print rebuild_dump_private_framework_api(sdk_version['sdk'], sdk_version['private_framework'])

    #通过计算,获得私有api,并保存到数据库汇总
    #1. private_framework_api 转存到private表中
    private_framework_apis = api_dbs.get_private_framework_dump_apis(
        sdk_version['sdk'])

    print 'One private api. count: ', api_dbs.insert_apis(
        'private_apis', private_framework_apis)
    #2. framework_dump - framework_header
    #3. framework_dump中_开头的api
    framework_dump_private_apis = []
    framework_dump_apis = api_dbs.get_framework_dump_apis(sdk_version['sdk'])

    for api in framework_dump_apis:
        if api['api_name'] and api['api_name'][0:1] == '_':
            print 'api start with `_`'
            framework_dump_private_apis.append(api)
            continue
        #对于不以下划线开头的
        r = api_dbs.is_api_exist_in('framework_header_apis', api['api_name'],
                                    api['class_name'], api['sdk'])
        if r:
            print 'api is public in public framework'
            pass
        else:
            print 'api is private in public framework'
            framework_dump_private_apis.append(api)
    #framework_dump_private_apis = framework_dump_private_apis + list(private_framework_apis)
    print 'private api lengh:', len(framework_dump_private_apis)
    print 'start group by...'
    framework_dump_private_apis = api_utils.deduplication_api_list(
        framework_dump_private_apis)
    print 'deduplication private api len:', len(framework_dump_private_apis)
    rst = api_dbs.insert_apis('private_apis', framework_dump_private_apis)
    print 'insert into db framework_private_apis, len:', rst
    rst = api_dbs.insert_apis('framework_private_apis',
                              framework_dump_private_apis)
    print 'insert into db private_apis, len:', rst
def rebuild_dump_framework_api(sdk, framework_folder):
    api_dbs.delete_apis_by_sdk('framework_dump_apis', sdk)

    framework_dump_header_apis = api_utils.framework_dump_apis(
        sdk, framework_folder)
    #for api in framework_dump_header_apis:
    #    print api

    return api_dbs.insert_apis('framework_dump_apis',
                               framework_dump_header_apis)
def rebuild_dump_framework_api(sdk, framework_folder):
    """
    public framework dump apis
    set_A
    """
    api_dbs.delete_apis_by_sdk("framework_dump_apis", sdk)

    framework_dump_header_apis = api_utils.framework_dump_apis(sdk, framework_folder)
    # for api in framework_dump_header_apis:
    #    print api

    return api_dbs.insert_apis("framework_dump_apis", framework_dump_header_apis)
def rebuild_dump_private_framework_api(sdk, framework_folder):
    api_dbs.delete_apis_by_sdk('private_framework_dump_apis', sdk)

    pri_framework_dump_apis = api_utils.private_framework_dump_apis(
        sdk, framework_folder)
    pri_framework_dump_apis = api_utils.deduplication_api_list(
        pri_framework_dump_apis)
    #for api in pri_framework_dump_apis:
    #    print api

    return api_dbs.insert_apis('private_framework_dump_apis',
                               pri_framework_dump_apis)
def rebuild_framework_header_api(sdk, framework_folder):
    '''
    public framework header(.h) api
    set_B
    '''
    api_dbs.delete_apis_by_sdk('framework_header_apis', sdk)
    
    framework_header_apis = api_utils.framework_header_apis(sdk, framework_folder)
    #for api in framework_header_apis:
    #    print api
    
    return api_dbs.insert_apis('framework_header_apis', framework_header_apis)
Example #17
0
def rebuild_framework_header_api(sdk, framework_folder):
    '''
    public framework header(.h) api
    set_B
    '''
    api_dbs.delete_apis_by_sdk('framework_header_apis', sdk)

    framework_header_apis = api_utils.framework_header_apis(
        sdk, framework_folder)
    #for api in framework_header_apis:
    #    print api

    return api_dbs.insert_apis('framework_header_apis', framework_header_apis)
def rebuild_sdk_private_api(sdk_version):
    api_dbs.delete_apis_by_sdk('framework_private_apis', sdk_version['sdk'])
    api_dbs.delete_apis_by_sdk('private_apis', sdk_version['sdk'])
#     print rebuild_framework_header_api(sdk_version['sdk'], sdk_version['framework'])
#     print rebuild_dump_framework_api(sdk_version['sdk'], sdk_version['framework'])
#     print rebuild_dump_private_framework_api(sdk_version['sdk'], sdk_version['private_framework'])
    
    #通过计算,获得私有api,并保存到数据库汇总
    #1. private_framework_api 转存到private表中
    private_framework_apis = api_dbs.get_private_framework_dump_apis(sdk_version['sdk'])
    
    print 'One private api. count: ', api_dbs.insert_apis('private_apis', private_framework_apis)
    #2. framework_dump - framework_header
    #3. framework_dump中_开头的api
    framework_dump_private_apis = []
    framework_dump_apis = api_dbs.get_framework_dump_apis(sdk_version['sdk'])
    
    for api in framework_dump_apis:
        if api['api_name'] and api['api_name'][0:1] == '_':
            print 'api start with `_`'
            framework_dump_private_apis.append(api)
            continue
        #对于不以下划线开头的
        r = api_dbs.is_api_exist_in('framework_header_apis', api['api_name'], api['class_name'], api['sdk'])
        if r:
            print 'api is public in public framework'
            pass
        else:
            print 'api is private in public framework'
            framework_dump_private_apis.append(api)
    #framework_dump_private_apis = framework_dump_private_apis + list(private_framework_apis)
    print 'private api lengh:', len(framework_dump_private_apis)
    print 'start group by...'
    framework_dump_private_apis = api_utils.deduplication_api_list(framework_dump_private_apis)
    print 'deduplication private api len:', len(framework_dump_private_apis)
    rst = api_dbs.insert_apis('private_apis', framework_dump_private_apis)
    print 'insert into db framework_private_apis, len:', rst
    rst = api_dbs.insert_apis('framework_private_apis', framework_dump_private_apis)
    print 'insert into db private_apis, len:', rst
def rebuild_sdk_private_api(sdk_version):
    api_dbs.delete_apis_by_sdk('framework_private_apis', sdk_version['sdk'])
    api_dbs.delete_apis_by_sdk('private_apis', sdk_version['sdk'])

    print rebuild_framework_header_api(sdk_version['sdk'],
                                       sdk_version['framework'])
    print rebuild_dump_framework_api(sdk_version['sdk'],
                                     sdk_version['framework'])
    print rebuild_dump_private_framework_api(sdk_version['sdk'],
                                             sdk_version['private_framework'])

    #清理私有api最终结果库
    api_dbs.clean_table('private_apis')

    #通过计算,获得私有api,并保存到数据库汇总
    private_framework_apis = api_dbs.get_private_framework_dump_apis(
        sdk_version['sdk'])

    #1. private_framework_api 转存到private表中
    print 'One private api. count: ', api_dbs.insert_apis(
        'private_apis', private_framework_apis)

    #2. framework_dump - framework_header
    #3. framework_dump中_开头的api
    framework_dump_private_apis = []
    framework_dump_apis = api_dbs.get_framework_dump_apis(sdk_version['sdk'])

    len_framework_dump_apis = len(framework_dump_apis)
    for count in range(len_framework_dump_apis):
        api = framework_dump_apis[count]
        if api['api_name'] and api['api_name'][0:1] == '_':
            print 'api start with `_`\tclass_name:%s\tapi_name:%s\tsdk version:%s ... %d/%d' % (
                api['class_name'], api['api_name'], api['sdk'], count,
                len_framework_dump_apis)
            framework_dump_private_apis.append(api)
            continue
        #对于不以下划线开头的
        r = api_dbs.is_api_exist_in('framework_header_apis', api['api_name'],
                                    api['class_name'], api['sdk'])
        if r:
            print 'api is public in public framework\tclass_name:%s\tapi_name:%s\tsdk version:%s ... %d/%d' % (
                api['class_name'], api['api_name'], api['sdk'], count,
                len_framework_dump_apis)
            pass
        else:
            print 'api is private in public framework\tclass_name:%s\tapi_name:%s\tsdk version:%s ... %d/%d' % (
                api['class_name'], api['api_name'], api['sdk'], count,
                len_framework_dump_apis)
            framework_dump_private_apis.append(api)

    #framework_dump_private_apis = framework_dump_private_apis + list(private_framework_apis)
    print 'count of private apis in Public Framework:', len(
        framework_dump_private_apis)
    print 'start group by...'
    framework_dump_private_apis = api_utils.deduplication_api_list(
        framework_dump_private_apis)
    print 'deduplication private api len:', len(framework_dump_private_apis)
    rst = api_dbs.insert_apis('private_apis', framework_dump_private_apis)
    print 'insert into db private_apis, len:', rst
    rst = api_dbs.insert_apis('framework_private_apis',
                              framework_dump_private_apis)
    print 'insert into db framework_private_apis, len:', rst
def rebuild_framework_header_api(sdk, framework_folder):
    api_dbs.delete_apis_by_sdk('framework_header_apis', sdk)
    
    framework_header_apis = api_utils.framework_header_apis(sdk, framework_folder)
    
    return api_dbs.insert_apis('framework_header_apis', framework_header_apis)