Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
c1823f4a
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
c1823f4a
编写于
1月 19, 2018
作者:
A
Amador Pahim
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'ldoktor-utils-soft2'
Signed-off-by:
N
Amador Pahim
<
apahim@redhat.com
>
上级
e2d4033c
cc3f2717
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
25 deletion
+34
-25
avocado/utils/software_manager.py
avocado/utils/software_manager.py
+34
-25
未找到文件。
avocado/utils/software_manager.py
浏览文件 @
c1823f4a
...
...
@@ -36,6 +36,7 @@ implement the given backend class.
"""
import
os
import
re
import
shutil
import
logging
import
optparse
import
tempfile
...
...
@@ -584,35 +585,43 @@ class YumBackend(RpmBackend):
:return final_dir: path of ready-to-build directory
"""
path
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_software_manager'
)
if
dest_path
is
None
:
log
.
error
(
"Please provide a valid path"
)
return
""
for
pkg
in
[
"rpm-build"
,
"yum-utils"
]:
if
not
self
.
check_installed
(
pkg
):
if
not
self
.
install
(
pkg
):
log
.
error
(
"SoftwareManager (YumBackend) can't get packages"
"with dependency resolution: Package '%s'"
"could not be installed"
,
pkg
)
return
""
try
:
src_rpm
=
process
.
system_output
(
'yumdownloader --urls --source'
' %s'
%
name
).
splitlines
()[
-
1
]
src_rpm
=
src_rpm
.
split
(
"/"
)[
-
1
]
process
.
system_output
(
'yumdownloader --source %s --destdir %s'
%
(
name
,
path
))
src_rpm
=
os
.
path
.
join
(
path
,
src_rpm
)
if
self
.
rpm_install
(
src_rpm
):
if
self
.
build_dep
(
name
):
return
self
.
prepare_source
(
"%s/rpmbuild/SPECS/%s.spec"
%
(
os
.
environ
[
'HOME'
],
name
),
dest_path
)
if
dest_path
is
None
:
log
.
error
(
"Please provide a valid path"
)
return
""
for
pkg
in
[
"rpm-build"
,
"yum-utils"
]:
if
not
self
.
check_installed
(
pkg
):
if
not
self
.
install
(
pkg
):
log
.
error
(
"SoftwareManager (YumBackend) can't get "
"packageswith dependency resolution: Package"
" '%s' could not be installed"
,
pkg
)
return
""
try
:
process
.
run
(
'yumdownloader --assumeyes --verbose --source %s '
'--destdir %s'
%
(
name
,
path
))
src_rpms
=
[
_
for
_
in
os
.
walk
(
path
).
next
()[
2
]
if
_
.
endswith
(
".src.rpm"
)]
if
len
(
src_rpms
)
!=
1
:
log
.
error
(
"Failed to get downloaded src.rpm from %s:
\n
%s"
,
path
,
os
.
walk
(
path
).
next
()[
2
])
return
""
if
self
.
rpm_install
(
os
.
path
.
join
(
path
,
src_rpms
[
-
1
])):
if
self
.
build_dep
(
name
):
spec_path
=
os
.
path
.
join
(
os
.
environ
[
'HOME'
],
"rpmbuild"
,
"SPECS"
,
"%s.spec"
%
name
)
return
self
.
prepare_source
(
spec_path
,
dest_path
)
else
:
log
.
error
(
"Installing build dependencies failed"
)
return
""
else
:
log
.
error
(
"Installing
build dependencies
failed"
)
log
.
error
(
"Installing
source rpm
failed"
)
return
""
e
lse
:
log
.
error
(
"Installing source rpm failed"
)
e
xcept
process
.
CmdError
as
details
:
log
.
error
(
details
)
return
""
except
process
.
CmdError
as
details
:
log
.
error
(
details
)
return
""
finally
:
shutil
.
rmtree
(
path
)
class
DnfBackend
(
YumBackend
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录