diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2016-11-22 01:26:32 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-19 22:47:20 +0000 |
commit | 65a8d4d185e7456fae020326641e8c1e404ea689 (patch) | |
tree | 295a3569849c0dfd80dd38de43df6ebce08139df | |
parent | 55aa669750db9ef9c8884e99dcb76850b0fac5b0 (diff) | |
download | poky-65a8d4d185e7456fae020326641e8c1e404ea689.tar.gz |
scripts/runqemu: fix checking for <file>.cpio.gz
When "runqemu /path/to/<file>.cpio.gz", it used the last suffix "gz" as
the fstype which was wrong. Check filename against self.fstypes firstly
can fix the problem.
(From OE-Core rev: 68c7589b67a83977331a04356b53aa51680a1d9d)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/runqemu | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 83ec337e14..434b1c2ec7 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -269,19 +269,29 @@ class BaseConfig(object): | |||
269 | self.kernel = p | 269 | self.kernel = p |
270 | elif os.path.exists(p) and (not os.path.isdir(p)) and re.search('-image-', os.path.basename(p)): | 270 | elif os.path.exists(p) and (not os.path.isdir(p)) and re.search('-image-', os.path.basename(p)): |
271 | self.rootfs = p | 271 | self.rootfs = p |
272 | dirpath = os.path.dirname(p) | 272 | # Check filename against self.fstypes can hanlde <file>.cpio.gz, |
273 | m = re.search('(.*)\.(.*)$', p) | 273 | # otherwise, its type would be "gz", which is incorrect. |
274 | if m: | 274 | fst = "" |
275 | qb = '%s%s' % (re.sub('\.rootfs$', '', m.group(1)), '.qemuboot.conf') | 275 | for t in self.fstypes: |
276 | if p.endswith(t): | ||
277 | fst = t | ||
278 | break | ||
279 | if not fst: | ||
280 | m = re.search('.*\.(.*)$', self.rootfs) | ||
281 | if m: | ||
282 | fst = m.group(1) | ||
283 | if fst: | ||
284 | self.check_arg_fstype(fst) | ||
285 | qb = re.sub('\.' + fst + "$", '', self.rootfs) | ||
286 | qb = '%s%s' % (re.sub('\.rootfs$', '', qb), '.qemuboot.conf') | ||
276 | if os.path.exists(qb): | 287 | if os.path.exists(qb): |
277 | self.qemuboot = qb | 288 | self.qemuboot = qb |
278 | self.qbconfload = True | 289 | self.qbconfload = True |
279 | else: | 290 | else: |
280 | logger.warn("%s doesn't exist" % qb) | 291 | logger.warn("%s doesn't exist" % qb) |
281 | fst = m.group(2) | ||
282 | self.check_arg_fstype(fst) | ||
283 | else: | 292 | else: |
284 | raise Exception("Can't find FSTYPE from: %s" % p) | 293 | raise Exception("Can't find FSTYPE from: %s" % p) |
294 | |||
285 | elif os.path.isdir(p) or re.search(':', arg) and re.search('/', arg): | 295 | elif os.path.isdir(p) or re.search(':', arg) and re.search('/', arg): |
286 | if self.is_deploy_dir_image(p): | 296 | if self.is_deploy_dir_image(p): |
287 | logger.info('DEPLOY_DIR_IMAGE: %s' % p) | 297 | logger.info('DEPLOY_DIR_IMAGE: %s' % p) |