1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

wic: 'wic cp' to copy from image

currently 'wic cp' only works for copy file from local storage to
wic image.

enhance 'wic cp' to copy file/directory from wic image to local storage.

include selftest and 'wic help' updates.

[YOCTO#12169]

(From OE-Core rev: bd669c1809a378f93580eb9e0679a26ec6746cb8)

Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chee Yang Lee
2019-11-21 14:28:52 +08:00
committed by Richard Purdie
parent 4d6a9708e6
commit 89288705c6
4 changed files with 76 additions and 21 deletions
+17
View File
@@ -866,6 +866,13 @@ class Wic2(WicTestCase):
self.assertEqual(8, len(result.output.split('\n')))
self.assertTrue(os.path.basename(testdir) in result.output)
# copy the file from the partition and check if it success
dest = '%s-cp' % testfile.name
runCmd("wic cp %s:1/%s %s -n %s" % (images[0],
os.path.basename(testfile.name), dest, sysroot))
self.assertTrue(os.path.exists(dest))
def test_wic_rm(self):
"""Test removing files and directories from the the wic image."""
runCmd("wic create mkefidisk "
@@ -1005,6 +1012,16 @@ class Wic2(WicTestCase):
newdirs = set(line.split()[-1] for line in result.output.split('\n') if line)
self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)]))
# check if the file to copy is in the partition
result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
self.assertTrue('fstab' in [line.split()[-1] for line in result.output.split('\n') if line])
# copy file from the partition, replace the temporary file content with it and
# check for the file size to validate the copy
runCmd("wic cp %s:2/etc/fstab %s -n %s" % (images[0], testfile.name, sysroot))
self.assertTrue(os.stat(testfile.name).st_size > 0)
def test_wic_rm_ext(self):
"""Test removing files from the ext partition."""
runCmd("wic create mkefidisk "