|
@@ -117,10 +117,10 @@ def check_tun():
|
|
|
if not os.access(dev_tun, os.W_OK):
|
|
|
raise RunQemuError("TUN control device %s is not writable, please fix (e.g. sudo chmod 666 %s)" % (dev_tun, dev_tun))
|
|
|
|
|
|
-def get_first_file(cmds):
|
|
|
- """Return first file found in wildcard cmds"""
|
|
|
- for cmd in cmds:
|
|
|
- all_files = glob.glob(cmd)
|
|
|
+def get_first_file(globs):
|
|
|
+ """Return first file found in wildcard globs"""
|
|
|
+ for g in globs:
|
|
|
+ all_files = glob.glob(g)
|
|
|
if all_files:
|
|
|
for f in all_files:
|
|
|
if not os.path.isdir(f):
|
|
@@ -683,12 +683,12 @@ class BaseConfig(object):
|
|
|
self.rootfs, self.get('MACHINE'),
|
|
|
self.fstype)
|
|
|
elif not self.rootfs:
|
|
|
- cmd_name = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_NAME'), self.fstype)
|
|
|
- cmd_link = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'), self.fstype)
|
|
|
- cmds = (cmd_name, cmd_link)
|
|
|
- self.rootfs = get_first_file(cmds)
|
|
|
+ glob_name = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_NAME'), self.fstype)
|
|
|
+ glob_link = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'), self.fstype)
|
|
|
+ globs = (glob_name, glob_link)
|
|
|
+ self.rootfs = get_first_file(globs)
|
|
|
if not self.rootfs:
|
|
|
- raise RunQemuError("Failed to find rootfs: %s or %s" % cmds)
|
|
|
+ raise RunQemuError("Failed to find rootfs: %s or %s" % globs)
|
|
|
|
|
|
if not os.path.exists(self.rootfs):
|
|
|
raise RunQemuError("Can't find rootfs: %s" % self.rootfs)
|
|
@@ -748,10 +748,10 @@ class BaseConfig(object):
|
|
|
kernel_match_name = "%s/%s" % (deploy_dir_image, kernel_name)
|
|
|
kernel_match_link = "%s/%s" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE'))
|
|
|
kernel_startswith = "%s/%s*" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE'))
|
|
|
- cmds = (kernel_match_name, kernel_match_link, kernel_startswith)
|
|
|
- self.kernel = get_first_file(cmds)
|
|
|
+ globs = (kernel_match_name, kernel_match_link, kernel_startswith)
|
|
|
+ self.kernel = get_first_file(globs)
|
|
|
if not self.kernel:
|
|
|
- raise RunQemuError('KERNEL not found: %s, %s or %s' % cmds)
|
|
|
+ raise RunQemuError('KERNEL not found: %s, %s or %s' % globs)
|
|
|
|
|
|
if not os.path.exists(self.kernel):
|
|
|
raise RunQemuError("KERNEL %s not found" % self.kernel)
|
|
@@ -768,13 +768,13 @@ class BaseConfig(object):
|
|
|
dtb = self.get('QB_DTB')
|
|
|
if dtb:
|
|
|
deploy_dir_image = self.get('DEPLOY_DIR_IMAGE')
|
|
|
- cmd_match = "%s/%s" % (deploy_dir_image, dtb)
|
|
|
- cmd_startswith = "%s/%s*" % (deploy_dir_image, dtb)
|
|
|
- cmd_wild = "%s/*.dtb" % deploy_dir_image
|
|
|
- cmds = (cmd_match, cmd_startswith, cmd_wild)
|
|
|
- self.dtb = get_first_file(cmds)
|
|
|
+ glob_match = "%s/%s" % (deploy_dir_image, dtb)
|
|
|
+ glob_startswith = "%s/%s*" % (deploy_dir_image, dtb)
|
|
|
+ glob_wild = "%s/*.dtb" % deploy_dir_image
|
|
|
+ globs = (glob_match, glob_startswith, glob_wild)
|
|
|
+ self.dtb = get_first_file(globs)
|
|
|
if not os.path.exists(self.dtb):
|
|
|
- raise RunQemuError('DTB not found: %s, %s or %s' % cmds)
|
|
|
+ raise RunQemuError('DTB not found: %s, %s or %s' % globs)
|
|
|
|
|
|
def check_bios(self):
|
|
|
"""Check and set bios"""
|