提交 87f4e9f1 编写于 作者: M myeuler

add dnf install to check if module is ready

上级 33197fc4
......@@ -31,6 +31,14 @@ import queue
def mod_installed(mod):
# try to use dnf to install mod directly
ret = subprocess.call(["dnf", "install", mod])
if (ret == 0):
return True
return False
def pkg_installed(pkg):
#ret = subprocess.call(["rpm", "-qi", pkg], stdout=subprocess.PIPE)
ret = subprocess.call(["rpm", "-qi", pkg])
......@@ -41,7 +49,7 @@ def pkg_installed(pkg):
ret = subprocess.call(["yum", "install", "-y", pkg])
if (ret == 0):
return True
return False
def circle_dep(pkg, prepare):
......@@ -111,7 +119,7 @@ def get_deps(porter, proc):
#
mod = str(line.strip().decode())
pkg = porter.refine_pkg(mod)
if (pkg_installed(pkg) == False):
if (pkg_installed(pkg) == False) and (mod_installed(porter.refine_mod(mod)) == False):
needed.append(mod)
return (needed, True)
......@@ -121,6 +129,12 @@ class perlPorter:
def __init__(self):
return
def refine_mod(self, mod):
if mod == "perl":
return mod
newmod = "perl(" + mod + ")"
return newmod
def refine_pkg(self, pkg):
if pkg == "perl":
return pkg
......@@ -150,6 +164,9 @@ class pythonPorter:
def __init__(self):
return
def refine_mod(self, mod):
return mod
def refine_pkg(self, pkg):
"""
For the reason that json file may have some misinfo, need to add a checklist
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册