diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-07-14 15:33:03 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-17 14:01:37 +0100 |
commit | f58ea8c81412344cae268960d13b968901f19577 (patch) | |
tree | 1f768705eeb26b99a01b0d373f1d5a477dfadb22 | |
parent | 116e14fc4531d63ad0872f2c5218bad04bdfb348 (diff) | |
download | poky-f58ea8c81412344cae268960d13b968901f19577.tar.gz |
wic: isoimage-isohybrid: check result of glob()
isoimage-isohybrid plugin uses result of glob call to
get path to initrd image. When glob returns empty list
the plugin crashes with IndexError.
Checking if result of glob call is not empty should fix
the breakage.
(From OE-Core rev: ad02f253f08a3da3fa5c86ae4f6ba7f94b070578)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index ffa5429962..ece4b0c19e 100644 --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py | |||
@@ -164,9 +164,12 @@ class IsoImagePlugin(SourcePlugin): | |||
164 | 164 | ||
165 | machine = os.path.basename(initrd_dir) | 165 | machine = os.path.basename(initrd_dir) |
166 | 166 | ||
167 | initrd = glob.glob('%s/%s*%s.%s' % (initrd_dir, image_name, machine, image_type))[0] | 167 | pattern = '%s/%s*%s.%s' % (initrd_dir, image_name, machine, image_type) |
168 | files = glob.glob(pattern) | ||
169 | if files: | ||
170 | initrd = files[0] | ||
168 | 171 | ||
169 | if not os.path.exists(initrd): | 172 | if not initrd or not os.path.exists(initrd): |
170 | # Create initrd from rootfs directory | 173 | # Create initrd from rootfs directory |
171 | initrd = "%s/initrd.cpio.gz" % cr_workdir | 174 | initrd = "%s/initrd.cpio.gz" % cr_workdir |
172 | initrd_dir = "%s/INITRD" % cr_workdir | 175 | initrd_dir = "%s/INITRD" % cr_workdir |