<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 5 September 2016 at 15:47, Robert Yang <span dir="ltr">&lt;<a href="mailto:liezhi.yang@windriver.com" target="_blank">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">Hi Josh,<br>
<br>
Thanks for fixing this, I got errors when test this patch:<br>
<br>
$ runqemu tmp/deploy/images/qemux86/<br>
runqemu - INFO - Running bitbake -e...<br>
Traceback (most recent call last):<br>
  File &quot;/buildarea/lyang1/poky/script<wbr>s/runqemu&quot;, line 864, in &lt;module&gt;<br>
    ret = main()<br>
  File &quot;/buildarea/lyang1/poky/script<wbr>s/runqemu&quot;, line 851, in main<br>
    config.read_qemuboot()<br>
  File &quot;/buildarea/lyang1/poky/script<wbr>s/runqemu&quot;, line 536, in read_qemuboot<br>
    self.qemuboot = qbs.split[0]<br>
AttributeError: &#39;list&#39; object has no attribute &#39;split&#39;<br></blockquote><div><br></div><div>Thanks for reviewing and catching this.<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">
And after your patches, it always need run &quot;bitbake -e&quot;, this makes<br>
us can&#39;t use runqemu when another build is running:<br>
ERROR: Only one copy of bitbake should be run against a build directory<br>
<br>
Maybe we check STAGING_DIR_NATIVE, STAGING_BINDIR_NATIVE<br>
and STAGING_DIR_HOST, if they are existed, then we don&#39;t need run bitbake -e.<br></blockquote><div><br></div><div>That&#39;s a nice idea, I&#39;ll implement that 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">
And please see my comments below.<div><div><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">
When we&#39;re running from a sourced OE build directory parse the<br>
STAGING_* directories from the bitbake environment, rather than<br>
using those hard-coded in the conf file.<br>
<br>
Signed-off-by: Joshua Lock &lt;<a href="mailto:joshua.g.lock@intel.com" target="_blank">joshua.g.lock@intel.com</a>&gt;<br>
---<br>
 scripts/runqemu | 22 ++++++++++++++++++++++<br>
 1 file changed, 22 insertions(+)<br>
<br>
diff --git a/scripts/runqemu b/scripts/runqemu<br>
index cfe7bff..5a97802 100755<br>
--- a/scripts/runqemu<br>
+++ b/scripts/runqemu<br>
@@ -555,6 +555,16 @@ class BaseConfig(object):<br>
                 <a rel="noreferrer" href="http://logger.info" target="_blank">logger.info</a>(&#39;Setting DEPLOY_DIR_IMAGE to folder containing %s (%s)&#39; % (self.qemuboot, imgdir))<br>
                 self.set(&#39;DEPLOY_DIR_IMAGE&#39;, imgdir)<br>
<br>
+        # When we&#39;re running from a sourced OE environment use the STAGING_*<br>
+        # directories from the environment.<br>
+        if self.bitbake_e:<br>
+            native_vars = [&#39;STAGING_DIR_NATIVE&#39;, &#39;STAGING_BINDIR_NATIVE&#39;]<br>
+            for nv in native_vars:<br>
+                s = re.search(&#39;^%s=&quot;(.*)&quot;&#39; % nv, self.bitbake_e, re.M)<br>
+                if s and s.group(1) != self.get(nv):<br>
+                    <a rel="noreferrer" href="http://logger.info" target="_blank">logger.info</a>(&#39;Overriding conf file setting of %s to %s from Bitbake environment&#39; % (nv, s.group(1)))<br>
+                    self.set(nv, s.group(1))<br>
+<br>
     def print_config(self):<br>
         <a rel="noreferrer" href="http://logger.info" target="_blank">logger.info</a>(&#39;Continuing with the following parameters:\n&#39;)<br>
         if not self.fstype in self.vmtypes:<br>
@@ -815,6 +825,17 @@ class BaseConfig(object):<br>
             shutil.rmtree(self.nfs_dir)<br>
             shutil.rmtree(&#39;%s.pseudo_stat<wbr>e&#39; % self.nfs_dir)<br>
<br>
+    def check_sourced_env(self):<br>
+        bitbake = shutil.which(&#39;bitbake&#39;)<br>
+        if bitbake and not self.bitbake_e:<br>
+            mach = self.get(&#39;MACHINE&#39;)<br>
+            if mach:<br>
+                cmd = &#39;MACHINE=%s bitbake -e&#39; % mach<br>
+            else:<br>
+                cmd = &#39;bitbake -e&#39;<br>
+            <a rel="noreferrer" href="http://logger.info" target="_blank">logger.info</a>(&#39;Running %s...&#39; % cmd)<br>
+            self.bitbake_e = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout<wbr>.read().decode(&#39;utf-8&#39;)<br>
</blockquote>
<br></div></div>
I think that we need check whether the command is successed<br>
or not, and print errors if it is failed to run.<span><font color="#888888"><br></font></span></blockquote><div><br></div><div>Sure, I&#39;ll implement that.<br><br></div><div>Joshua &lt;<a href="mailto:joshua.g.lock@intel.com">joshua.g.lock@intel.com</a>&gt;<br></div></div><br></div></div>