<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">&lt;<a target="_blank" href="mailto:liezhi.yang@windriver.com">liezhi.yang@windriver.com</a>&gt;</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 &lt;<a target="_blank" href="mailto:joshua.g.lock@intel.com">joshua.g.lock@intel.com</a>&gt;<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 = &quot;%s/%s-%s.qemuboot.conf&quot; % (deploy_dir_image,<br>
                         self.rootfs, machine)<br>
             else:<br>
-                cmd = &#39;ls -t %s/*.qemuboot.conf&#39; %  deploy_dir_image<br>
-                <a target="_blank" rel="noreferrer" href="http://logger.info">logger.info</a>(&#39;Running %s...&#39; % cmd)<br>
-                qbs = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout<wbr>.read().decode(&#39;utf-8&#39;)<br>
+                import glob<br>
+                qbs = glob.glob(&#39;%s/*.qemuboot.conf&#39; %  deploy_dir_image)<br>
</blockquote>
<br></span>
I&#39;m not sure about this, &quot;ls -lt&quot; will sort by time and we will use the<br>
latest one when the user run &quot;runqemu core-image-minimal qemux86&quot;, but<br>
glob.glob() seems can&#39;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&#39;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(&quot;Failed to find &lt;image&gt;.qemuboot.conf!&quot;)<br>
<br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Joshua Lock &lt;<a href="mailto:joshua.g.lock@intel.com">joshua.g.lock@intel.com</a>&gt;<br></div></div></div>
</div></div>