Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
30675351
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,发现更多精彩内容 >>
提交
30675351
编写于
10月 28, 2015
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'lmr/add-dnf-software-manager-v2'
上级
6d3323d1
28e734cc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
13 deletion
+27
-13
avocado/utils/software_manager.py
avocado/utils/software_manager.py
+27
-13
未找到文件。
avocado/utils/software_manager.py
浏览文件 @
30675351
...
...
@@ -57,7 +57,7 @@ from . import path as utils_path
log
=
logging
.
getLogger
(
'avocado.test'
)
SUPPORTED_PACKAGE_MANAGERS
=
[
'apt-get'
,
'yum'
,
'zypper'
]
SUPPORTED_PACKAGE_MANAGERS
=
[
'apt-get'
,
'yum'
,
'zypper'
,
'dnf'
]
class
SystemInspector
(
object
):
...
...
@@ -98,6 +98,9 @@ class SystemInspector(object):
if
(
'apt-get'
in
list_supported
and
self
.
distro
in
(
'debian'
,
'ubuntu'
)):
pm_supported
=
'apt-get'
elif
(
'dnf'
in
list_supported
and
self
.
distro
in
(
'redhat'
,
'fedora'
)):
pm_supported
=
'dnf'
elif
(
'yum'
in
list_supported
and
self
.
distro
in
(
'redhat'
,
'fedora'
)):
pm_supported
=
'yum'
...
...
@@ -137,6 +140,7 @@ class SoftwareManager(object):
backend_type
=
inspector
.
get_package_management
()
backend_mapping
=
{
'apt-get'
:
AptBackend
,
'yum'
:
YumBackend
,
'dnf'
:
DnfBackend
,
'zypper'
:
ZypperBackend
}
if
backend_type
not
in
backend_mapping
.
keys
():
...
...
@@ -348,12 +352,12 @@ class YumBackend(RpmBackend):
Enterprise Linux.
"""
def
__init__
(
self
):
def
__init__
(
self
,
cmd
=
'yum'
):
"""
Initializes the base command and the yum package repository.
"""
super
(
YumBackend
,
self
).
__init__
()
executable
=
utils_path
.
find_command
(
'yum'
)
executable
=
utils_path
.
find_command
(
cmd
)
base_arguments
=
'-y'
self
.
base_command
=
executable
+
' '
+
base_arguments
self
.
repo_file_path
=
'/etc/yum.repos.d/avocado-managed.repo'
...
...
@@ -368,14 +372,15 @@ class YumBackend(RpmBackend):
except
IndexError
:
ver
=
out
self
.
pm_version
=
ver
log
.
debug
(
'
Yum version: %s'
%
self
.
pm_version
)
log
.
debug
(
'
%s version: %s'
,
cmd
,
self
.
pm_version
)
if
HAS_YUM_MODULE
:
self
.
yum_base
=
yum
.
YumBase
()
else
:
self
.
yum_base
=
None
log
.
error
(
"yum module for Python is required. "
"Using the basic support from rpm and yum commands"
)
log
.
error
(
"%s module for Python is required. "
"Using the basic support from rpm and %s commands"
,
cmd
,
cmd
)
def
_cleanup
(
self
):
"""
...
...
@@ -387,13 +392,7 @@ class YumBackend(RpmBackend):
"""
Installs package [name]. Handles local installs.
"""
if
os
.
path
.
isfile
(
name
):
name
=
os
.
path
.
abspath
(
name
)
command
=
'localinstall'
else
:
command
=
'install'
i_cmd
=
self
.
base_command
+
' '
+
command
+
' '
+
name
i_cmd
=
self
.
base_command
+
' '
+
'install'
+
' '
+
name
try
:
process
.
system
(
i_cmd
)
...
...
@@ -495,6 +494,21 @@ class YumBackend(RpmBackend):
return
None
class
DnfBackend
(
YumBackend
):
"""
Implements the dnf backend for software manager.
DNF is the successor to yum in recent Fedora.
"""
def
__init__
(
self
):
"""
Initializes the base command and the DNF package repository.
"""
super
(
DnfBackend
,
self
).
__init__
(
cmd
=
'dnf'
)
class
ZypperBackend
(
RpmBackend
):
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录