3

Hi under my bitbake file I want to stop the execution of certain tasks and want compile function to be executed every time. For this, I have done the following changes.

do_compile[nostamp] = "1" 
do_clean[noexec] = "1" 
do_cleanall[noexec] = "1" 
do_cleansstate[noexec] = "1" 
do_fetch[noexec] = "1" 
do_patch[noexec] = "1" 
do_unpack[noexec] = "1"

And it worked perfectly fine. I was able to stop the execution of tasks like clean, cleanall, cleansstate, fetch, patch and unpack. Also, I was able to make sure that the compile task runs every time.

However, I want to put some restrictions on the same. I want to make sure that noexec and nostamp on relevant task only applies when DEVMODE variable is set to 1. Psuedo code as follows.

if DEVMODE == 1 then
    do_compile[nostamp] = "1" 
    do_clean[noexec] = "1" 
    do_cleanall[noexec] = "1" 
    do_cleansstate[noexec] = "1" 
    do_fetch[noexec] = "1" 
    do_patch[noexec] = "1" 
    do_unpack[noexec] = "1"
endif

How to achieve the same in a bitbake file? I have tried this and this links but I am not able to craft a working if condition.

NOTE: Am ok using BB_ENV_EXTRAWHITE, but am not able to code a working if condition for the bitbake file.

Sunny Shukla
  • 537
  • 1
  • 6
  • 17

1 Answers1

1

Use python anonymous function could work for you.

python () {
    #add "export DEVMODE=1" under conf/setenv
    #add DEVMODE under BB_ENV_EXTRAWHITE variable under conf/setenv

    if d.getVar("DEVMODE", True) == "1":
        d.setVarFlag("do_compile", 'nostamp', "1")
}

Or set directly:

do_compile[nostamp] = "${@'1' if d.getVar('DEVMODE') == '1' else '0'}"
planetmaker
  • 5,884
  • 3
  • 28
  • 37
Kai
  • 356
  • 1
  • 6
  • I have edited the answer, the edited code has worked for me, please accept the edit so that I can accept it as an answer. – Sunny Shukla Sep 27 '18 at 12:09
  • @SunnyShukla, d.getVar() doesn't need explict option 'True' right now that it is the default value. – Kai Oct 16 '18 at 06:15