From: Robert Yang <liezhi.yang@windriver.com>
To: Joshua Lock <joshuagloe@gmail.com>,
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 2/4] runqemu: use glob rather than calling out to ls
Date: Mon, 5 Sep 2016 22:51:34 +0800 [thread overview]
Message-ID: <62b6b79b-1f8f-1181-6e57-e9dd0ad61ca3@windriver.com> (raw)
In-Reply-To: <dc7a6ed9ea99d08af5f2a5945caffb3b6e0fd12c.1473083836.git.joshua.g.lock@intel.com>
On 09/05/2016 09:59 PM, Joshua Lock wrote:
> Use the Python glob module to find files matching a pattern, rather
> than calling out to ls and parsing the output.
>
> Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
> ---
> scripts/runqemu | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index 72c6352..1599848 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -528,11 +528,10 @@ class BaseConfig(object):
> self.qemuboot = "%s/%s-%s.qemuboot.conf" % (deploy_dir_image,
> self.rootfs, machine)
> else:
> - cmd = 'ls -t %s/*.qemuboot.conf' % deploy_dir_image
> - logger.info('Running %s...' % cmd)
> - qbs = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
> + import glob
> + qbs = glob.glob('%s/*.qemuboot.conf' % deploy_dir_image)
I'm not sure about this, "ls -lt" will sort by time and we will use the
latest one when the user run "runqemu core-image-minimal qemux86", but
glob.glob() seems can't do this.
I have to go to sleep now, have a good day, talk to you tomorrow.
// Robert
> if qbs:
> - self.qemuboot = qbs.split()[0]
> + self.qemuboot = qbs.split[0]
>
> if not os.path.exists(self.qemuboot):
> raise Exception("Failed to find <image>.qemuboot.conf!")
>
next prev parent reply other threads:[~2016-09-05 14:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 13:59 [PATCH 0/4] Python3 runqemu Joshua Lock
2016-09-05 13:59 ` [PATCH 1/4] runqemu: fix typos Joshua Lock
2016-09-05 13:59 ` [PATCH 2/4] runqemu: use glob rather than calling out to ls Joshua Lock
2016-09-05 14:51 ` Robert Yang [this message]
2016-09-05 15:51 ` Joshua Lock
2016-09-05 13:59 ` [PATCH 3/4] runqemu: assume artefacts are relative to *.qemuboot.conf Joshua Lock
2016-09-05 13:59 ` [PATCH 4/4] runqemu: get NATIVE dirs from env when in source OE build dir Joshua Lock
2016-09-05 14:47 ` Robert Yang
2016-09-05 15:49 ` Joshua Lock
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=62b6b79b-1f8f-1181-6e57-e9dd0ad61ca3@windriver.com \
--to=liezhi.yang@windriver.com \
--cc=joshuagloe@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox