All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH V2 1/6] scripts/runqemu: fix checking for <file>.cpio.gz
Date: Tue, 6 Dec 2016 00:55:16 -0800	[thread overview]
Message-ID: <16b03179d8e01629a21eb2f80dd2f957fb893013.1481014270.git.liezhi.yang@windriver.com> (raw)
In-Reply-To: <cover.1481014270.git.liezhi.yang@windriver.com>

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.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 scripts/runqemu | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index af25423..c737eb2 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -269,19 +269,29 @@ class BaseConfig(object):
             self.kernel =  p
         elif os.path.exists(p) and (not os.path.isdir(p)) and re.search('-image-', os.path.basename(p)):
             self.rootfs = p
-            dirpath = os.path.dirname(p)
-            m = re.search('(.*)\.(.*)$', p)
-            if m:
-                qb = '%s%s' % (re.sub('\.rootfs$', '', m.group(1)), '.qemuboot.conf')
+            # Check filename against self.fstypes can hanlde <file>.cpio.gz,
+            # otherwise, its type would be "gz", which is incorrect.
+            fst = ""
+            for t in self.fstypes:
+                if p.endswith(t):
+                    fst = t
+                    break
+            if not fst:
+                m = re.search('.*\.(.*)$', self.rootfs)
+                if m:
+                    fst =  m.group(1)
+            if fst:
+                self.check_arg_fstype(fst)
+                qb = re.sub('\.' + fst + "$", '', self.rootfs)
+                qb = '%s%s' % (re.sub('\.rootfs$', '', qb), '.qemuboot.conf')
                 if os.path.exists(qb):
                     self.qemuboot = qb
                     self.qbconfload = True
                 else:
                     logger.warn("%s doesn't exist" % qb)
-                fst = m.group(2)
-                self.check_arg_fstype(fst)
             else:
                 raise Exception("Can't find FSTYPE from: %s" % p)
+
         elif os.path.isdir(p) or re.search(':', arg) and re.search('/', arg):
             if self.is_deploy_dir_image(p):
                 logger.info('DEPLOY_DIR_IMAGE: %s' % p)
-- 
2.9.0



  reply	other threads:[~2016-12-06  8:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06  8:55 [PATCH V2 0/6] runqemu: fix for slirp, network device and hostfwd Robert Yang
2016-12-06  8:55 ` Robert Yang [this message]
2016-12-06  8:55 ` [PATCH V2 2/6] qemuboot.bbclass: use IMGDEPLOYDIR Robert Yang
2016-12-06  8:55 ` [PATCH V2 3/6] runqemu-export-rootfs: fix inconsistent var names Robert Yang
2016-12-06  8:55 ` [PATCH V2 4/6] runqemu: support mutiple qemus running when nfs Robert Yang
2016-12-14  9:45   ` Robert Yang
2016-12-06  8:55 ` [PATCH V2 5/6] runqemu: fixes for slirp, network device and hostfwd Robert Yang
2016-12-07 17:58   ` Randy Witt
2016-12-12  3:31     ` Robert Yang
2016-12-06  8:55 ` [PATCH V2 6/6] qemuboot.bbclass: add blank lines in comments Robert Yang
2016-12-06  9:01 ` [PATCH V2 0/6] runqemu: fix for slirp, network device and hostfwd Robert Yang
2016-12-07 16:50   ` Nathan Rossi
2016-12-21  6:24 ` Robert Yang
2017-01-11  1:47   ` Robert Yang
2017-01-17 13:14     ` Burton, Ross
2017-01-18  9:25       ` Robert Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16b03179d8e01629a21eb2f80dd2f957fb893013.1481014270.git.liezhi.yang@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.