[yocto] Recipe with dynamic variable in do_compile not rebuilding
Craig McQueen
craig.mcqueen at innerrange.com
Mon Jul 20 19:45:02 PDT 2015
I want to make an 'os-build-revisions' package that will create /etc/os-build-revisions containing a list of git revisions in all layers.
I've quoted the recipe below. It mostly works. However, it's not rebuilding if a layer changes its git revision.
I've used := on OS_BUILD_REVISIONS, and I've used do_compile[vardeps] and tried do_compile[nostamp], but it doesn't seem to help.
I've also run 'bitbake os-build-revisions -e' and confirmed that OS_BUILD_REVISIONS contains the updated git revision value. But it still doesn't trigger a rebuild of the package. What do I need to add to ensure that the package rebuilds whenever OS_BUILD_REVISIONS changes?
os-build-revisions.bb:
---------------------------------
inherit allarch
SUMMARY = "Yocto build revisions"
DESCRIPTION = "The /etc/os-build-revisions file contains data about git revisions of layers used in the build."
LICENSE = "MIT"
INHIBIT_DEFAULT_DEPS = "1"
do_fetch[noexec] = "1"
do_unpack[noexec] = "1"
do_patch[noexec] = "1"
do_configure[noexec] = "1"
def buildhistory_get_metadata_revs(d):
# We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want
layers = (d.getVar("BBLAYERS", True) or "").split()
metadata_revs = []
for layer in layers:
name = os.path.basename(layer)
branch = base_get_metadata_git_branch(layer, None).strip()
revision = base_get_metadata_git_revision(layer, None)
metadata_revs.append('{0:17} = {1}:{2}'.format(name, branch, revision))
return '\n'.join(metadata_revs)
OS_BUILD_REVISIONS := "${@buildhistory_get_metadata_revs(d)}"
do_compile() {
echo "${OS_BUILD_REVISIONS}" > ${B}/os-build-revisions
}
do_compile[vardeps] += "OS_BUILD_REVISIONS"
do_compile[nostamp] += "1"
do_install () {
install -d ${D}${sysconfdir}
install -m 0644 os-build-revisions ${D}${sysconfdir}/
}
More information about the yocto
mailing list