Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
82579b66
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
31
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82579b66
编写于
7月 15, 2020
作者:
G
gongzt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
When importing data, add maintainer information
上级
71771972
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
42 deletion
+55
-42
packageship/packageship/application/initsystem/data_import.py
...ageship/packageship/application/initsystem/data_import.py
+53
-42
packageship/packageship/application/models/package.py
packageship/packageship/application/models/package.py
+2
-0
未找到文件。
packageship/packageship/application/initsystem/data_import.py
浏览文件 @
82579b66
...
...
@@ -29,6 +29,7 @@ class InitDataBase():
"""
Description: Database initialization, generate multiple databases and data
based on configuration files
Attributes:
config_file_path: configuration file path
config_file_datas: initialize the configuration content of the database
...
...
@@ -38,6 +39,7 @@ class InitDataBase():
def
__init__
(
self
,
config_file_path
=
None
):
"""
Description: Class instance initialization
Args:
config_file_path: Configuration file path
"""
...
...
@@ -62,10 +64,8 @@ class InitDataBase():
def
__read_config_file
(
self
):
"""
Description: Read the contents of the configuration file load each
node data in the yaml configuration file as
a list to return
Args:
Read the contents of the configuration file load each
node data in the yaml configuration file as a list to return
Returns:
Initialize the contents of the database configuration file
...
...
@@ -93,10 +93,7 @@ class InitDataBase():
def
init_data
(
self
):
"""
Description: Initialization of the database
Args:
Returns:
Initialization of the database
Raises:
IOError: An error occurred while deleting the database information file
...
...
@@ -139,7 +136,8 @@ class InitDataBase():
def
_create_database
(
self
,
database
):
"""
Description: create related databases
create related databases
Args:
database: Initialize the configuration content of the database
Returns:
...
...
@@ -168,7 +166,8 @@ class InitDataBase():
def
_init_data
(
self
,
database
):
"""
Description: data initialization operation
data initialization operation
Args:
database: Initialize the configuration content of the database
Returns:
...
...
@@ -203,7 +202,6 @@ class InitDataBase():
database
.
get
(
'dbname'
))
else
:
self
.
_sqlite_db
.
drop_database
()
except
(
IOError
,
Error
)
as
exception_msg
:
LOGGER
.
logger
.
error
(
exception_msg
)
else
:
...
...
@@ -219,11 +217,11 @@ class InitDataBase():
@
staticmethod
def
__columns
(
cursor
):
"""
Description: functional description:Returns all the column names
queried by the current cursor
functional description:Returns all the column names
queried by the current cursor
Args:
cursor: Cursor
Returns:
The first columns
Raises:
...
...
@@ -255,7 +253,8 @@ class InitDataBase():
def
__save_data
(
self
,
src_db_file
,
bin_db_file
,
db_name
):
"""
Description: integration of multiple data files
integration of multiple data files
Args:
src_package_paths: Source package database file
bin_package_paths: Binary package database file
...
...
@@ -296,7 +295,12 @@ class InitDataBase():
if
packages_datas
is
None
:
raise
ContentNoneException
(
'{db_name}:There is no relevant data in the source
\
package provided'
.
format
(
db_name
=
db_name
))
package provided '
.
format
(
db_name
=
db_name
))
for
index
,
src_package_item
in
enumerate
(
packages_datas
):
maintaniner
,
maintainlevel
=
self
.
_get_mainter_info
(
src_package_item
.
get
(
'name'
),
src_package_item
.
get
(
'version'
))
packages_datas
[
index
][
'maintaniner'
]
=
maintaniner
packages_datas
[
index
][
'maintainlevel'
]
=
maintainlevel
try
:
with
DBHelper
(
db_name
=
db_name
)
as
database
:
database
.
batch_add
(
packages_datas
,
src_pack
)
...
...
@@ -305,9 +309,10 @@ class InitDataBase():
def
_save_src_requires
(
self
,
db_name
):
"""
Save the dependent package data of the source package
Args:
db_name:Name database
Returns:
Raises:
...
...
@@ -329,8 +334,9 @@ class InitDataBase():
def
_save_bin_packages
(
self
,
db_name
):
"""
Save binary package data
Args:
Args:
db_name:Name database
Returns:
Raises:
...
...
@@ -359,9 +365,10 @@ class InitDataBase():
def
_save_bin_requires
(
self
,
db_name
):
"""
Save the dependent package data of the binary package
Args:
db_name:Name database
Returns:
Raises:
...
...
@@ -381,9 +388,10 @@ class InitDataBase():
def
_save_bin_provides
(
self
,
db_name
):
"""
Save the component data provided by the binary package
Args:
db_name:Name database
Returns:
Raises:
...
...
@@ -404,7 +412,6 @@ class InitDataBase():
def
_get_maintenance_info
(
self
):
"""
Description: Obtain the information of the maintainer
Args:
Returns:
Maintainer related information
...
...
@@ -446,12 +453,13 @@ class InitDataBase():
maintaniner
=
(
maintenance_item
.
get
(
'maintaniner'
),
maintenance_item
.
get
(
'maintainlevel'
))
break
if
maintaniner
is
None
:
maintaniner
=
(
None
,
None
)
return
maintaniner
def
__exists_repeat_database
(
self
):
"""
Description: Determine if the same database name exists
Args:
Determine if the same database name exists
Returns:
True if there are duplicate databases, false otherwise
...
...
@@ -469,7 +477,8 @@ class InitDataBase():
@
staticmethod
def
__updata_settings_file
(
**
Kwargs
):
"""
Description: update some configuration files related to the database in the system
update some configuration files related to the database in the system
Args:
**Kwargs: data related to configuration file nodes
database_name: Name database
...
...
@@ -498,7 +507,8 @@ class InitDataBase():
@
staticmethod
def
delete_settings_file
():
"""
Description: Delete the configuration file of the database
Delete the configuration file of the database
Args:
Returns:
...
...
@@ -518,7 +528,8 @@ class InitDataBase():
def
delete_db
(
self
,
db_name
):
"""
Description: elete the database
delete the database
Args:
db_name: The name of the database
Returns:
...
...
@@ -553,7 +564,8 @@ class InitDataBase():
class
MysqlDatabaseOperations
():
"""
Description: Related to database operations, creating databases, creating tables
Related to database operations, creating databases, creating tables
Attributes:
db_name: The name of the database
create_database_sql: SQL statement to create a database
...
...
@@ -562,7 +574,8 @@ class MysqlDatabaseOperations():
def
__init__
(
self
,
db_name
,
tables
=
None
,
is_datum
=
False
):
"""
Description: Class instance initialization
Class instance initialization
Args:
db_name: Database name
"""
...
...
@@ -576,8 +589,7 @@ class MysqlDatabaseOperations():
def
create_database
(
self
):
"""
Description: create a database
Args:
create a mysql database
Returns:
True if successful, otherwise false
...
...
@@ -602,7 +614,8 @@ class MysqlDatabaseOperations():
@
classmethod
def
drop_database
(
cls
,
db_name
):
"""
Description: Delete the database according to the specified name
Delete the database according to the specified name
Args:
db_name: The name of the database to be deleted
Returns:
...
...
@@ -626,8 +639,7 @@ class MysqlDatabaseOperations():
def
__create_tables
(
self
):
"""
Description: Create the specified data table
Args:
Create the specified data table
Returns:
True if successful, otherwise false
...
...
@@ -648,7 +660,8 @@ class MysqlDatabaseOperations():
class
SqliteDatabaseOperations
():
"""
Description: sqlite database related operations
sqlite database related operations
Attributes:
db_name: Name database
database_file_folder: Database folder path
...
...
@@ -656,7 +669,8 @@ class SqliteDatabaseOperations():
def
__init__
(
self
,
db_name
,
tables
=
None
,
is_datum
=
False
,
**
kwargs
):
"""
Description: Class instance initialization
Class instance initialization
Args:
db_name: Database name
kwargs: data related to configuration file nodes
...
...
@@ -672,8 +686,8 @@ class SqliteDatabaseOperations():
def
_database_file_path
(
self
):
"""
D
escription: D
atabase file path
Args:
Database file path
Returns:
Raises:
...
...
@@ -693,8 +707,7 @@ class SqliteDatabaseOperations():
def
create_database
(
self
):
"""
Description: create sqlite database and table
Args:
create sqlite database and table
Returns:
After successful generation, return the database file address,
...
...
@@ -725,15 +738,13 @@ class SqliteDatabaseOperations():
def
drop_database
(
self
):
"""
Description: Delete the specified sqlite database
Args:
Delete the specified sqlite database
Returns:
Return true after successful deletion, otherwise return false
Raises:
IOError: An io exception occurred while deleting the specified database file
"""
try
:
db_path
=
os
.
path
.
join
(
self
.
database_file_folder
,
self
.
db_name
+
'.db'
)
...
...
packageship/packageship/application/models/package.py
浏览文件 @
82579b66
...
...
@@ -39,6 +39,8 @@ class src_pack(DBHelper.BASE): # pylint: disable=C0103,R0903
location_href
=
Column
(
String
(
500
),
nullable
=
True
)
location_base
=
Column
(
String
(
500
),
nullable
=
True
)
checksum_type
=
Column
(
String
(
500
),
nullable
=
True
)
maintaniner
=
Column
(
String
(
100
),
nullable
=
True
)
maintainlevel
=
Column
(
String
(
100
),
nullable
=
True
)
class
bin_pack
(
DBHelper
.
BASE
):
# pylint: disable=C0103,R0903
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录