summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiao716.wang <biao716.wang@samsung.com>2023-07-10 19:54:51 +0900
committerwang biao <biao716.wang@samsung.com>2023-07-12 10:32:07 +0800
commit9505309a0df631c63a92552295761f676870b6bd (patch)
tree5a288cd9f29d424e234b9a9fa7f16de6328e9b00
parent8ac061163d26170aaecbd311b493d60a5298489a (diff)
downloadmic-9505309a0df631c63a92552295761f676870b6bd.tar.gz
mic-9505309a0df631c63a92552295761f676870b6bd.tar.bz2
mic-9505309a0df631c63a92552295761f676870b6bd.zip
fix build error during mic function test
Change-Id: If9e6067b54c7e5e1fa9b6d88430b4853be1995b4 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
-rw-r--r--mic/3rdparty/pykickstart/parser.py6
-rw-r--r--plugins/backend/yumpkgmgr.py4
-rw-r--r--plugins/backend/zypppkgmgr.py15
3 files changed, 11 insertions, 14 deletions
diff --git a/mic/3rdparty/pykickstart/parser.py b/mic/3rdparty/pykickstart/parser.py
index 3d22e60..f75dc5b 100644
--- a/mic/3rdparty/pykickstart/parser.py
+++ b/mic/3rdparty/pykickstart/parser.py
@@ -85,7 +85,7 @@ def _preprocessStateMachine(lineIter):
try:
contents = load_to_str(ksurl)
except KickstartError as e:
- raise KickstartError(formatErrorMsg(lineno, msg=_("Unable to open %%ksappend file: %s") % str(e)))
+ raise KickstartError(_("Unable to open %%ksappend file: %s") % str(e), lineno=lineno)
# If that worked, write the remote file to the output kickstart
# file in one burst. This allows multiple %ksappend lines to
# exist.
@@ -112,7 +112,7 @@ def preprocessKickstartToString(f):
try:
contents = load_to_str(f)
except KickstartError as e:
- raise KickstartError(formatErrorMsg(0, msg=_("Unable to open input kickstart file: %s") % str(e)))
+ raise KickstartError(_("Unable to open input kickstart file: %s") % str(e), lineno=0)
return _preprocessStateMachine(iter(contents.splitlines(True)))
@@ -836,7 +836,7 @@ class KickstartParser(object):
try:
s = load_to_str(f)
except KickstartError as e:
- raise KickstartError(formatErrorMsg(0, msg=_("Unable to open input kickstart file: %s") % str(e)))
+ raise KickstartError(_("Unable to open input kickstart file: %s") % str(e), lineno=0)
self.readKickstartFromString(s, reset=False)
diff --git a/plugins/backend/yumpkgmgr.py b/plugins/backend/yumpkgmgr.py
index 3370fef..b16afbf 100644
--- a/plugins/backend/yumpkgmgr.py
+++ b/plugins/backend/yumpkgmgr.py
@@ -243,11 +243,11 @@ class Yum(BackendPlugin, yum.YumBase):
def selectGroup(self, grp, include = ksparser.constants.GROUP_DEFAULT):
try:
yum.YumBase.selectGroup(self, grp)
- if include == ksparser.GROUP_REQUIRED:
+ if include == ksparser.constants.GROUP_REQUIRED:
for p in list(grp.default_packages.keys()):
self.deselectPackage(p)
- elif include == ksparser.GROUP_ALL:
+ elif include == ksparser.constants.GROUP_ALL:
for p in list(grp.optional_packages.keys()):
self.selectPackage(p)
diff --git a/plugins/backend/zypppkgmgr.py b/plugins/backend/zypppkgmgr.py
index b95f9bd..ee04cd4 100644
--- a/plugins/backend/zypppkgmgr.py
+++ b/plugins/backend/zypppkgmgr.py
@@ -323,7 +323,7 @@ class Zypp(BackendPlugin):
break
if found:
- if include == ksparser.GROUP_REQUIRED:
+ if include == ksparser.constants.GROUP_REQUIRED:
list([self.deselectPackage(p) for p in list(grp.default_packages.keys())])
return None
@@ -755,13 +755,10 @@ class Zypp(BackendPlugin):
solvfile = "%s/.solv" % (self.cachedir)
- rc, out = runner.runtool([fs_related.find_binary_path("rpms2solv"),
- pkg])
- if rc == 0:
- f = open(solvfile, "w+")
- f.write(out)
- f.close()
-
+ #for python3.x, use subprocess.popen(), it can't deal with the solv contents. the contents
+ #is garbled code. so use redirect way to solvfile directly.
+ os.system('%s %s > %s' % (fs_related.find_binary_path("rpms2solv"), pkg, solvfile))
+ if os.path.exists(solvfile):
warnmsg = self.repo_manager.loadSolvFile(solvfile,
os.path.basename(pkg))
if warnmsg:
@@ -1021,7 +1018,7 @@ class Zypp(BackendPlugin):
q.setMatchExact()
q.addAttribute(zypp.SolvAttr.name, pkgname)
items = sorted(q.queryResults(self.Z.pool()),
- cmp=lambda x,y: cmpEVR(zypp.asKindPackage(x), zypp.asKindPackage(y)),
+ key=functools.cmp_to_key(lambda x,y: cmpEVR(zypp.asKindPackage(x), zypp.asKindPackage(y))),
reverse=True)
if items: