Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
5c5efc15
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
43
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看板
提交
5c5efc15
编写于
6月 02, 2020
作者:
S
Shinwell Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix lint issue
上级
ee8e8679
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
12 deletion
+25
-12
simple-update-robot.py
simple-update-robot.py
+25
-12
未找到文件。
simple-update-robot.py
浏览文件 @
5c5efc15
#!/usr/bin/python3
# process
# 1. get URL to download updated version
# so far we know the URL in spec is not reliable
# 2. Change Version to new one
# 3. Change Source or Source0 if needed
# 4. Update %changelog
# 5. try rpmbuild -bb
# 6. fork on gitee
# 7. git clone, git add, git commit, git push
# 8. PR on gitee
"""
This is a robot to do package upgrade automation
Expected process:
1. get URL to download updated version
2. Change Version to new one
3. Change Source or Source0 if needed
4. Update %changelog
5. try rpmbuild -bb (not yet)
6. fork on gitee
7. git clone, git add, git commit, git push (manually now)
8. PR on gitee
"""
from
pyrpm.spec
import
Spec
,
replace_macros
import
yaml
...
...
@@ -21,6 +23,9 @@ import re
import
datetime
def
download_source_url
(
spec
,
o_ver
,
n_ver
):
"""
Download source file from Source or Source0 URL
"""
source
=
replace_macros
(
spec
.
sources
[
0
],
spec
).
replace
(
o_ver
,
n_ver
)
if
re
.
match
(
r
"%{.*?}"
,
source
):
print
(
"Extra macros in URL which failed to be expanded"
)
...
...
@@ -33,7 +38,11 @@ def download_source_url(spec, o_ver, n_ver):
print
(
"Not valid URL for Source code"
)
return
False
def
download_upstream_url
(
gt
,
repo
,
o_ver
,
n_ver
):
"""
Download source from upstream metadata URL
"""
upstream_yaml
=
gt
.
get_yaml
(
repo
)
if
not
upstream_yaml
:
return
False
...
...
@@ -48,8 +57,12 @@ def download_upstream_url(gt, repo, o_ver, n_ver):
print
(
"Handling {vc} is still under developing"
.
format
(
vc
=
rp_yaml
[
"version_control"
]))
return
False
def
create_spec
(
repo
,
spec_str
,
o_ver
,
n_ver
,
src_fn
=
None
):
fn
=
open
(
repo
+
".spec"
,
"w"
)
"""
Create new spec file for upgraded package
"""
fn
=
open
(
repo
+
".spec"
,
"w"
)
in_changelog
=
False
for
l
in
spec_str
.
splitlines
():
if
l
.
startswith
(
"Release:"
):
...
...
@@ -65,7 +78,7 @@ def create_spec(repo, spec_str, o_ver, n_ver, src_fn=None):
nl
=
l
.
replace
(
o_ver
,
n_ver
)
else
:
nl
=
l
fn
.
write
(
nl
+
"
\n
"
)
fn
.
write
(
nl
+
"
\n
"
)
if
nl
.
startswith
(
"%changelog"
):
in_changelog
=
True
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录