Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
f48313d2
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
41
Star
4
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openEuler-Advisor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f48313d2
编写于
9月 03, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
9月 03, 2020
浏览文件
操作
浏览文件
下载
差异文件
!115 针对issue做出接口完善,修改对应的命令行数据处理方式,适应新回显内容,并同时修改对应的单元测试内容
Merge pull request !115 from tomtao/master
上级
ccb6f8fa
f713e6a0
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
332 addition
and
243 deletion
+332
-243
packageship/packageship/application/apps/package/function/build_depend.py
...ageship/application/apps/package/function/build_depend.py
+13
-9
packageship/packageship/application/apps/package/function/install_depend.py
...eship/application/apps/package/function/install_depend.py
+8
-4
packageship/packageship/application/apps/package/function/searchdb.py
...packageship/application/apps/package/function/searchdb.py
+40
-24
packageship/packageship/application/apps/package/function/self_depend.py
...kageship/application/apps/package/function/self_depend.py
+12
-8
packageship/packageship/application/apps/package/view.py
packageship/packageship/application/apps/package/view.py
+28
-8
packageship/packageship/pkgship.py
packageship/packageship/pkgship.py
+26
-8
packageship/test/common_files/conf.yaml
packageship/test/common_files/conf.yaml
+2
-2
packageship/test/common_files/correct_test_result_json/build_depend.json
...t/common_files/correct_test_result_json/build_depend.json
+68
-65
packageship/test/common_files/correct_test_result_json/install_depend.json
...common_files/correct_test_result_json/install_depend.json
+112
-103
packageship/test/common_files/correct_test_result_json/self_depend.json
...st/common_files/correct_test_result_json/self_depend.json
+18
-7
packageship/test/test_module/dependent_query_tests/test_install_depend.py
.../test_module/dependent_query_tests/test_install_depend.py
+3
-3
packageship/test/write_test.py
packageship/test/write_test.py
+2
-2
未找到文件。
packageship/packageship/application/apps/package/function/build_depend.py
浏览文件 @
f48313d2
...
...
@@ -19,6 +19,7 @@ class BuildDepend():
search_db:Query an instance of a database class
result_dict:A dictionary to store the data that needs to be echoed
source_dict:A dictionary to store the searched source code package name
not_found_components: Contain the package not found components
"""
def
__init__
(
self
,
pkg_name_list
,
db_list
,
self_build
=
0
,
history_dict
=
None
):
...
...
@@ -35,6 +36,7 @@ class BuildDepend():
self
.
source_dict
=
dict
()
self
.
history_dicts
=
history_dict
if
history_dict
else
{}
self
.
not_found_components
=
set
()
def
build_depend_main
(
self
):
"""
...
...
@@ -44,16 +46,17 @@ class BuildDepend():
ResponseCode: response code
result_dict: Dictionary of query results
source_dict: Dictionary of source code package
not_found_components: Set of package not found components
Raises:
"""
if
not
self
.
search_db
.
db_object_dict
:
return
ResponseCode
.
DIS_CONNECTION_DB
,
None
,
None
return
ResponseCode
.
DIS_CONNECTION_DB
,
None
,
None
,
set
()
if
self
.
_self_build
==
0
:
code
=
self
.
build_depend
(
self
.
pkg_name_list
)
if
None
in
self
.
result_dict
:
del
self
.
result_dict
[
None
]
return
code
,
self
.
result_dict
,
None
return
code
,
self
.
result_dict
,
None
,
self
.
not_found_components
if
self
.
_self_build
==
1
:
self
.
self_build
(
self
.
pkg_name_list
)
...
...
@@ -64,9 +67,9 @@ class BuildDepend():
# Here, a place holder is needed to prevent unpacking errors during call
# 2, This function is an auxiliary function of other modules.
# The status code is not the final display status code
return
ResponseCode
.
SUCCESS
,
self
.
result_dict
,
self
.
source_dict
return
ResponseCode
.
SUCCESS
,
self
.
result_dict
,
self
.
source_dict
,
self
.
not_found_components
return
ResponseCode
.
PARAM_ERROR
,
None
,
None
return
ResponseCode
.
PARAM_ERROR
,
None
,
None
,
set
()
def
build_depend
(
self
,
pkg_list
):
"""
...
...
@@ -77,8 +80,8 @@ class BuildDepend():
ResponseCode: response code
Raises:
"""
res_status
,
build_list
=
self
.
search_db
.
get_build_depend
(
pkg_list
)
res_status
,
build_list
,
not_fd_com_build
=
self
.
search_db
.
get_build_depend
(
pkg_list
)
self
.
not_found_components
.
update
(
not_fd_com_build
)
if
not
build_list
:
return
res_status
if
res_status
==
ResponseCode
.
DIS_CONNECTION_DB
else
\
ResponseCode
.
PACK_NAME_NOT_FOUND
...
...
@@ -86,9 +89,10 @@ class BuildDepend():
# create root node and get next search list
search_list
=
self
.
_create_node_and_get_search_list
(
build_list
,
pkg_list
)
code
,
res_dict
=
\
code
,
res_dict
,
not_fd_com_install
=
\
InstallDepend
(
self
.
db_list
).
query_install_depend
(
search_list
,
self
.
history_dicts
)
self
.
not_found_components
.
update
(
not_fd_com_install
)
if
not
res_dict
:
return
code
...
...
@@ -185,8 +189,8 @@ class BuildDepend():
return
next_src_set
=
set
()
_
,
bin_info_lis
=
self
.
search_db
.
get_build_depend
(
pkg_name_li
)
_
,
bin_info_lis
,
not_fd_com
=
self
.
search_db
.
get_build_depend
(
pkg_name_li
)
self
.
not_found_components
.
update
(
not_fd_com
)
if
not
bin_info_lis
:
return
...
...
packageship/packageship/application/apps/package/function/install_depend.py
浏览文件 @
f48313d2
...
...
@@ -20,6 +20,7 @@ class InstallDepend():
__search_list: Contain the binary packages searched in the next loop
binary_dict: Contain all the binary packages info and operation
__search_db: A object of database which would be connected
not_found_components: Contain the package not found components
changeLog:
"""
#pylint: disable = too-few-public-methods
...
...
@@ -32,6 +33,7 @@ class InstallDepend():
self
.
db_list
=
db_list
self
.
__search_db
=
SearchDB
(
db_list
)
self
.
not_found_components
=
set
()
def
query_install_depend
(
self
,
binary_list
,
history_dicts
=
None
):
"""
...
...
@@ -51,12 +53,13 @@ class InstallDepend():
'install'
]
]}
not_found_components:Set of package not found components
Raises:
"""
if
not
self
.
__search_db
.
db_object_dict
:
return
ResponseCode
.
DIS_CONNECTION_DB
,
None
return
ResponseCode
.
DIS_CONNECTION_DB
,
None
,
set
()
if
not
binary_list
:
return
ResponseCode
.
INPUT_NONE
,
None
return
ResponseCode
.
INPUT_NONE
,
None
,
set
()
for
binary
in
binary_list
:
if
binary
:
self
.
__search_list
.
append
(
binary
)
...
...
@@ -64,7 +67,7 @@ class InstallDepend():
LOGGER
.
logger
.
warning
(
"There is a NONE in input value:"
+
str
(
binary_list
))
while
self
.
__search_list
:
self
.
__query_single_install_dep
(
history_dicts
)
return
ResponseCode
.
SUCCESS
,
self
.
binary_dict
.
dictionary
return
ResponseCode
.
SUCCESS
,
self
.
binary_dict
.
dictionary
,
self
.
not_found_components
def
__query_single_install_dep
(
self
,
history_dicts
):
"""
...
...
@@ -75,7 +78,8 @@ class InstallDepend():
response_code: response code
Raises:
"""
result_list
=
set
(
self
.
__search_db
.
get_install_depend
(
self
.
__search_list
))
result_list
,
not_found_components
=
map
(
set
,
self
.
__search_db
.
get_install_depend
(
self
.
__search_list
))
self
.
not_found_components
.
update
(
not_found_components
)
for
search
in
self
.
__search_list
:
if
search
not
in
self
.
binary_dict
.
dictionary
:
self
.
binary_dict
.
init_key
(
key
=
search
,
parent_node
=
[])
...
...
packageship/packageship/application/apps/package/function/searchdb.py
浏览文件 @
f48313d2
...
...
@@ -58,7 +58,8 @@ class SearchDB():
Args:
binary_list: a list of binary package name
Returns:
install depend list
list:install depend list
set:package not found components
Raises:
"""
result_list
=
[]
...
...
@@ -128,7 +129,7 @@ class SearchDB():
install_result
=
self
.
_get_install_pro_in_other_database
(
provides_not_found
)
result_list
.
extend
(
install_result
)
return
result_list
return
result_list
,
set
(
provides_not_found
.
keys
())
else
:
continue
except
AttributeError
as
error_msg
:
...
...
@@ -141,7 +142,7 @@ class SearchDB():
for
binary_name
in
search_set
:
result_list
.
append
((
return_tuple
(
None
,
None
,
None
,
binary_name
,
None
,
None
),
'NOT FOUND'
))
return
result_list
return
result_list
,
set
(
provides_not_found
.
keys
())
def
get_src_name
(
self
,
binary_name
):
"""
...
...
@@ -181,6 +182,7 @@ class SearchDB():
Args:
source_name_list: search package's name, database preority list
Returns:
response code
result_list: subpack tuple
Raises:
AttributeError: The object does not have this property
...
...
@@ -196,18 +198,17 @@ class SearchDB():
return
ResponseCode
.
INPUT_NONE
,
None
for
db_name
,
data_base
in
self
.
db_object_dict
.
items
():
try
:
name_in
=
literal_column
(
'src_name'
).
in_
(
search_set
)
sql_com
=
text
(
'''SELECT
NAME AS subpack_name,
src_name AS search_name,
version AS search_version
name_in
=
literal_column
(
'name'
).
in_
(
search_set
)
sql_com
=
text
(
'''
SELECT
bin_pack.name AS subpack_name,
src.name AS search_name,
src.version AS search_version
FROM
bin_pack
WHERE
{}
'''
.
format
(
name_in
))
(SELECT name,version FROM src_pack WHERE {}) src
LEFT JOIN bin_pack on src.name = bin_pack.src_name'''
.
format
(
name_in
))
subpack_tuple
=
data_base
.
session
.
\
execute
(
sql_com
,
{
'
src_
name_{}'
.
format
(
i
):
v
execute
(
sql_com
,
{
'name_{}'
.
format
(
i
):
v
for
i
,
v
in
enumerate
(
search_set
,
1
)}).
fetchall
()
if
subpack_tuple
:
for
result
in
subpack_tuple
:
...
...
@@ -226,8 +227,6 @@ class SearchDB():
return_tuple
=
namedtuple
(
'return_tuple'
,
'subpack_name search_version search_name'
)
for
search_name
in
search_set
:
# LOGGER.logger.warning("Can't not find " +
# search_name + " subpack in all database")
result_list
.
append
(
(
return_tuple
(
None
,
None
,
search_name
),
'NOT_FOUND'
))
return
ResponseCode
.
SUCCESS
,
result_list
...
...
@@ -310,8 +309,16 @@ class SearchDB():
if
not_found_binary
:
for
key
,
values
in
not_found_binary
.
items
():
LOGGER
.
logger
.
warning
(
"CANNOT FOUND THE component"
+
key
+
" in all database"
)
for
info
in
values
:
obj
=
return_tuple
(
info
[
0
],
None
,
None
,
None
,
'NOT FOUND'
,
info
[
2
]
)
result_list
.
append
(
obj
)
return
result_list
def
_get_install_pro_in_other_database
(
self
,
not_found_binary
):
...
...
@@ -362,9 +369,18 @@ class SearchDB():
del
not_found_binary
[
result
.
req_name
]
if
not
not_found_binary
:
return
result_list
# if not_found_binary:
# for key, values in not_found_binary.items():
# LOGGER.logger.warning("CANNOT FOUND THE component" + key + " in all database")
if
not_found_binary
:
for
key
,
values
in
not_found_binary
.
items
():
for
info
in
values
:
obj
=
return_tuple
(
None
,
None
,
None
,
info
[
0
],
info
[
1
],
info
[
2
]
)
result_list
.
append
((
obj
,
info
[
3
]))
return
result_list
def
get_build_depend
(
self
,
source_name_li
):
...
...
@@ -376,7 +392,7 @@ class SearchDB():
all source pkg build depend list
structure :[(search_name,source_name,bin_name,bin_version,db_name,search_version),
(search_name,source_name,bin_name,bin_version,db_name,search_version),]
set: package not found components name set
Raises:
AttributeError: The object does not have this property
SQLAlchemyError: sqlalchemy error
...
...
@@ -393,7 +409,7 @@ class SearchDB():
s_name_set
=
set
(
source_name_li
)
if
not
s_name_set
:
return
ResponseCode
.
PARAM_ERROR
,
None
return
ResponseCode
.
PARAM_ERROR
,
set
()
provides_not_found
=
dict
()
build_list
=
[]
...
...
@@ -465,7 +481,7 @@ class SearchDB():
build_result
=
self
.
_get_binary_in_other_database
(
provides_not_found
)
build_list
.
extend
(
build_result
)
return
ResponseCode
.
SUCCESS
,
build_list
return
ResponseCode
.
SUCCESS
,
build_list
,
set
(
provides_not_found
.
keys
())
if
s_name_set
:
build_result
=
self
.
_get_binary_in_other_database
(
...
...
@@ -474,7 +490,7 @@ class SearchDB():
for
source
in
s_name_set
:
LOGGER
.
logger
.
warning
(
"CANNOT FOUND THE source "
+
source
+
" in all database"
)
return
ResponseCode
.
SUCCESS
,
build_list
return
ResponseCode
.
SUCCESS
,
build_list
,
set
(
provides_not_found
.
keys
())
def
binary_search_database_for_first_time
(
self
,
binary_name
):
"""
...
...
packageship/packageship/application/apps/package/function/self_depend.py
浏览文件 @
f48313d2
...
...
@@ -33,6 +33,7 @@ class SelfDepend():
search_subpack_list: Contain the source packages searched subpack in the next loop
withsubpack: withsubpack
search_db: A object of database which would be connected
not_found_components: Contain the package not found components
"""
def
__init__
(
self
,
db_list
):
"""
...
...
@@ -47,6 +48,7 @@ class SelfDepend():
self
.
withsubpack
=
0
self
.
db_list
=
db_list
self
.
search_db
=
SearchDB
(
db_list
)
self
.
not_found_components
=
set
()
def
query_depend
(
self
,
packname
,
selfbuild
,
withsubpack
,
packtype
=
'binary'
):
"""
...
...
@@ -59,17 +61,18 @@ class SelfDepend():
Returns:
binary_dict.dictionary: Contain all the binary packages info after searching
source_dicts.dictionary: Contain all the source packages info after searching
not_found_components :Set of package not found components
Raises:
"""
if
not
self
.
search_db
.
db_object_dict
:
return
ResponseCode
.
DIS_CONNECTION_DB
,
None
,
None
return
ResponseCode
.
DIS_CONNECTION_DB
,
None
,
None
,
set
()
if
not
packname
:
return
ResponseCode
.
INPUT_NONE
self
.
withsubpack
=
withsubpack
response_code
=
self
.
init_dict
(
packname
,
packtype
)
if
response_code
!=
ResponseCode
.
SUCCESS
:
return
response_code
,
self
.
binary_dict
.
dictionary
,
self
.
source_dicts
.
dictionary
return
response_code
,
self
.
binary_dict
.
dictionary
,
self
.
source_dicts
.
dictionary
,
self
.
not_found_components
for
key
,
_
in
self
.
binary_dict
.
dictionary
.
items
():
self
.
search_install_list
.
append
(
key
)
...
...
@@ -85,7 +88,7 @@ class SelfDepend():
self
.
with_subpack
()
if
self
.
search_build_list
:
self
.
query_build
(
selfbuild
)
return
response_code
,
self
.
binary_dict
.
dictionary
,
self
.
source_dicts
.
dictionary
return
response_code
,
self
.
binary_dict
.
dictionary
,
self
.
source_dicts
.
dictionary
,
self
.
not_found_components
def
init_dict
(
self
,
packname
,
packtype
):
"""
...
...
@@ -130,9 +133,10 @@ class SelfDepend():
Raises:
"""
self
.
result_tmp
.
clear
()
_
,
self
.
result_tmp
=
\
_
,
self
.
result_tmp
,
not_fd_com
=
\
install_depend
(
self
.
db_list
).
query_install_depend
(
self
.
search_install_list
,
self
.
binary_dict
.
dictionary
)
self
.
not_found_components
.
update
(
not_fd_com
)
self
.
search_install_list
.
clear
()
for
key
,
values
in
self
.
result_tmp
.
items
():
if
key
in
self
.
binary_dict
.
dictionary
:
...
...
@@ -199,13 +203,13 @@ class SelfDepend():
Returns:
Raises:
"""
_
,
self
.
result_tmp
,
_
=
build_depend
(
_
,
self
.
result_tmp
,
_
,
not_fd_com
=
build_depend
(
self
.
search_build_list
,
self
.
db_list
,
self_build
=
0
,
history_dict
=
self
.
binary_dict
.
dictionary
).
build_depend_main
()
self
.
not_found_components
.
update
(
not_fd_com
)
self
.
search_build_list
.
clear
()
for
key
,
values
in
self
.
result_tmp
.
items
():
if
not
key
:
...
...
@@ -231,13 +235,13 @@ class SelfDepend():
Args:
Returns:
"""
_
,
self
.
result_tmp
,
source_dicts_tmp
=
build_depend
(
_
,
self
.
result_tmp
,
source_dicts_tmp
,
not_fd_com
=
build_depend
(
self
.
search_build_list
,
self
.
db_list
,
self_build
=
1
,
history_dict
=
self
.
source_dicts
.
dictionary
).
build_depend_main
()
self
.
not_found_components
.
update
(
not_fd_com
)
for
key
,
values
in
self
.
result_tmp
.
items
():
if
not
key
:
LOGGER
.
logger
.
warning
(
"key is NONE for value = "
+
str
(
values
))
...
...
packageship/packageship/application/apps/package/view.py
浏览文件 @
f48313d2
...
...
@@ -38,7 +38,9 @@ from .serialize import SelfDependSchema
from
.serialize
import
have_err_db_name
LOGGER
=
Log
(
__name__
)
#pylint: disable = no-self-use
# pylint: disable = no-self-use
class
Packages
(
Resource
):
...
...
@@ -215,16 +217,22 @@ class InstallDepend(Resource):
ResponseCode
.
response_json
(
ResponseCode
.
DB_NAME_ERROR
)
)
response_code
,
install_dict
=
\
response_code
,
install_dict
,
not_found_components
=
\
installdepend
(
db_list
).
query_install_depend
([
pkg_name
])
if
not
install_dict
:
return
jsonify
(
ResponseCode
.
response_json
(
response_code
)
)
elif
len
(
install_dict
)
==
1
and
install_dict
.
get
(
pkg_name
)[
2
]
==
'NOT FOUND'
:
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
PACK_NAME_NOT_FOUND
)
)
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
SUCCESS
,
data
=
install_dict
)
ResponseCode
.
response_json
(
ResponseCode
.
SUCCESS
,
data
=
{
"install_dict"
:
install_dict
,
'not_found_components'
:
list
(
not_found_components
)
})
)
...
...
@@ -282,12 +290,23 @@ class BuildDepend(Resource):
build_ins
=
builddepend
([
pkg_name
],
db_list
)
res_code
,
res_dict
,
_
=
build_ins
.
build_depend_main
()
res_code
,
res_dict
,
_
,
not_found_com
=
build_ins
.
build_depend_main
()
if
res_dict
:
res_code
=
ResponseCode
.
SUCCESS
else
:
return
jsonify
(
ResponseCode
.
response_json
(
res_code
)
)
return
jsonify
(
ResponseCode
.
response_json
(
res_code
,
data
=
res_dict
if
res_dict
else
None
data
=
{
'build_dict'
:
res_dict
,
'not_found_components'
:
list
(
not_found_com
)
}
)
)
...
...
@@ -350,7 +369,7 @@ class SelfDepend(Resource):
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
DB_NAME_ERROR
)
)
response_code
,
binary_dicts
,
source_dicts
=
\
response_code
,
binary_dicts
,
source_dicts
,
not_fd_components
=
\
self_depend
(
db_list
).
query_depend
(
pkg_name
,
int
(
self_build
),
int
(
with_sub_pack
),
pack_type
)
...
...
@@ -362,7 +381,8 @@ class SelfDepend(Resource):
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
SUCCESS
,
data
=
{
"binary_dicts"
:
binary_dicts
,
"source_dicts"
:
source_dicts
"source_dicts"
:
source_dicts
,
"not_found_components"
:
list
(
not_fd_components
)
})
)
...
...
packageship/packageship/pkgship.py
浏览文件 @
f48313d2
...
...
@@ -10,6 +10,7 @@ import os
import
json
import
threading
from
json.decoder
import
JSONDecodeError
try
:
import
argparse
import
requests
...
...
@@ -209,11 +210,12 @@ class PkgshipCommand(BaseCommand):
except
Error
:
print
(
'command error'
)
def
parse_depend_package
(
self
,
response_data
):
def
parse_depend_package
(
self
,
response_data
,
params
=
None
):
"""
Description: Parsing package data with dependencies
Args:
response_data: http request response content
params: Parameters passed in on the command line
Returns:
Summarized data table
Raises:
...
...
@@ -224,6 +226,12 @@ class PkgshipCommand(BaseCommand):
if
response_data
.
get
(
'code'
)
==
ResponseCode
.
SUCCESS
:
package_all
=
response_data
.
get
(
'data'
)
if
isinstance
(
package_all
,
dict
):
if
params
:
if
package_all
.
get
(
"not_found_components"
):
print
(
"Problem: Not Found Components"
)
for
not_found_com
in
package_all
.
get
(
"not_found_components"
):
print
(
" - nothing provides {} needed by {} "
.
format
(
not_found_com
,
params
.
packagename
))
package_all
=
package_all
.
get
(
"build_dict"
)
for
bin_package
,
package_depend
in
package_all
.
items
():
# distinguish whether the current data is the data of the root node
...
...
@@ -753,7 +761,7 @@ class BuildDepCommand(PkgshipCommand):
if
response
.
status_code
==
200
:
try
:
statistics_table
=
self
.
parse_depend_package
(
json
.
loads
(
response
.
text
))
json
.
loads
(
response
.
text
)
,
params
)
except
JSONDecodeError
as
json_error
:
LOGGER
.
logger
.
error
(
json_error
)
print
(
response
.
text
)
...
...
@@ -813,11 +821,12 @@ class InstallDepCommand(PkgshipCommand):
cmd_params
[
0
],
nargs
=
'*'
,
default
=
None
,
help
=
cmd_params
[
1
])
self
.
parse
.
set_defaults
(
func
=
self
.
do_command
)
def
__parse_package
(
self
,
response_data
):
def
__parse_package
(
self
,
response_data
,
params
):
"""
Description: Parse the corresponding data of the package
Args:
response_data: http response data
params: Parameters passed in on the command line
Returns:
Raises:
...
...
@@ -832,7 +841,11 @@ class InstallDepCommand(PkgshipCommand):
if
response_data
.
get
(
'code'
)
==
ResponseCode
.
SUCCESS
:
package_all
=
response_data
.
get
(
'data'
)
if
isinstance
(
package_all
,
dict
):
for
bin_package
,
package_depend
in
package_all
.
items
():
if
package_all
.
get
(
"not_found_components"
):
print
(
"Problem: Not Found Components"
)
for
not_found_com
in
package_all
.
get
(
"not_found_components"
):
print
(
" - nothing provides {} needed by {} "
.
format
(
not_found_com
,
params
.
packagename
))
for
bin_package
,
package_depend
in
package_all
.
get
(
"install_dict"
).
items
():
# distinguish whether the current data is the data of the root node
if
isinstance
(
package_depend
,
list
)
and
package_depend
[
-
1
][
0
][
0
]
!=
'root'
:
...
...
@@ -895,13 +908,13 @@ class InstallDepCommand(PkgshipCommand):
if
response
.
status_code
==
200
:
try
:
statistics_table
=
self
.
__parse_package
(
json
.
loads
(
response
.
text
))
json
.
loads
(
response
.
text
)
,
params
)
except
JSONDecodeError
as
json_error
:
LOGGER
.
logger
.
error
(
json_error
)
print
(
response
.
text
)
else
:
if
getattr
(
self
.
table
,
'rowcount'
):
self
.
print_
(
'query{} InstallDepend result display:'
.
format
(
self
.
print_
(
'query
{} InstallDepend result display:'
.
format
(
params
.
packagename
))
print
(
self
.
table
)
self
.
print_
(
'statistics'
)
...
...
@@ -1034,11 +1047,12 @@ class SelfBuildCommand(PkgshipCommand):
return
src_package_count
def
__parse_package
(
self
,
response_data
):
def
__parse_package
(
self
,
response_data
,
params
):
"""
Description: Parse the corresponding data of the package
Args:
response_data: http response data
params: Parameters passed in on the command line
Returns:
Summarized data table
Raises:
...
...
@@ -1053,6 +1067,10 @@ class SelfBuildCommand(PkgshipCommand):
package_all
=
response_data
.
get
(
'data'
)
if
isinstance
(
package_all
,
dict
):
# Parsing binary result data
if
package_all
.
get
(
"not_found_components"
):
print
(
"Problem: Not Found Components"
)
for
not_found_com
in
package_all
.
get
(
"not_found_components"
):
print
(
" - nothing provides {} needed by {} "
.
format
(
not_found_com
,
params
.
packagename
))
bin_package_count
=
self
.
_parse_bin_package
(
package_all
.
get
(
'binary_dicts'
))
...
...
@@ -1096,7 +1114,7 @@ class SelfBuildCommand(PkgshipCommand):
if
response
.
status_code
==
200
:
try
:
statistics_table
=
self
.
__parse_package
(
json
.
loads
(
response
.
text
))
json
.
loads
(
response
.
text
)
,
params
)
except
JSONDecodeError
as
json_error
:
LOGGER
.
logger
.
error
(
json_error
)
print
(
response
.
text
)
...
...
packageship/test/common_files/conf.yaml
浏览文件 @
f48313d2
...
...
@@ -2,9 +2,9 @@
dbname
:
mainline
priority
:
1
src_db_file
:
status
:
enable
lifecycle
:
enable
-
bin_db_file
:
dbname
:
fedora30
priority
:
2
src_db_file
:
status
:
enable
lifecycle
:
enable
packageship/test/common_files/correct_test_result_json/build_depend.json
浏览文件 @
f48313d2
...
...
@@ -6,84 +6,87 @@
"output"
:
{
"code"
:
"2001"
,
"data"
:
{
"
A_src"
:
[
"
source"
,
"0.0.23b
"
,
"mainline
"
,
[
"
build_dict"
:
{
"
A_src"
:
[
"source
"
,
"0.0.23b
"
,
"mainline"
,
[
"root"
,
null
[
"root"
,
null
]
]
]
],
"B1"
:
[
"B"
,
"0.0.2"
,
"mainline"
,
[
],
"B1"
:
[
"B"
,
"0.0.2"
,
"mainline"
,
[
"A"
,
"build"
[
"A"
,
"build"
]
]
]
],
"C1"
:
[
"C"
,
"0.1"
,
"mainline"
,
[
],
"C1"
:
[
"C"
,
"0.1"
,
"mainline"
,
[
"A"
,
"build"
],
[
"A2"
,
"install"
[
"A"
,
"build"
],
[
"A2"
,
"install"
]
]
]
],
"A1"
:
[
"A"
,
"0.0.23b"
,
"mainline"
,
[
],
"A1"
:
[
"A"
,
"0.0.23b"
,
"mainline"
,
[
"B1"
,
"install"
],
[
"D1"
,
"install"
[
"B1"
,
"install"
],
[
"D1"
,
"install"
]
]
]
],
"A2"
:
[
"A"
,
"0.0.23b"
,
"mainline"
,
[
],
"A2"
:
[
"A"
,
"0.0.23b"
,
"mainline"
,
[
"A1"
,
"install"
],
[
"C1"
,
"install"
[
"A1"
,
"install"
],
[
"C1"
,
"install"
]
]
]
],
"D1"
:
[
"D"
,
"0.11"
,
"mainline"
,
[
],
"D1"
:
[
"D"
,
"0.11"
,
"mainline"
,
[
"A2"
,
"install"
[
"A2"
,
"install"
]
]
]
]
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
packageship/test/common_files/correct_test_result_json/install_depend.json
浏览文件 @
f48313d2
...
...
@@ -6,58 +6,61 @@
"output"
:
{
"code"
:
"2001"
,
"data"
:
{
"
A1"
:
[
"A
"
,
"0.0.23b
"
,
"mainline
"
,
[
"
install_dict"
:
{
"A
1"
:
[
"A
"
,
"0.0.23b
"
,
"mainline"
,
[
"root"
,
null
],
[
"D1"
,
"install"
[
"root"
,
null
],
[
"D1"
,
"install"
]
]
]
],
"A2"
:
[
"A"
,
"0.0.23b"
,
"mainline"
,
[
[
"A1"
,
"install"
],
],
"A2"
:
[
"A"
,
"0.0.23b"
,
"mainline"
,
[
"C1"
,
"install"
[
"A1"
,
"install"
],
[
"C1"
,
"install"
]
]
]
],
"C1"
:
[
"C"
,
"0.1"
,
"mainline"
,
[
],
"C1"
:
[
"C"
,
"0.1"
,
"mainline"
,
[
"A2"
,
"install"
[
"A2"
,
"install"
]
]
]
],
"D1"
:
[
"D"
,
"0.11"
,
"mainline"
,
[
],
"D1"
:
[
"D"
,
"0.11"
,
"mainline"
,
[
"A2"
,
"install"
[
"A2"
,
"install"
]
]
]
]
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
@@ -69,69 +72,72 @@
"output"
:
{
"code"
:
"2001"
,
"data"
:
{
"
A1"
:
[
"A
"
,
"0.0.23b
"
,
"mainline
"
,
[
"
install_dict"
:
{
"A
1"
:
[
"A
"
,
"0.0.23b
"
,
"mainline"
,
[
"D1"
,
"install"
[
"D1"
,
"install"
]
]
]
],
"A2"
:
[
"A"
,
"0.0.23b"
,
"mainline"
,
[
],
"A2"
:
[
"A"
,
"0.0.23b"
,
"mainline"
,
[
"A1"
,
"install"
],
[
"C1"
,
"install"
[
"A1"
,
"install"
],
[
"C1"
,
"install"
]
]
]
],
"C1"
:
[
"C"
,
"0.1"
,
"mainline"
,
[
],
"C1"
:
[
"C"
,
"0.1"
,
"mainline"
,
[
"A2"
,
"install"
[
"A2"
,
"install"
]
]
]
],
"D1"
:
[
"D"
,
"0.11"
,
"mainline"
,
[
],
"D1"
:
[
"D"
,
"0.11"
,
"mainline"
,
[
"D2"
,
"install"
],
[
"A2"
,
"install"
[
"D2"
,
"install"
],
[
"A2"
,
"install"
]
]
]
],
"D2"
:
[
"D"
,
"0.11"
,
"mainline"
,
[
],
"D2"
:
[
"D"
,
"0.11"
,
"mainline"
,
[
"root"
,
null
[
"root"
,
null
]
]
]
]
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
@@ -143,17 +149,20 @@
"output"
:
{
"code"
:
"2001"
,
"data"
:
{
"
C2"
:
[
"C
"
,
"0.1
"
,
"mainline
"
,
[
"
install_dict"
:
{
"C
2"
:
[
"C
"
,
"0.1
"
,
"mainline"
,
[
"root"
,
null
[
"root"
,
null
]
]
]
]
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
packageship/test/common_files/correct_test_result_json/self_depend.json
浏览文件 @
f48313d2
...
...
@@ -123,7 +123,8 @@
"mainline"
,
"0.11"
]
}
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
@@ -264,7 +265,8 @@
"mainline"
,
"0.11"
]
}
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
@@ -421,7 +423,8 @@
"mainline"
,
"0.11"
]
}
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
@@ -583,7 +586,9 @@
"mainline"
,
"0.11"
]
}
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
@@ -753,7 +758,9 @@
"mainline"
,
"0.11"
]
}
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
@@ -892,7 +899,9 @@
"mainline"
,
"0.11"
]
}
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
@@ -1036,7 +1045,9 @@
"mainline"
,
"0.11"
]
}
},
"not_found_components"
:
[]
},
"msg"
:
"Successful Operation!"
}
...
...
packageship/test/test_module/dependent_query_tests/test_install_depend.py
浏览文件 @
f48313d2
...
...
@@ -89,17 +89,17 @@ class TestInstallDepend(ReadTestBase):
resp_dict
=
json
.
loads
(
resp
.
data
)
self
.
assertIn
(
"code"
,
resp_dict
,
msg
=
"Error in data format return"
)
self
.
assertEqual
(
ResponseCode
.
SUCCESS
,
self
.
assertEqual
(
ResponseCode
.
PACK_NAME_NOT_FOUND
,
resp_dict
.
get
(
"code"
),
msg
=
"Error in status code return"
)
self
.
assertIn
(
"msg"
,
resp_dict
,
msg
=
"Error in data format return"
)
self
.
assertEqual
(
ResponseCode
.
CODE_MSG_MAP
.
get
(
ResponseCode
.
SUCCESS
),
self
.
assertEqual
(
ResponseCode
.
CODE_MSG_MAP
.
get
(
ResponseCode
.
PACK_NAME_NOT_FOUND
),
resp_dict
.
get
(
"msg"
),
msg
=
"Error in status prompt return"
)
self
.
assertIn
(
"data"
,
resp_dict
,
msg
=
"Error in data format return"
)
self
.
assertIsNo
tNo
ne
(
resp_dict
.
get
(
"data"
),
msg
=
"Error in data information return"
)
self
.
assertIsNone
(
resp_dict
.
get
(
"data"
),
msg
=
"Error in data information return"
)
resp
=
self
.
client
.
post
(
"/packages/findInstallDepend"
,
data
=
json
.
dumps
({
"binaryName"
:
"A1"
,
...
...
packageship/test/write_test.py
浏览文件 @
f48313d2
...
...
@@ -19,8 +19,8 @@ def write_data_tests():
suite
=
unittest
.
TestSuite
()
classes
=
[
#
TestDeleteRepodatas,
#
TestBatchUpdatePackage,
TestDeleteRepodatas
,
TestBatchUpdatePackage
,
TestIssueCatch
]
for
cls
in
classes
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录