diff options
author | xiaojuan.mao <xiaojuan.mao@samsung.com> | 2017-09-22 15:28:40 +0800 |
---|---|---|
committer | xiaojuan.mao <xiaojuan.mao@samsung.com> | 2017-09-22 15:31:48 +0800 |
commit | c749329b6ab4a78c278f311eb6b9e52d132d154d (patch) | |
tree | 3bf61ccfaee49a94a7694687b361b8b0a0d25336 | |
parent | 455f9470b8f422330ac0256f478d972c98e98b1d (diff) | |
download | mic-c749329b6ab4a78c278f311eb6b9e52d132d154d.tar.gz mic-c749329b6ab4a78c278f311eb6b9e52d132d154d.tar.bz2 mic-c749329b6ab4a78c278f311eb6b9e52d132d154d.zip |
When increase rpm release number, user can use --local-pkgs-path to install local pkgs.
Change-Id: I249c2b42a54bd311bb09296a787ffe7d2f03379d
-rwxr-xr-x | mic/imager/baseimager.py | 6 | ||||
-rw-r--r-- | plugins/backend/zypppkgmgr.py | 23 |
2 files changed, 25 insertions, 4 deletions
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index bdf059d..9c2b30d 100755 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -968,9 +968,9 @@ class BaseImageCreator(object): for pkg in self._excluded_pkgs: pkg_manager.deselectPackage(pkg) - def __localinst_packages(self, pkg_manager): + """def __localinst_packages(self, pkg_manager): for rpm_path in self._get_local_packages(): - pkg_manager.installLocal(rpm_path) + pkg_manager.installLocal(rpm_path)""" def __preinstall_packages(self, pkg_manager): if not self.ks: @@ -1108,7 +1108,7 @@ class BaseImageCreator(object): self.__select_packages(pkg_manager) self.__select_groups(pkg_manager) self.__deselect_packages(pkg_manager) - self.__localinst_packages(pkg_manager) + #self.__localinst_packages(pkg_manager) self.__check_packages(pkg_manager) BOOT_SAFEGUARD = 256L * 1024 * 1024 # 256M 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 |