Skip to contentSkip to conversation

Best practice to debug a bbclass customization

DISCUSSION Marco Cavallini 2 participants 2 messages May 6, 2020

lore
Share & tools
lore
#0 lore raw

Hello,
I am experimenting bbclass customization creating a very trivial task called do_marco() to get a list of the recipes built during a bitbake call. I need to run this task each time bitbake is taking a recipe into account, adding INHERIT += "mycustom" in local.conf.

The problem is that whenever I modify the task source and I run bitbake I have a lot of recipes rebuilt as result. Is this expected or there is anything to set to avoid that?
What is the best practice to debug a bbclass customization?

# mycustom.bbclass
python do_marco () {
package = d.getVar('PN', True)
version = d.getVar('PV', True)
s = "$ \"{0}\",\"{1}\"\n".format(package,version)
with open("marco.txt", "a") as logFile:
logFile.write(s);
}
do_package[postfuncs] += "do_marco"

Thank you
--
Marco

#1 lore raw

Something like this does actually do the trick but isn't the most charming way (as it influences hashing a lot)

do_foo[vardepvalue] = "1"

do_foo() {
    bbwarn ${PN}
}

do_install[postfuncs] += "do_foo"

Now you can alter the "do_foo" function as much as you want for the hashing part "do_foo" will always remain "1"

Quoted 24 lines · Marco Cavallini

Hello,
I am experimenting bbclass customization creating a very trivial task called do_marco() to get a list of the recipes built during a bitbake call. I need to run this task each time bitbake is taking a recipe into account, adding INHERIT += "mycustom" in local.conf.

The problem is that whenever I modify the task source and I run bitbake I have a lot of recipes rebuilt as result. Is this expected or there is anything to set to avoid that?
What is the best practice to debug a bbclass customization?

# mycustom.bbclass
python do_marco () {
         package = d.getVar('PN', True)
         version = d.getVar('PV', True)
         s = "$ \"{0}\",\"{1}\"\n".format(package,version)
         with open("marco.txt", "a") as logFile:
                 logFile.write(s);
}
do_package[postfuncs] += "do_marco"

Thank you
--
Marco