Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
14786a42
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看板
提交
14786a42
编写于
9月 01, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
9月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
!106 删除pyinstaller打包的形式,更改以单文件为入口的形式执行命令
Merge pull request !106 from gongzhengtang/master
上级
491d55f9
86949275
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
60 addition
and
42 deletion
+60
-42
packageship/packageship/application/initsystem/data_import.py
...ageship/packageship/application/initsystem/data_import.py
+21
-9
packageship/packageship/pkgship
packageship/packageship/pkgship
+16
-0
packageship/packageship/pkgship.py
packageship/packageship/pkgship.py
+0
-2
packageship/packageship/pkgshipd
packageship/packageship/pkgshipd
+5
-3
packageship/pkgship.spec
packageship/pkgship.spec
+14
-24
packageship/setup.py
packageship/setup.py
+4
-4
未找到文件。
packageship/packageship/application/initsystem/data_import.py
浏览文件 @
14786a42
...
...
@@ -136,6 +136,11 @@ class InitDataBase():
LOGGER
.
logger
.
error
(
'The priority value type in the database initialization
\
configuration file is incorrect'
)
continue
lifecycle_status_val
=
database_config
.
get
(
'lifecycle'
)
if
lifecycle_status_val
not
in
(
'enable'
,
'disable'
):
LOGGER
.
logger
.
error
(
'The status value of the life cycle in the initialization
\
configuration file can only be enable or disable'
)
continue
# Initialization data
self
.
_init_data
(
database_config
)
...
...
@@ -195,7 +200,12 @@ class InitDataBase():
raise
FileNotFoundError
(
"sqlite file {src} or {bin} does not exist, please
\
check and try again"
.
format
(
src
=
src_db_file
,
bin
=
bin_db_file
))
# 3. Obtain temporary source package files and binary package files
if
self
.
__save_data
(
src_db_file
,
bin_db_file
,
self
.
database_name
,
_db_name
):
_lifecycle_status_val
=
database_config
.
get
(
'lifecycle'
)
if
self
.
__save_data
(
src_db_file
,
bin_db_file
,
self
.
database_name
,
_db_name
,
_lifecycle_status_val
):
# Update the configuration file of the database
database_content
=
{
'database_name'
:
_db_name
,
...
...
@@ -209,7 +219,6 @@ class InitDataBase():
LOGGER
.
logger
.
error
(
error_msg
)
# Delete the specified database
self
.
__del_database
(
_db_name
)
# Delete tables created in the life cycle
def
__del_database
(
self
,
db_name
):
try
:
...
...
@@ -257,7 +266,7 @@ class InitDataBase():
LOGGER
.
logger
.
error
(
sql_error
)
return
None
def
__save_data
(
self
,
src_db_file
,
bin_db_file
,
db_name
,
table_name
):
def
__save_data
(
self
,
src_db_file
,
bin_db_file
,
db_name
,
table_name
,
lifecycle_status_val
):
"""
integration of multiple data files
...
...
@@ -274,7 +283,8 @@ class InitDataBase():
as
database
:
self
.
_database
=
database
# Save data related to source package
self
.
_save_src_packages
(
db_name
,
table_name
)
self
.
_save_src_packages
(
db_name
,
table_name
,
lifecycle_status_val
)
self
.
_save_src_requires
(
db_name
)
with
DBHelper
(
db_name
=
bin_db_file
,
db_type
=
'sqlite:///'
,
complete_route_db
=
True
)
\
...
...
@@ -291,7 +301,7 @@ class InitDataBase():
else
:
return
True
def
_save_src_packages
(
self
,
db_name
,
table_name
):
def
_save_src_packages
(
self
,
db_name
,
table_name
,
lifecycle_status_val
):
"""
Save the source package data
...
...
@@ -311,8 +321,8 @@ class InitDataBase():
package provided '
.
format
(
db_name
=
db_name
))
with
DBHelper
(
db_name
=
db_name
)
as
database
:
database
.
batch_add
(
packages_datas
,
SrcPack
)
self
.
_storage_packages
(
table_name
,
packages_datas
)
if
lifecycle_status_val
==
'enable'
:
InitDataBase
.
_storage_packages
(
table_name
,
packages_datas
)
@
staticmethod
def
__meta_model
(
table_name
):
...
...
@@ -323,12 +333,13 @@ class InitDataBase():
'__tablename__'
:
table_name
})
return
model
def
_storage_packages
(
self
,
table_name
,
package_data
):
@
staticmethod
def
_storage_packages
(
table_name
,
package_data
):
"""
Bulk storage of source code package data
"""
add_packages
=
[]
cls_model
=
InitDataBase
.
__meta_model
(
table_name
)
cls_model
=
Packages
.
package_meta
(
table_name
)
pkg_keys
=
(
'name'
,
'url'
,
'rpm_license'
,
'version'
,
'release'
,
'summary'
,
'description'
)
with
DBHelper
(
db_name
=
"lifecycle"
)
as
database
:
...
...
@@ -354,6 +365,7 @@ class InitDataBase():
if
add_packages
:
database
.
batch_add
(
add_packages
,
cls_model
)
database
.
session
.
commit
()
def
_save_src_requires
(
self
,
db_name
):
"""
...
...
packageship/packageship/pkgship
0 → 100644
浏览文件 @
14786a42
#!/usr/bin/python3
import
sys
import
signal
try
:
def
sig_handler
(
signum
,
frame
):
print
(
'Exit command mode'
)
sys
.
exit
(
0
)
signal
.
signal
(
signal
.
SIGINT
,
sig_handler
)
except
:
pass
from
packageship.pkgship
import
main
if
__name__
==
'__main__'
:
main
()
packageship/packageship/pkgship.py
浏览文件 @
14786a42
...
...
@@ -144,9 +144,7 @@ class PkgshipCommand(BaseCommand):
super
(
PkgshipCommand
,
self
).
__init__
()
self
.
statistics
=
dict
()
self
.
table
=
PkgshipCommand
.
create_table
()
# Calculate the total width of the current terminal
# self.columns = int(os.popen('stty size', 'r').read().split()[1])
self
.
columns
=
100
self
.
params
=
[]
...
...
packageship/packageship/pkgshipd
浏览文件 @
14786a42
...
...
@@ -45,6 +45,7 @@ buffer-size=$buffer_size
pidfile=
$OUT_PATH
/manage.pid
http-timeout=
$http_timeout
harakiri=
$harakiri
enable-threads=true
daemonize=
$daemonize
"
>
$OUT_PATH
/manage.ini
fi
...
...
@@ -72,6 +73,7 @@ buffer-size=$buffer_size
pidfile=
$OUT_PATH
/selfpkg.pid
http-timeout=
$http_timeout
harakiri=
$harakiri
enable-threads=true
daemonize=
$daemonize
"
>
$OUT_PATH
/selfpkg.ini
fi
...
...
@@ -107,8 +109,8 @@ function stop_service(){
if
[
!
-n
"
$1
"
]
then
echo
"Usages: sh pkgshipd.sh start|stop|restart [manage|selfpkg]"
exit
0
echo
"Usages: sh pkgshipd.sh start|stop|restart [manage|selfpkg]"
exit
0
fi
if
[
X
$2
=
X
]
;
then
...
...
@@ -154,6 +156,6 @@ elif [ $1 = restart ];then
echo
"===The run log is saved into:
$daemonize
==="
else
echo
"Usages: sh pkgshipd.sh start|stop|restart [manage|selfpkg]"
echo
"Usages: sh pkgshipd.sh start|stop|restart [manage|selfpkg]"
fi
packageship/pkgship.spec
浏览文件 @
14786a42
Name: pkgship
Version: 1.
0
.0
Release:
7
Version: 1.
1
.0
Release:
2
Summary: Pkgship implements rpm package dependence ,maintainer, patch query and so no.
License: Mulan 2.0
URL: https://gitee.com/openeuler/openEuler-Advisor
...
...
@@ -13,7 +13,7 @@ BuildRequires: python3-prettytable python3-requests python3-flask-session python
BuildRequires: python3-Flask-APScheduler python3-pandas python3-retrying python3-xlrd python3-XlsxWriter
Requires: python3-pip python3-flask-restful python3-flask python3 python3-pyyaml
Requires: python3-sqlalchemy python3-prettytable python3-requests
Requires: python3-
pyinstaller python3-
flask-session python3-flask-script python3-marshmallow python3-uWSGI
Requires: python3-flask-session python3-flask-script python3-marshmallow python3-uWSGI
Requires: python3-pandas python3-dateutil python3-XlsxWriter python3-xlrd python3-Flask-APScheduler python3-retrying
%description
...
...
@@ -30,6 +30,7 @@ Pkgship implements rpm package dependence ,maintainer, patch query and so no.
%check
# The apscheduler cannot catch the local time, so a time zone must be assigned before running the test case.
export TZ=Asia/Shanghai
# change log_path to solve default log_path permission denied problem
log_path=`pwd`/tmp/
...
...
@@ -40,26 +41,6 @@ sed -i "/\[LOG\]/a\log_path=$log_path" test/common_files/package.ini
rm -rf $log_path
%post
#build cli bin
if [ -f "/usr/bin/pkgship" ]; then
rm -rf /usr/bin/pkgship
fi
cd %{python3_sitelib}/packageship/
if [ -f "/usr/bin/pyinstaller" ]; then
/usr/bin/pyinstaller -F pkgship.py
elif [ -f "/usr/local/bin/pyinstaller" ]; then
/usr/local/bin/pyinstaller -F pkgship.py
else
echo "pkship install fail,there is no pyinstaller!"
exit
fi
sed -i "s/hiddenimports\=\[\]/hiddenimports\=\['pkg_resources.py2_warn'\]/g" pkgship.spec
/usr/local/bin/pyinstaller pkgship.spec
cp dist/pkgship /usr/bin/
rm -rf %{python3_sitelib}/packageship/build %{python3_sitelib}/packageship/dist
%postun
...
...
@@ -69,9 +50,18 @@ rm -rf %{python3_sitelib}/packageship/build %{python3_sitelib}/packageship/dist
%{python3_sitelib}/*
%config %{_sysconfdir}/pkgship/*
%attr(0755,root,root) %{_bindir}/pkgshipd
%attr(0755,root,root) %{_bindir}/pkgship
%changelog
* Tue Sep 1 2020 Zhengtang Gong <gongzhengtang@huawei.com> - 1.1.0-2
- Delete the packaged form of pyinstaller and change the execution
of the command in the form of a single file as the input
* Sat Aug 29 2020 Yiru Wang <wangyiru1@huawei.com> - 1.1.0-1
- Add package management features:
RPM packages statically displayed in the version repository
RPM packages used time displayed for current version in the version repository
Issue management of packages in a version-management repository
* Fri Aug 21 2020 Chengqiang Bao < baochengqiang1@huawei.com > - 1.0.0-7
- Fixed a problem with command line initialization of the Filepath parameter where relative paths are not supported and paths are too long
...
...
packageship/setup.py
浏览文件 @
14786a42
...
...
@@ -5,8 +5,7 @@ file for software packaging
"""
from
distutils.core
import
setup
config_path
=
"/etc/pkgship/"
# pylint: disable=invalid-name
_CONFIG_PATH
=
"/etc/pkgship/"
setup
(
name
=
'packageship'
,
...
...
@@ -28,6 +27,7 @@ setup(
'packageship.application.apps.lifecycle.function.base'
,
'packageship.application.apps.lifecycle.function.download_yaml'
,
'packageship.application.apps.lifecycle.function.gitee'
,
'packageship.application.apps.lifecycle.function.concurrent'
,
'packageship.application.apps.lifecycle.serialize'
,
'packageship.application.apps.lifecycle.url'
,
'packageship.application.apps.lifecycle.view'
,
...
...
@@ -58,6 +58,6 @@ setup(
long_description
=
open
(
'README.md'
,
encoding
=
'utf-8'
).
read
(),
author
=
'gongzt'
,
data_files
=
[
(
config_path
,
[
'packageship/package.ini'
]),
(
'/usr/bin'
,
[
'packageship/pkgshipd'
])]
(
_CONFIG_PATH
,
[
'packageship/package.ini'
]),
(
'/usr/bin'
,
[
'packageship/pkgshipd'
,
'packageship/pkgship'
])]
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录