<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7614</bug_id>
          
          <creation_ts>2015-04-15 18:07:14 +0000</creation_ts>
          <short_desc>devtool within extensible SDK does not work with dash as /bin/sh</short_desc>
          <delta_ts>2015-04-26 12:41:48 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>1.8</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.9 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Paul Eggleton">bluelightning</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>50323</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-04-15 18:07:14 +0000</bug_when>
    <thetext>If you have dash as /bin/sh (as you do by default on Ubuntu), running devtool within the SDK does not work, because apparently oe-init-build-env does not work the same way under dash as it does under bash. 

&quot;devtool add&quot; fails because oe-init-build-env looks in the wrong place for oe-buildenv-internal; this is because oe-init-build-env falls back to the current directory as OEROOT when not under bash/zsh.

If we work around that by setting the current directory to the actual OE root, when we run &quot;devtool build&quot;, bitbake claims that the specified recipe doesn&apos;t exist because a new build directory is being created instead of the one we&apos;ve already set up, and that new one doesn&apos;t have the workspace layer in its bblayers.conf. This is apparently because any argument you pass to a sourced script (in this case, the build directory) doesn&apos;t actually get passed to the script.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50374</commentid>
    <comment_count>1</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2015-04-17 07:18:33 +0000</bug_when>
    <thetext>Hi Paul,

How about setting executable to bash like below?

Regards,
Chen Qi

diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 3f8158e..7e7908d 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -27,6 +27,10 @@ logger = logging.getLogger(&apos;devtool&apos;)
 
 def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
     import bb
+    # As the init script makes use of BASH_SOURCE to determine OEROOT, we need to set
+    # executable to bash to correctly set things up
+    if not &apos;executable&apos; in options:
+        options[&quot;executable&quot;] = &apos;bash&apos;
     if not &apos;cwd&apos; in options:
         options[&quot;cwd&quot;] = builddir
     if init_path:</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50376</commentid>
    <comment_count>2</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-04-17 08:41:35 +0000</bug_when>
    <thetext>I asked Richard about this and his suggestion was to set BDIR instead (having ensured that the current directory is set to avoid the first issue).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50399</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-04-18 09:14:13 +0000</bug_when>
    <thetext>To be honest I&apos;m flexible with either approach...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50427</commentid>
    <comment_count>4</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-04-20 16:49:38 +0000</bug_when>
    <thetext>OK, on reflection I&apos;ve taken Qi&apos;s fix as it&apos;s simpler (thanks Qi!).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50511</commentid>
    <comment_count>5</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-04-26 12:41:48 +0000</bug_when>
    <thetext>Fix merged to master:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=5b1a6abcdedb51aee9b0a80d4c9a1ded6243f6e9</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>