Skip to content
Snippets Groups Projects
Commit 893679f0 authored by Zygmunt Krynicki's avatar Zygmunt Krynicki
Browse files

Check out git branch before initializing bitbake


Stefan observed that CI job initializes bitbake with layer configuration
from the layer as checked out by git-repo, and only then switches to the
branch being tested.

This resulted in bitbake incorrectly failing to notice a layer that was
added by the tested patch.

The solution is to move all of the bitbake initialization stage from the
.build jobs "script_before" section, to the "script" section. In effect
any derivative job can use "script_before" to freely alter the source
tree before bitbake is initialized. Due to the lucky arrangement of YAML
anchors, the .build job's "script" keeps running with bitbake
environment sourced, so it can do exactly what one would expect - build
the desired recipe.

Signed-off-by: default avatarZygmunt Krynicki <zygmunt.krynicki@huawei.com>
parent 8b63d824
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,11 @@ stages: ...@@ -84,6 +84,11 @@ stages:
# the manifest file. # the manifest file.
- test -d "$SCRATCH_DIR"/workspace/sources || ( echo "assumption violated - expected the workspace to contain the sources directory" && ls "$SCRATCH_DIR"/workspace && exit 1 ) - test -d "$SCRATCH_DIR"/workspace/sources || ( echo "assumption violated - expected the workspace to contain the sources directory" && ls "$SCRATCH_DIR"/workspace && exit 1 )
script: &workspace-do
# Reload the value of SCRATCH_DIR set in the before_script phase. Those run
# in separate shell processes and do not share environment variables.
- SCRATCH_DIR="$(cat "$CI_PROJECT_DIR"/.scratch-dir-name)"
# Initialize bitbake build environment by sourcing the oe-init-build-env # Initialize bitbake build environment by sourcing the oe-init-build-env
# into the running bash process. This has the side-effect of changing the # into the running bash process. This has the side-effect of changing the
# current working directory and populating the $SCRATCH_DIR/workspace/build # current working directory and populating the $SCRATCH_DIR/workspace/build
...@@ -105,10 +110,6 @@ stages: ...@@ -105,10 +110,6 @@ stages:
# Collect stats just before the build. # Collect stats just before the build.
- du -sh "$SCRATCH_DIR"/workspace/build/* - du -sh "$SCRATCH_DIR"/workspace/build/*
script: &workspace-do
# Reload the value of SCRATCH_DIR set in the before_script phase. Those run
# in separate shell processes and do not share environment variables.
- SCRATCH_DIR="$(cat "$CI_PROJECT_DIR"/.scratch-dir-name)"
- cd "$SCRATCH_DIR"/workspace && . ./sources/poky/oe-init-build-env build - cd "$SCRATCH_DIR"/workspace && . ./sources/poky/oe-init-build-env build
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# NOTE: From now on, we are running inside "$SCRATCH_DIR"/workspace/build # NOTE: From now on, we are running inside "$SCRATCH_DIR"/workspace/build
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment