[gnome-continuous-yocto/gnomeostree-3.28-rocko: 6744/8267] wic: isoimage-isohybrid: check result of glob()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 6744/8267] wic: isoimage-isohybrid: check result of glob()
- Date: Sun, 17 Dec 2017 05:16:29 +0000 (UTC)
commit f58ea8c81412344cae268960d13b968901f19577
Author: Ed Bartosh <ed bartosh linux intel com>
Date: Fri Jul 14 15:33:03 2017 +0300
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>
.../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 ffa5429..ece4b0c 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):
machine = os.path.basename(initrd_dir)
- initrd = glob.glob('%s/%s*%s.%s' % (initrd_dir, image_name, machine, image_type))[0]
+ pattern = '%s/%s*%s.%s' % (initrd_dir, image_name, machine, image_type)
+ files = glob.glob(pattern)
+ if files:
+ initrd = files[0]
- if not os.path.exists(initrd):
+ if not initrd or not os.path.exists(initrd):
# Create initrd from rootfs directory
initrd = "%s/initrd.cpio.gz" % cr_workdir
initrd_dir = "%s/INITRD" % cr_workdir
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]