<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 5 September 2016 at 15:51, Robert Yang <span dir="ltr"><<a target="_blank" href="mailto:liezhi.yang@windriver.com">liezhi.yang@windriver.com</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span class="gmail-"><br>
<br>
On 09/05/2016 09:59 PM, Joshua Lock wrote:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
Use the Python glob module to find files matching a pattern, rather<br>
than calling out to ls and parsing the output.<br>
<br>
Signed-off-by: Joshua Lock <<a target="_blank" href="mailto:joshua.g.lock@intel.com">joshua.g.lock@intel.com</a>><br>
---<br>
scripts/runqemu | 7 +++----<br>
1 file changed, 3 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/scripts/runqemu b/scripts/runqemu<br>
index 72c6352..1599848 100755<br>
--- a/scripts/runqemu<br>
+++ b/scripts/runqemu<br>
@@ -528,11 +528,10 @@ class BaseConfig(object):<br>
self.qemuboot = "%s/%s-%s.qemuboot.conf" % (deploy_dir_image,<br>
self.rootfs, machine)<br>
else:<br>
- cmd = 'ls -t %s/*.qemuboot.conf' % deploy_dir_image<br>
- <a target="_blank" rel="noreferrer" href="http://logger.info">logger.info</a>('Running %s...' % cmd)<br>
- qbs = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout<wbr>.read().decode('utf-8')<br>
+ import glob<br>
+ qbs = glob.glob('%s/*.qemuboot.conf' % deploy_dir_image)<br>
</blockquote>
<br></span>
I'm not sure about this, "ls -lt" will sort by time and we will use the<br>
latest one when the user run "runqemu core-image-minimal qemux86", but<br>
glob.glob() seems can't do this.<br></blockquote><div><br></div><div>We could ensure the list returned by glob is sorted, whilst I prefer to avoid calling out to the shell unnecessarily I'm not really attached to this change and can drop it for v2 of the series.<br></div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
I have to go to sleep now, have a good day, talk to you tomorrow.<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Thanks for the review!<br></div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span class="gmail-HOEnZb"><font color="#888888">
// Robert</font></span><div class="gmail-HOEnZb"><div class="gmail-h5"><br>
<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
if qbs:<br>
- self.qemuboot = qbs.split()[0]<br>
+ self.qemuboot = qbs.split[0]<br>
<br>
if not os.path.exists(self.qemuboot):<br>
raise Exception("Failed to find <image>.qemuboot.conf!")<br>
<br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Joshua Lock <<a href="mailto:joshua.g.lock@intel.com">joshua.g.lock@intel.com</a>><br></div></div></div>
</div></div>