[oe] Question about building local sources without fetching

Carlos Rafael Giani dv at pseudoterminal.org
Thu Mar 5 12:15:31 UTC 2015


Hello,

we have a system where sources for a recipe are present in the same tree 
as the corresponding .bb recipe. They are all in the same git repository.
So, something like this example:

./src/ < C++ sources >
./build/poky/meta
./build/poky/meta-our-layer/recipes-custom/our-software.bb

I realize this is unusual, since in such a setup, we don't actually 
fetch sources (since they are already present in the same tree).
With such a setup, one problem is to determine when OE should rebuild 
the package. That is, how it should detect a change. We use the revision 
(the hash) of the current head of the git repo, and set PV to that git 
revision. This way, whenever the head is moved, the revision changes, 
and so does PV.

This worked fine up to and including Danny. After Danny, the behavior 
changed. If we moved the head back to an earlier commit, bitbake would 
not notice, and produce a version from a later commit.

Here is the excerpt from our recipe that does this PV modification:



# PV_DEFAULT is defined in .inc file so that it can be overwritten by 
packaging scripts
# this is used when we do not have any git info

def git_run(cmd, path):
     (output, error) = bb.process.run(cmd, cwd=path)
     return output.rstrip()

def check_git_describe(path, default):
     import os
     import bb.process

     try:
         ver = git_run("git describe --tags --long", path)
     except Exception, exc:
         ver = default

     return ver


require streamapp_intree_version.inc
PV = "${@check_git_describe('${S}', '${PV_DEFAULT}')}"

PR = "r14"

PACKAGES = "${PN}-dbg ${PN}"

# FILE_DIRNAME contains the full path of this .bb recipe
# Since we are building in tree we know apriori the relative location of 
the src
S = "${FILE_DIRNAME}/../../../.."

# packages which content depend on MACHINE_FEATURES need to be MACHINE_ARCH
PACKAGE_ARCH = "${MACHINE_ARCH}"


Does anybody have suggestions? Or, if somebody knows of a different way 
of doing builds from local sources, we'd like to hear about it.



More information about the Openembedded-devel mailing list