summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins
diff options
context:
space:
mode:
authorMaciej Borzecki <maciej.borzecki@open-rnd.pl>2014-12-10 12:45:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-19 18:08:02 +0000
commitcff6c481aa84d047c318b02b2877b64807ccc488 (patch)
treea661f8b704052e1accd4687cb76f30e19e6040c1 /scripts/lib/wic/plugins
parent90487dfbbbfcb4928cbcc25ba368f0196b5fc1ce (diff)
downloadpoky-cff6c481aa84d047c318b02b2877b64807ccc488.tar.gz
wic: add globbing support in IMAGE_BOOT_FILES entries
Adding glob support for entries in IMAGE_BOOT_FILES. Files picked up by glob are by default installed under their basename, as this is likely most common use case. Target name for globbed entries specifies the name of directory in which files will be installed withing the partition. (From OE-Core rev: 2c9635bdb97ddc80750c11d356e153a99d61cf09) Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-partition.py41
1 files changed, 32 insertions, 9 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 564118ad8b..6ba39a01f7 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -29,6 +29,7 @@ import re
29from wic import msger 29from wic import msger
30from wic.pluginbase import SourcePlugin 30from wic.pluginbase import SourcePlugin
31from wic.utils.oe.misc import * 31from wic.utils.oe.misc import *
32from glob import glob
32 33
33class BootimgPartitionPlugin(SourcePlugin): 34class BootimgPartitionPlugin(SourcePlugin):
34 name = 'bootimg-partition' 35 name = 'bootimg-partition'
@@ -87,7 +88,7 @@ class BootimgPartitionPlugin(SourcePlugin):
87 88
88 # list of tuples (src_name, dst_name) 89 # list of tuples (src_name, dst_name)
89 deploy_files = [] 90 deploy_files = []
90 for src_entry in re.findall(r'[\w;\-\./]+', boot_files): 91 for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files):
91 if ';' in src_entry: 92 if ';' in src_entry:
92 dst_entry = tuple(src_entry.split(';')) 93 dst_entry = tuple(src_entry.split(';'))
93 if not dst_entry[0] or not dst_entry[1]: 94 if not dst_entry[0] or not dst_entry[1]:
@@ -100,14 +101,36 @@ class BootimgPartitionPlugin(SourcePlugin):
100 101
101 for deploy_entry in deploy_files: 102 for deploy_entry in deploy_files:
102 src, dst = deploy_entry 103 src, dst = deploy_entry
103 src_path = os.path.join(bootimg_dir, src) 104 install_task = []
104 dst_path = os.path.join(hdddir, dst) 105 if '*' in src:
105 106 # by default install files under their basename
106 msger.debug('Install %s as %s' % (os.path.basename(src_path), 107 entry_name_fn = os.path.basename
107 dst_path)) 108 if dst != src:
108 install_cmd = "install -m 0644 -D %s %s" \ 109 # unless a target name was given, then treat name
109 % (src_path, dst_path) 110 # as a directory and append a basename
110 exec_cmd(install_cmd) 111 entry_name_fn = lambda name: \
112 os.path.join(dst,
113 os.path.basename(name))
114
115 srcs = glob(os.path.join(bootimg_dir, src))
116
117 msger.debug('Globbed sources: %s' % (', '.join(srcs)))
118 for entry in srcs:
119 entry_dst_name = entry_name_fn(entry)
120 install_task.append((entry,
121 os.path.join(hdddir,
122 entry_dst_name)))
123 else:
124 install_task = [(os.path.join(bootimg_dir, src),
125 os.path.join(hdddir, dst))]
126
127 for task in install_task:
128 src_path, dst_path = task
129 msger.debug('Install %s as %s' % (os.path.basename(src_path),
130 dst_path))
131 install_cmd = "install -m 0644 -D %s %s" \
132 % (src_path, dst_path)
133 exec_cmd(install_cmd)
111 134
112 msger.debug('Prepare boot partition using rootfs in %s' % (hdddir)) 135 msger.debug('Prepare boot partition using rootfs in %s' % (hdddir))
113 part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, 136 part.prepare_rootfs(cr_workdir, oe_builddir, hdddir,