提交 1814be46 编写于 作者: Y Yiru Wang Mac

fix search logic based on new database structure

...@@ -21,6 +21,7 @@ import subprocess ...@@ -21,6 +21,7 @@ import subprocess
import os.path import os.path
import re import re
import datetime import datetime
import version_recommend
def download_source_url(spec, o_ver, n_ver): def download_source_url(spec, o_ver, n_ver):
""" """
...@@ -91,7 +92,6 @@ def create_spec(repo, spec_str, o_ver, n_ver, src_fn=None): ...@@ -91,7 +92,6 @@ def create_spec(repo, spec_str, o_ver, n_ver, src_fn=None):
if __name__ == "__main__": if __name__ == "__main__":
pars = argparse.ArgumentParser() pars = argparse.ArgumentParser()
pars.add_argument("pkg", type=str, help="The package to be upgraded") pars.add_argument("pkg", type=str, help="The package to be upgraded")
pars.add_argument("-o", "--old_version", type=str, help="Current upstream version of package")
pars.add_argument("-n", "--new_version", type=str, help="New upstream version of package will be upgrade to") pars.add_argument("-n", "--new_version", type=str, help="New upstream version of package will be upgrade to")
pars.add_argument("-s", "--create_spec", help="Create spec file", action="store_true") pars.add_argument("-s", "--create_spec", help="Create spec file", action="store_true")
pars.add_argument("-d", "--download", help="Download upstream source code", action="store_true") pars.add_argument("-d", "--download", help="Download upstream source code", action="store_true")
...@@ -101,12 +101,15 @@ if __name__ == "__main__": ...@@ -101,12 +101,15 @@ if __name__ == "__main__":
args = pars.parse_args() args = pars.parse_args()
my_gitee = gitee.Gitee() my_gitee = gitee.Gitee()
my_version = version_recommend.VersionType()
spec_string= my_gitee.get_spec(args.pkg) spec_string= my_gitee.get_spec(args.pkg)
s_spec = Spec.from_string(spec_string) s_spec = Spec.from_string(spec_string)
cur_ver = replace_macros(s_spec.version, s_spec)
if args.fork: if args.fork:
my_gitee.fork_repo(args.pkg) if not my_gitee.fork_repo(args.pkg):
print("The repo of {pkg} seems to have been forked.".format(pkg=args.pkg))
if args.clone: if args.clone:
user=my_gitee.token["user"] user=my_gitee.token["user"]
...@@ -114,7 +117,7 @@ if __name__ == "__main__": ...@@ -114,7 +117,7 @@ if __name__ == "__main__":
os.chdir(args.pkg) os.chdir(args.pkg)
if args.download: if args.download:
source_file = download_source_url(s_spec, args.old_version, args.new_version) source_file = download_source_url(s_spec, cur_ver, args.new_version)
if source_file: if source_file:
print(source_file) print(source_file)
else: else:
...@@ -130,7 +133,11 @@ if __name__ == "__main__": ...@@ -130,7 +133,11 @@ if __name__ == "__main__":
print("I'm too naive to handle complicated package.") print("I'm too naive to handle complicated package.")
print("This package has multiple in-house patches.") print("This package has multiple in-house patches.")
sys.exit(1) sys.exit(1)
create_spec(args.pkg, spec_string, args.old_version, args.new_version) if(my_version.compare(args.new_version, cur_ver) ==1):
create_spec(args.pkg, spec_string, cur_ver, args.new_version)
else:
print("Please check version of {pkg} will upgrade to, it's current version is {version}.".format(
pkg=args.pkg, version=cur_ver))
if args.PR: if args.PR:
my_gitee.create_pr(my_gitee.token["user"], args.pkg) my_gitee.create_pr(my_gitee.token["user"], args.pkg)
此差异已折叠。
# 特性描述
- SR-PKG-MANAGE02-AR01: 包静态信息建档管理
- SR-PKG-MANAGE02-AR02: 包动态信息跟踪(生命周期)
- SR-PKG-MANAGE01-AR11: 包补丁分类管理
- SR-PKG-MANAGE03-AR01: 特性与包关联模块
- 支持网页前端显示
- 支持软件责任人及软件维护级别的存储和更改
# 依赖组件
- git, svn, pypi
- openEuler-Advisor/ upstream-info
# License
Mulan V2
# 流程分析
## 外部接口清单
| 序号 | 接口名称 | 类型 | 说明 | 入参 | 出参 | 特性号 |
| - | - | - | - | - | - | - |
| 1 | /packages | GET | 支持查看所有软件包静态信息、对应特性、动态信息及issue数量统计信息 | dbName | *packages-info* | all |
| 2 | /packages/packageInfo | GET | 支持查看指定软件包详细静态信息 | dbName, srcName | *packages-info-detailed* | MANAGE02-AR01 |
| 3 | /packages/lifeCycle | PUT | 支持更新指定软件包信息字段 | dbName, srcName, [end-of-life], [maintainer], [maintainlevel] | null | MANAGE02-AR02 |
| 4 | /packages/issueTrace | GET | 支持查看指定软件包issue详细信息 | dbName, srcName | *packages-issue* | MANAGE01-AR11 |
| 5 | /packages/issueTrace/patched | GET | 支持下载指定软件包指定issue的补丁包 | dbName, srcName, issueId | *packages-issue-patched* | MANAGE01-AR11 |
### 外部接口请求、回显格式
*需和前台对齐回显格式
- *packages-info*:
静态信息:name, version, release, url, rpm_license, feature, maintainer, maintainlevel;
动态信息&动态信息统计:name, version,release, published time, end time, maintainer status, latest version, latest publish time
动态信息统计:name, version,release, 需求, cve&安全问题, 缺陷
- *packages-info-detailed*: name, version, release, url, rpm_license, maintainer, maintainlevel, summary, description, required, subpack, subpack-provides, subpack-requires-component, subpack-requires-binary(if exist)
- *packages-issue*: list: issudId, issue-url, issue-content, issue-status, issue-download
# 功能设计
## 主体流程分析
计算生命周期结束日期:
![avatar](./pkgimg/lifecycle_2.png)
## 数据表设计
针对不同的版本,设计多个字段相同,表名不同的table (注:表名应于对应依赖数据库名称相同):
- Mainline
| 序号 | 名称 | 说明 | 类型 | 键 | 允许空 | 默认值 |
| - | - | - | - | - | - | - |
| 1 | id | 条目序号 | Int | Primary | NO | - |
| 2 | name | 源码包名 | String | NO | YES | - |
| 3 | url | URL | String | NO | YES | - |
| 4 | rpm_license | license | String | NO | YES | - |
| 5 | version | 版本号 | String | NO | YES | - |
| 6 | release | release号 | String | NO | YES | - |
| 7 | version_time | 当前版本发布时间 | String | NO | YES | - |
| 8 | end_time | 结束当前版本生命周期的时间 | String | NO | YES | - |
| 9 | maintainer_status | 生命周期状态 | String | NO | YES | "Available" |
| 10 | latest_version | 最新版本号 | String | NO | YES | - |
| 11 | latest_version_time | 最新版本发布时间 | String | NO | YES | - |
| 12 | demand | 需求 | Int | NO | NO | 0 |
| 13 | cve | cve及安全漏洞 | Int | NO | NO | 0 |
| 14 | defect | 缺陷 | Int | NO | NO | 0 |
| 15 | maintainer | 维护人 | String | NO | YES | - |
| 16 | maintainlevel | 维护级别 | Int| NO | YES | - |
| 17 | feature | 对应特性 | String | NO | YES | - |
| 18 | version_control | 版本控制(git,svn) | String | NO | YES | - |
| 19 | src_repo | 上游社区repo源 | String | NO | YES | - |
| 20 | tag_prefix | 版本标签 | String | NO | YES | - |
回显简单事例:
![avatar](./pkgimg/lifecycle_display.png)
生命周期终止时间定义:
1. 若最新版本和当前版本一致,生命周期终止时间为最新发布日期的6个月后;
2. 若最新版本高于当前版本,生命周期终止时间为最新发布日期的3个月后。
![avatar](./pkgimg/issue_display.png)
\ No newline at end of file
...@@ -200,7 +200,11 @@ class InitDataBase(): ...@@ -200,7 +200,11 @@ class InitDataBase():
raise ContentNoneException( raise ContentNoneException(
'The path to the sqlite file in the database initialization configuration \ 'The path to the sqlite file in the database initialization configuration \
is incorrect ') is incorrect ')
<<<<<<< HEAD
if not os.path.exists(src_db_file) or not os.path.exists(bin_db_file): if not os.path.exists(src_db_file) or not os.path.exists(bin_db_file):
=======
if os.path.exists(src_db_file) or os.path.exists(bin_db_file):
>>>>>>> dec3661c6c56512ebee173dc68694716d8c6b041
raise FileNotFoundError("sqlite file {src} or {bin} does not exist, please \ raise FileNotFoundError("sqlite file {src} or {bin} does not exist, please \
check and try again".format(src=src_db_file, bin=bin_db_file)) check and try again".format(src=src_db_file, bin=bin_db_file))
# 3. Obtain temporary source package files and binary package files # 3. Obtain temporary source package files and binary package files
......
---
version_control: github version_control: github
src_repo: yaml/pyyaml src_repo: yaml/pyyaml
tag_prefix: ^v tag_prefix: "^"
separator: . separator: "."
git_url: https://github.com/yaml/pyyaml.git
git_tag:
- 2020-03-18 5.3.1
- 2020-01-06 5.3
- 2018-08-16 4.1-retracted
- 2019-12-21 5.3b1
- 2019-11-25 5.2b1
- 2019-12-02 5.2
- 2019-03-08 5.1b7
- 2019-03-07 5.1b6
- 2019-03-07 5.1b5
- 2019-03-06 5.1b4
- 2019-02-27 5.1b3
- 2019-02-26 5.1b2
- 2019-02-24 5.1b1
- 2019-07-30 5.1.2
- 2019-06-06 5.1.1
- 2019-03-13 5.1
- 2018-06-29 4.2b2
- 2018-06-28 4.2b1
- 2018-06-26 4.1
- 2018-07-03 3.13rc1
- 2018-07-03 3.13b1
- 2018-07-05 3.13
- 2016-08-27 3.12
- 2014-03-26 3.11
- 2011-05-29 3.10
- 2009-08-30 3.09
- 2008-12-30 3.08
- 2008-12-28 3.07
- 2008-10-03 3.06
- 2007-05-12 3.05
- 2006-08-20 3.04
- 2006-06-18 3.03
- 2006-05-15 3.02
- 2006-05-07 3.01
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册