Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
a4ee6a6a
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
32
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,发现更多精彩内容 >>
提交
a4ee6a6a
编写于
7月 03, 2020
作者:
G
gongzt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Standardize code, modify file encoding, instance attribute definition location
上级
57a3e214
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
13 deletion
+26
-13
packageship/packageship/application/initsystem/data_import.py
...ageship/packageship/application/initsystem/data_import.py
+13
-5
packageship/packageship/application/initsystem/datamerge.py
packageship/packageship/application/initsystem/datamerge.py
+5
-0
packageship/packageship/pkgship.py
packageship/packageship/pkgship.py
+8
-8
未找到文件。
packageship/packageship/application/initsystem/data_import.py
浏览文件 @
a4ee6a6a
'''
Initialization of data import
Import the data in the sqlite database into the mysql database
Import the data in the sqlite database into the mysql database
'''
import
os
import
pathlib
...
...
@@ -56,6 +56,14 @@ class InitDataBase():
if
self
.
db_type
not
in
[
'mysql'
,
'sqlite'
]:
LOGGER
.
logger
.
error
(
"database type configuration error"
)
raise
Exception
(
'database type configuration error'
)
self
.
_bin_provides_dicts
=
None
self
.
_bin_requires_dicts
=
None
self
.
_bin_package_name
=
None
self
.
_bin_package_dicts
=
None
self
.
_src_requires_dicts
=
None
self
.
_src_packages
=
None
self
.
_src_package_names
=
None
self
.
_sqlite_db
=
None
def
__read_config_file
(
self
):
'''
...
...
@@ -593,7 +601,7 @@ class InitDataBase():
Args:
Returns:
**Kwargs
:
data related to configuration file nodes
**Kwargs
:
data related to configuration file nodes
database_name: Name database
priority: priority
Raises:
...
...
@@ -844,7 +852,7 @@ class SqliteDatabaseOperations():
_db_file
=
os
.
path
.
join
(
self
.
database_file_folder
,
self
.
db_name
)
if
os
.
path
.
exists
(
_db_file
+
'.db'
):
if
os
.
path
.
exists
(
_db_file
+
'.db'
):
os
.
remove
(
_db_file
+
'.db'
)
# create a sqlite database
...
...
@@ -872,7 +880,7 @@ class SqliteDatabaseOperations():
try
:
db_path
=
os
.
path
.
join
(
self
.
database_file_folder
,
self
.
db_name
+
'.db'
)
self
.
database_file_folder
,
self
.
db_name
+
'.db'
)
if
os
.
path
.
exists
(
db_path
):
os
.
remove
(
db_path
)
except
IOError
as
exception_msg
:
...
...
@@ -899,7 +907,7 @@ class SqliteDatabaseOperations():
_db_file
=
os
.
path
.
join
(
self
.
database_file_folder
,
self
.
db_name
)
if
not
os
.
path
.
exists
(
_db_file
+
'.db'
):
if
not
os
.
path
.
exists
(
_db_file
+
'.db'
):
# create a sqlite database
with
DBHelper
(
db_name
=
_db_file
)
as
database
:
tables
=
[
'maintenance_info'
]
...
...
packageship/packageship/application/initsystem/datamerge.py
浏览文件 @
a4ee6a6a
...
...
@@ -29,6 +29,11 @@ class MergeData():
self
.
db_file
=
db_file
self
.
db_type
=
'sqlite:///'
self
.
datum_database
=
'maintenance.information'
self
.
src_requires_dicts
=
None
self
.
src_package_datas
=
None
self
.
bin_provides_dicts
=
None
self
.
bin_package_datas
=
None
self
.
mainter_infos
=
None
@
staticmethod
def
__columns
(
cursor
):
...
...
packageship/packageship/pkgship.py
浏览文件 @
a4ee6a6a
...
...
@@ -426,7 +426,7 @@ class InitDatabaseCommand(PkgshipCommand):
response
=
requests
.
post
(
self
.
write_host
+
'/initsystem'
,
data
=
json
.
dumps
({
'configfile'
:
file_path
}),
headers
=
self
.
headers
)
except
Conn
ectionErro
r
as
conn_error
:
except
Conn
Er
r
as
conn_error
:
LOGGER
.
logger
.
error
(
conn_error
)
print
(
str
(
conn_error
))
else
:
...
...
@@ -527,7 +527,7 @@ class AllPackageCommand(PkgshipCommand):
'/packages?dbName={dbName}'
.
format
(
dbName
=
params
.
db
)
try
:
response
=
requests
.
get
(
_url
)
except
Conn
ectionErro
r
as
conn_error
:
except
Conn
Er
r
as
conn_error
:
LOGGER
.
logger
.
error
(
conn_error
)
print
(
str
(
conn_error
))
else
:
...
...
@@ -591,7 +591,7 @@ class UpdatePackageCommand(PkgshipCommand):
'maintainer'
:
params
.
m
,
'maintainlevel'
:
params
.
l
}),
headers
=
self
.
headers
)
except
Conn
ectionErro
r
as
conn_error
:
except
Conn
Er
r
as
conn_error
:
LOGGER
.
logger
.
error
(
conn_error
)
print
(
str
(
conn_error
))
else
:
...
...
@@ -663,7 +663,7 @@ class BuildDepCommand(PkgshipCommand):
_url
,
data
=
json
.
dumps
({
'sourceName'
:
params
.
packagename
,
'db_list'
:
params
.
dbs
}),
headers
=
self
.
headers
)
except
Conn
ectionErro
r
as
conn_error
:
except
Conn
Er
r
as
conn_error
:
LOGGER
.
logger
.
error
(
conn_error
)
print
(
str
(
conn_error
))
else
:
...
...
@@ -792,7 +792,7 @@ class InstallDepCommand(PkgshipCommand):
'binaryName'
:
params
.
packagename
,
'db_list'
:
params
.
dbs
},
ensure_ascii
=
True
),
headers
=
self
.
headers
)
except
Conn
ectionErro
r
as
conn_error
:
except
Conn
Er
r
as
conn_error
:
LOGGER
.
logger
.
error
(
conn_error
)
print
(
str
(
conn_error
))
else
:
...
...
@@ -969,7 +969,7 @@ class SelfBuildCommand(PkgshipCommand):
'selfbuild'
:
str
(
params
.
s
),
'withsubpack'
:
str
(
params
.
w
)}),
headers
=
self
.
headers
)
except
Conn
ectionErro
r
as
conn_error
:
except
Conn
Er
r
as
conn_error
:
LOGGER
.
logger
.
error
(
conn_error
)
print
(
str
(
conn_error
))
else
:
...
...
@@ -1040,7 +1040,7 @@ class BeDependCommand(PkgshipCommand):
'withsubpack'
:
str
(
params
.
w
)
}
),
headers
=
self
.
headers
)
except
Conn
ectionErro
r
as
conn_error
:
except
Conn
Er
r
as
conn_error
:
LOGGER
.
logger
.
error
(
conn_error
)
print
(
str
(
conn_error
))
else
:
...
...
@@ -1134,7 +1134,7 @@ class SingleCommand(PkgshipCommand):
.
format
(
db_name
=
params
.
db
,
packagename
=
params
.
packagename
)
try
:
response
=
requests
.
get
(
_url
)
except
Conn
ectionErro
r
as
conn_error
:
except
Conn
Er
r
as
conn_error
:
LOGGER
.
logger
.
error
(
conn_error
)
print
(
str
(
conn_error
))
else
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录