diff options
author | SoonKyu Park <sk7.park@samsung.com> | 2019-12-26 14:12:17 +0900 |
---|---|---|
committer | SoonKyu Park <sk7.park@samsung.com> | 2019-12-26 14:12:17 +0900 |
commit | ff5819fa88cf0522c567925aa5919eb300c628f8 (patch) | |
tree | b61ed2bca94da2d79fcc5a1ec95bca119960c9d5 /plugins | |
parent | 190d64daadbdd442f9388b31bff028ae87237d22 (diff) | |
parent | 52732d20f9940e9d7a743d2537ce0e033a5cf698 (diff) | |
download | mic-submit/tizen/20191226.054359.tar.gz mic-submit/tizen/20191226.054359.tar.bz2 mic-submit/tizen/20191226.054359.zip |
Merge release-0.28.6 from 'tools/mic'upstream/0.28.6tizen_6.5.m2_releasetizen_6.0.m2_releasesubmit/tizen_6.5/20211028.163501submit/tizen_6.0_hotfix/20201103.115103submit/tizen_6.0_hotfix/20201102.192903submit/tizen_6.0/20201029.205503submit/tizen_5.5_wearable_hotfix/20201026.184307submit/tizen_5.5/20191226.063733submit/tizen/20191226.054359accepted/tizen/unified/20191226.123003accepted/tizen/6.5/unified/20211029.014911accepted/tizen/6.0/unified/hotfix/20201102.231525accepted/tizen/6.0/unified/20201030.111620accepted/tizen/5.5/unified/wearable/hotfix/20201027.100111accepted/tizen/5.5/unified/20191228.075036tizen_6.5tizen_6.0_hotfixtizen_6.0tizen_5.5_wearable_hotfixtizen_5.5_tvtizen_5.5accepted/tizen_6.5_unifiedaccepted/tizen_6.0_unified_hotfixaccepted/tizen_6.0_unifiedaccepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified
Change-Id: I6aa8025c850312f6a03f446f7876310900b277da
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/backend/zypppkgmgr.py | 23 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/imager/fs_plugin.py | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/imager/loop_plugin.py | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/imager/qcow_plugin.py | 13 | ||||
-rwxr-xr-x | plugins/imager/raw_plugin.py | 11 |
5 files changed, 71 insertions, 4 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 diff --git a/plugins/imager/fs_plugin.py b/plugins/imager/fs_plugin.py index d74530f..c639211 100644..100755 --- a/plugins/imager/fs_plugin.py +++ b/plugins/imager/fs_plugin.py @@ -15,8 +15,9 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # Temple Place - Suite 330, Boston, MA 02111-1307, USA. +import subprocess from mic import chroot, msger, rt_util -from mic.utils import misc, errors, fs_related +from mic.utils import misc, errors, fs_related, runner from mic.imager import fs from mic.conf import configmgr from mic.plugin import pluginmgr @@ -92,10 +93,10 @@ class FsPlugin(ImagerPlugin): creator.check_depend_tools() creator.mount(None, creatoropts["cachedir"]) creator.install() + creator.tpkinstall() #Download the source packages ###private options if args.include_src: installed_pkgs = creator.get_installed_packages() - msger.info('--------------------------------------------------') msger.info('Generating the image with source rpms included ...') if not misc.SrcpkgsDownload(installed_pkgs, creatoropts["repomd"], creator._instroot, creatoropts["cachedir"]): @@ -115,6 +116,15 @@ class FsPlugin(ImagerPlugin): finally: creator.cleanup() + #Run script of --run_script after image created + if creatoropts['run_script']: + cmd = creatoropts['run_script'] + try: + runner.show(cmd) + except OSError,err: + msger.warning(str(err)) + + msger.info("Finished.") return 0 diff --git a/plugins/imager/loop_plugin.py b/plugins/imager/loop_plugin.py index 1830230..0b94f0e 100644..100755 --- a/plugins/imager/loop_plugin.py +++ b/plugins/imager/loop_plugin.py @@ -16,11 +16,12 @@ # Temple Place - Suite 330, Boston, MA 02111-1307, USA. import os +import subprocess import shutil import tempfile from mic import chroot, msger, rt_util -from mic.utils import misc, fs_related, errors +from mic.utils import misc, fs_related, errors, runner from mic.conf import configmgr from mic.plugin import pluginmgr from mic.imager.loop import LoopImageCreator, load_mountpoints @@ -100,9 +101,12 @@ class LoopPlugin(ImagerPlugin): creator.check_depend_tools() creator.mount(None, creatoropts["cachedir"]) creator.install() + creator.tpkinstall() creator.configure(creatoropts["repomd"]) creator.copy_kernel() + creator.create_cpio_image() creator.unmount() + creator.copy_cpio_image() creator.package(creatoropts["destdir"]) creator.create_manifest() @@ -117,6 +121,14 @@ class LoopPlugin(ImagerPlugin): finally: creator.cleanup() + #Run script of --run_script after image created + if creatoropts['run_script']: + cmd = creatoropts['run_script'] + try: + runner.show(cmd) + except OSError,err: + msger.warning(str(err)) + msger.info("Finished.") return 0 diff --git a/plugins/imager/qcow_plugin.py b/plugins/imager/qcow_plugin.py index 8acf572..d6758c5 100644..100755 --- a/plugins/imager/qcow_plugin.py +++ b/plugins/imager/qcow_plugin.py @@ -15,6 +15,7 @@ # Temple Place - Suite 330, Boston, MA 02111-1307, USA. import os +import subprocess import shutil from mic import msger, rt_util @@ -131,9 +132,12 @@ class QcowPlugin(ImagerPlugin): creator.check_depend_tools() creator.mount(None, creatoropts["cachedir"]) creator.install() + creator.tpkinstall() creator.configure(creatoropts["repomd"]) creator.copy_kernel() + creator.create_cpio_image() creator.unmount() + creator.copy_cpio_image() creator.package(creatoropts["destdir"]) creator.create_manifest() @@ -148,6 +152,15 @@ class QcowPlugin(ImagerPlugin): finally: creator.cleanup() + #Run script of --run_script after image created + if creatoropts['run_script']: + cmd = creatoropts['run_script'] + try: + runner.show(cmd) + except OSError,err: + msger.warning(str(err)) + + msger.info("Finished.") return 0 diff --git a/plugins/imager/raw_plugin.py b/plugins/imager/raw_plugin.py index 09a9714..e954b7b 100755 --- a/plugins/imager/raw_plugin.py +++ b/plugins/imager/raw_plugin.py @@ -16,6 +16,7 @@ # Temple Place - Suite 330, Boston, MA 02111-1307, USA. import os +import subprocess import shutil import re import tempfile @@ -98,6 +99,7 @@ class RawPlugin(ImagerPlugin): creator.check_depend_tools() creator.mount(None, creatoropts["cachedir"]) creator.install() + creator.tpkinstall() creator.configure(creatoropts["repomd"]) creator.copy_kernel() creator.unmount() @@ -113,6 +115,15 @@ class RawPlugin(ImagerPlugin): finally: creator.cleanup() + #Run script of --run_script after image created + if creatoropts['run_script']: + cmd = creatoropts['run_script'] + try: + runner.show(cmd) + except OSError,err: + msger.warning(str(err)) + + msger.info("Finished.") return 0 |