summaryrefslogtreecommitdiff
path: root/plugins/backend/zypppkgmgr.py
diff options
context:
space:
mode:
authorSoonKyu Park <sk7.park@samsung.com>2019-12-26 14:12:17 +0900
committerSoonKyu Park <sk7.park@samsung.com>2019-12-26 14:12:17 +0900
commitff5819fa88cf0522c567925aa5919eb300c628f8 (patch)
treeb61ed2bca94da2d79fcc5a1ec95bca119960c9d5 /plugins/backend/zypppkgmgr.py
parent190d64daadbdd442f9388b31bff028ae87237d22 (diff)
parent52732d20f9940e9d7a743d2537ce0e033a5cf698 (diff)
downloadmic-submit/tizen/20191226.054359.tar.gz
mic-submit/tizen/20191226.054359.tar.bz2
mic-submit/tizen/20191226.054359.zip
Change-Id: I6aa8025c850312f6a03f446f7876310900b277da
Diffstat (limited to 'plugins/backend/zypppkgmgr.py')
-rw-r--r--plugins/backend/zypppkgmgr.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/backend/zypppkgmgr.py b/plugins/backend/zypppkgmgr.py
index 9358cbe..77b942e 100644
--- a/plugins/backend/zypppkgmgr.py
+++ b/plugins/backend/zypppkgmgr.py
@@ -19,6 +19,7 @@ import os
import shutil
import urlparse
import rpm
+import glob
import zypp
if not hasattr(zypp, 'PoolQuery') or \
@@ -33,7 +34,7 @@ from mic.utils import misc, rpmmisc, runner, fs_related
from mic.utils.grabber import myurlgrab, TextProgress
from mic.utils.proxy import get_proxy_for
from mic.utils.errors import CreatorError, RepoError, RpmError
-from mic.imager.baseimager import BaseImageCreator
+from mic.conf import configmgr
class RepositoryStub:
def __init__(self):
@@ -463,10 +464,30 @@ class Zypp(BackendPlugin):
def checkPackage(self, pkg):
self.check_pkgs.append(pkg)
+ def _get_local_packages(self):
+ """Return a list of rpm path to be local installed.
+ This is the hook where subclasses may specify a set of rpms which
+ it requires to be installed locally.
+ This returns an empty list by default.
+ Note, subclasses should usually chain up to the base class
+ implementation of this hook.
+ """
+ cropts = configmgr.create
+ if cropts['local_pkgs_path']:
+ if os.path.isdir(cropts['local_pkgs_path']):
+ return glob.glob(
+ os.path.join(cropts['local_pkgs_path'], '*.rpm'))
+ elif os.path.splitext(cropts['local_pkgs_path'])[-1] == '.rpm':
+ return [cropts['local_pkgs_path']]
+ return []
+ def __localinst_packages(self):
+ for rpm_path in self._get_local_packages():
+ self.installLocal(rpm_path)
def runInstall(self, checksize = 0):
os.environ["HOME"] = "/"
os.environ["LD_PRELOAD"] = ""
self.buildTransaction()
+ self.__localinst_packages()
todo = zypp.GetResolvablesToInsDel(self.Z.pool())
installed_pkgs = todo._toInstall