From: Dohyung Kim Date: Wed, 15 Nov 2017 08:48:39 +0000 (+0900) Subject: call copy_attachment() after configure() and move attachment files X-Git-Tag: accepted/tizen/5.5/unified/20191228.075036^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f7aece3af62a2120b2117799c21f5ec5e937665;p=platform%2Fupstream%2Fmic.git call copy_attachment() after configure() and move attachment files - Call BaseImager.copy_attachment() after BaseImager.configure() Post scripts on configure() cannot access attachment files which come from install_root. So call copy_attachment() after running post scripts. - Move attachment files not copy. If copying attachment files from install_root, then attachment files remain in install_root. So use mv instead of cp for deduplication. Change-Id: Ie7a1d516331e29eaba975bc186b9644b96c17fbc Signed-off-by: Dohyung Kim --- diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index c1bb418..a1ddb6a 100755 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -1197,7 +1197,7 @@ class BaseImageCreator(object): raise CreatorError("Tpk package missing.") def postinstall(self): - self.copy_attachment() + pass def _get_sign_scripts_env(self): """Return an environment dict for %post-umount scripts. diff --git a/mic/imager/loop.py b/mic/imager/loop.py index 1e44343..fd4830c 100755 --- a/mic/imager/loop.py +++ b/mic/imager/loop.py @@ -497,13 +497,13 @@ class LoopImageCreator(BaseImageCreator): self._check_imgdir() - msger.info("Copying attachment files...") + msger.info("Moving attachment files...") for item in self._attachment: if not os.path.exists(item): continue dpath = os.path.join(self._imgdir, os.path.basename(item)) - msger.verbose("Copy attachment %s to %s" % (item, dpath)) - shutil.copy(item, dpath) + msger.verbose("Move attachment %s to %s" % (item, dpath)) + shutil.move(item, dpath) def create_manifest(self): if self.compress_image: diff --git a/plugins/imager/fs_plugin.py b/plugins/imager/fs_plugin.py index c639211..b922b28 100755 --- a/plugins/imager/fs_plugin.py +++ b/plugins/imager/fs_plugin.py @@ -104,6 +104,7 @@ class FsPlugin(ImagerPlugin): creator.configure(creatoropts["repomd"]) creator.copy_kernel() + creator.copy_attachment() creator.unmount() creator.package(creatoropts["destdir"]) creator.create_manifest() diff --git a/plugins/imager/loop_plugin.py b/plugins/imager/loop_plugin.py index 0b94f0e..d81eb45 100755 --- a/plugins/imager/loop_plugin.py +++ b/plugins/imager/loop_plugin.py @@ -104,6 +104,7 @@ class LoopPlugin(ImagerPlugin): creator.tpkinstall() creator.configure(creatoropts["repomd"]) creator.copy_kernel() + creator.copy_attachment() creator.create_cpio_image() creator.unmount() creator.copy_cpio_image() diff --git a/plugins/imager/qcow_plugin.py b/plugins/imager/qcow_plugin.py index d6758c5..2cc9d43 100755 --- a/plugins/imager/qcow_plugin.py +++ b/plugins/imager/qcow_plugin.py @@ -135,6 +135,7 @@ class QcowPlugin(ImagerPlugin): creator.tpkinstall() creator.configure(creatoropts["repomd"]) creator.copy_kernel() + creator.copy_attachment() creator.create_cpio_image() creator.unmount() creator.copy_cpio_image() diff --git a/plugins/imager/raw_plugin.py b/plugins/imager/raw_plugin.py index e954b7b..7d44bc3 100755 --- a/plugins/imager/raw_plugin.py +++ b/plugins/imager/raw_plugin.py @@ -102,6 +102,7 @@ class RawPlugin(ImagerPlugin): creator.tpkinstall() creator.configure(creatoropts["repomd"]) creator.copy_kernel() + creator.copy_attachment() creator.unmount() creator.generate_bmap() creator.package(creatoropts["destdir"])