Bug 9114

Summary: It is not clear how to manually run tasks from the devshell
Product: [Documentation] Development Manual Reporter: ulfalizer
Component: developmentAssignee: Scott Rifenbark <srifenbark>
Status: VERIFIED FIXED QA Contact: Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu>
Severity: normal    
Priority: Medium+ CC: bogdanx.a.voiculescu, joshuagloe, srifenbark
Version: 2.2   
Target Milestone: 2.1 M4   
Hardware: x86   
OS: Multiple   
Whiteboard: 3 March 2016: RESOLVED
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)

Description ulfalizer 2016-02-15 08:55:06 UTC
Knowing how to do this can be very handy. I'd add something like the following to section 4.5 - Using a Development Shell:


Specific tasks can be run manually from the devshell by running the corresponding run.* scripts in ${WORKDIR}/temp - e.g., run.do_configure.<pid>. If the task's script does not exist (e.g., because the task was skipped via the sstate cache), it can be created by first running 'bitbake -c <task>' outside of the devshell.
Comment 1 Joshua Lock 2016-02-18 15:42:30 UTC
*** Bug 9128 has been marked as a duplicate of this bug. ***
Comment 2 Joshua Lock 2016-02-18 15:42:52 UTC
From #9128:

"Some developers expect that once in a devshell they can call commands as if in a normal shell, whereas the reality is that the devshell is a mechanism to get into the bitbake task execution environment and commands must be called in the same manner as bitbake calls them i.e. with appropriate options for cross-compilation, etc.

We should update the "Using the development shell" section of the developer manual to make this clearer.

Furthermore we could point out that a user can use the run.do_* files in temp to a) look at how the tasks are run by bitbake and b) run the commands exactly as bitbake does.

i.e. if I'm in a devshell for connman in a build directory where connman has already built I can re-run the compilation steps by calling ../temp/run.do_compile"
Comment 3 Scott Rifenbark 2016-02-18 17:24:00 UTC
Hi, 

Please see http://www.yoctoproject.org/docs/2.1/dev-manual/dev-manual.html#platdev-appdev-devshell and provide feedback on the changes.

Thanks,
Scott
Comment 4 Joshua Lock 2016-02-23 12:32:51 UTC
" To manually run a specific task using devshell, run the corresponding run.* script in the ${WORKDIR}/temp (e.g., run.do_configure.pid). If a task's script does not exist, which would be the case if the task was skipped by way of the sstate cache, you can create the task by first running it outside of the devshell:

     $ bitbake -c task
"

Two improvements I'd like to see:
1) can we somehow emphasis that the run script is exactly what bitbake runs and therefore executing it re-runs the task exactly as bitbake would do. I couldn't readily form a reedit to include this without changing it into an unwieldy mess of words…
2) it would be worth pointing out (or linking elsewhere that points this out if we have a general section on temp layout, .run & .log files) that the .run file without a pid extension is a symlink to the most recent version of that file.
Comment 5 Scott Rifenbark 2016-02-23 15:55:18 UTC
Joshua, 

Look that section over again.  I added a "Notes" box.  Let me know if that works.

Scott
Comment 6 ulfalizer 2016-02-24 17:50:29 UTC
Here's two more things that might be worth adding/changing:

 * "When you invoke devshell, source files are extracted into your working directory and patches are applied" could be put a bit more explicitly as "When you invoke devshell, all tasks up to and including do_patch are run for the specified target".

 * "Then, a new terminal is opened and you are placed in the working directory" seems wrong from looking at meta/classes/devshell.bbclass, which has 

   DEVSHELL_STARTDIR ?= "${S}"

   Maybe "then, a new terminal opened and you are placed in ${S}, the source directory".
Comment 7 ulfalizer 2016-02-24 17:55:03 UTC
(Small unrelated note:

I just noticed do_devpyshell in devshell.bbclass. That one seems to be undocumented.)
Comment 8 ulfalizer 2016-02-24 17:56:05 UTC
(In reply to comment #6)
> Here's two more things that might be worth adding/changing:
> 
>  * "When you invoke devshell, source files are extracted into your working
> directory and patches are applied" could be put a bit more explicitly as
> "When you invoke devshell, all tasks up to and including do_patch are run
> for the specified target".
> 
>  * "Then, a new terminal is opened and you are placed in the working
> directory" seems wrong from looking at meta/classes/devshell.bbclass, which
> has 
> 
>    DEVSHELL_STARTDIR ?= "${S}"
> 
>    Maybe "then, a new terminal opened and you are placed in ${S}, the source
> directory".

"a new terminal IS opened" even.
Comment 9 ulfalizer 2016-02-24 18:06:34 UTC
One more: "...run the corresponding run.* script in the ${WORKDIR}/temp (e.g., run.do_configure.pid)" is missing "directory" before the opening parenthesis.
Comment 10 Scott Rifenbark 2016-02-24 23:12:08 UTC
Hi, 

I have addressed all these except for Comment 7.  I am going to open a separate bug for documenting that class (see Bug 9166).  Please look at http://www.yoctoproject.org/docs/2.1/dev-manual/dev-manual.html#platdev-appdev-devshell for the other changes. 

Thanks, 
Scott
Comment 11 ulfalizer 2016-02-25 19:36:45 UTC
Looks good. Thanks.
Comment 12 Scott Rifenbark 2016-03-03 17:18:20 UTC
Thanks, 

Setting status to RESOLVED and moving the doc flag to "done."

Scott
Comment 13 Bogdan Alexandru Voiculescu 2016-03-07 15:54:57 UTC
Verified