summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiaojuan.mao <xiaojuan.mao@samsung.com>2017-07-13 13:58:05 +0800
committerxiaojuan.mao <xiaojuan.mao@samsung.com>2017-07-13 14:00:00 +0800
commite319a7011290ec4a5458f0e8ffcb1482de06805d (patch)
treeaa219b24ac42e9b6da22d6b0974cd4b992972a99
parenta9ea35b7087e1face424a72e939945f6a34756d1 (diff)
downloadmic-e319a7011290ec4a5458f0e8ffcb1482de06805d.tar.gz
mic-e319a7011290ec4a5458f0e8ffcb1482de06805d.tar.bz2
mic-e319a7011290ec4a5458f0e8ffcb1482de06805d.zip
fix the bug that modify the order of generating image by cpio.
Change-Id: I86b9a79a4cca110c7e4cafe0bab48cf6bd94a278
-rwxr-xr-xmic/imager/baseimager.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py
index 616225f..e0340a1 100755
--- a/mic/imager/baseimager.py
+++ b/mic/imager/baseimager.py
@@ -1261,7 +1261,7 @@ class BaseImageCreator(object):
for item in self._instloops:
if item['cpioopts']:
msger.info("Create image by cpio.")
- tmp_cpio = self.__builddir + "/tmp_cpio"
+ tmp_cpio = self.__builddir + "/tmp-cpio"
if not os.path.exists(tmp_cpio):
os.mkdir(tmp_cpio)
tmp_cpio_imgfile = os.path.join(tmp_cpio, item['name'])
@@ -1269,19 +1269,20 @@ class BaseImageCreator(object):
cpiocmd = fs.find_binary_path('cpio')
if cpiocmd:
oldoutdir = os.getcwd()
- os.chdir(tmp_cpio)
+ os.chdir(os.path.join(self._instroot, item['mountpoint'].lstrip('/')))
# find . | cpio --create --'format=newc' | gzip > ../ramdisk.img
runner.show('find . | cpio --create %s | gzip > %s' % (item['cpioopts'], tmp_cpio_imgfile))
os.chdir(oldoutdir)
except OSError, (errno, msg):
raise errors.CreatorError("Create image by cpio error: %s" % msg)
+
def copy_cpio_image(self):
for item in self._instloops:
if item['cpioopts']:
- tmp_cpio = self.__builddir + "/tmp_cpio"
- msger.info("Copy cpio image from %s to %s." %(tmp_cpio, self._imgdir))
+ tmp_cpio = self.__builddir + "/tmp-cpio"
+ msger.info("Copy cpio image from %s to %s." %(tmp_cpio, self._imgdir))
try:
- shutil.copyfile(os.path.join(tmp_cpio, item['name']),os.path.join(self._imgdir, item['name']))
+ shutil.copyfile(os.path.join(tmp_cpio, item['name']),os.path.join(self._imgdir, item['name']))
except IOError:
raise errors.CreatorError("Copy cpio image error")
os.remove(os.path.join(tmp_cpio, item['name']))