Skip to content

Commit 68eaa87

Browse files
committed
ci: build-yocto: switch to kas-shell-helper
Adapt all ci/scripts as now the TOPDIR and KAS_WORK_DIR are received as an argument from the kas-shell-helper: - REPO_DIR is the previous TOPDIR - WORK_DIR is the previous KAS_WORK_DIR Signed-off-by: Jose Quaresma <[email protected]>
1 parent 49e4bc9 commit 68eaa87

File tree

4 files changed

+65
-26
lines changed

4 files changed

+65
-26
lines changed

.github/workflows/build-yocto.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252

5353
- name: Run yocto-check-layer
5454
run: |
55-
ci/yocto-check-layer.sh
55+
ci/kas-shell-helper.sh ci/yocto-check-layer.sh
5656
5757
yocto-patchreview:
5858
needs: kas-setup
@@ -70,7 +70,7 @@ jobs:
7070

7171
- name: Run Yocto patchreview
7272
run: |
73-
ci/yocto-patchreview.sh
73+
ci/kas-shell-helper.sh ci/yocto-patchreview.sh
7474
7575
compile:
7676
needs: kas-setup
@@ -110,7 +110,8 @@ jobs:
110110
kas dump --resolve-env --resolve-local --resolve-refs \
111111
ci/mirror.yml:ci/${{ matrix.machine }}.yml > kas-build.yml
112112
kas build ci/mirror.yml:ci/${{ matrix.machine }}.yml
113-
ci/yocto-pybootchartgui.sh && mv $KAS_WORK_DIR/build/buildchart.svg .
113+
ci/kas-shell-helper.sh ci/yocto-pybootchartgui.sh
114+
mv $KAS_WORK_DIR/build/buildchart.svg .
114115
115116
if [ "${{ matrix.machine }}" = "qcom-armv8a" ]; then
116117
kas build ci/mirror.yml:ci/${{ matrix.machine }}.yml:ci/initramfs-test.yml

ci/yocto-check-layer.sh

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,36 @@
22
# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
33
# SPDX-License-Identifier: MIT
44

5-
TOPDIR=$(realpath $(dirname $(readlink -f $0))/..)
5+
if [ -z $1 ] || [ -z $2 ] ; then
6+
echo "The REPO_DIR or WORK_DIR is empty and it needs to point to the corresponding directories."
7+
echo "Please run it with:"
8+
echo " $0 REPO_DIR WORK_DIR"
9+
exit 1
10+
fi
611

7-
# Ensure KAS workspace is outside of the checked out repo
8-
# Allows the caller to specify KAS_WORK_DIR, otherwise make temp one
9-
export KAS_WORK_DIR=$(realpath ${KAS_WORK_DIR:-$(mktemp -d)})
12+
REPO_DIR="$1"
13+
WORK_DIR="$2"
14+
15+
_is_dir(){
16+
test -d "$1" && return
17+
echo "The '$1' is not a directory."
18+
exit 1
19+
}
20+
21+
_is_dir "$REPO_DIR"
22+
_is_dir "$WORK_DIR"
1023

1124
# Yocto Project layer checking tool
1225
CMD="yocto-check-layer-wrapper"
1326
# Layer to check
14-
CMD="$CMD $TOPDIR"
27+
CMD="$CMD $REPO_DIR"
1528
# Disable auto layer discovery
1629
CMD="$CMD --no-auto"
1730
# Layers to process for dependencies
18-
CMD="$CMD --dependency $KAS_WORK_DIR/oe-core/meta"
31+
CMD="$CMD --dependency $WORK_DIR/oe-core/meta"
1932
# Disable automatic testing of dependencies
2033
CMD="$CMD --no-auto-dependency"
2134
# Set machines to all machines defined in this BSP layer
22-
CMD="$CMD --machines $(echo $(find $TOPDIR/conf/machine/ -maxdepth 1 -name *.conf -exec basename {} .conf \; ))"
35+
CMD="$CMD --machines $(echo $(find $REPO_DIR/conf/machine/ -maxdepth 1 -name *.conf -exec basename {} .conf \; ))"
2336

24-
echo "Running kas in $KAS_WORK_DIR"
25-
exec kas shell $TOPDIR/ci/base.yml --command "$CMD"
37+
exec $CMD

ci/yocto-patchreview.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,28 @@
22
# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
33
# SPDX-License-Identifier: MIT
44

5-
TOPDIR=$(realpath $(dirname $(readlink -f $0))/..)
5+
if [ -z $1 ] || [ -z $2 ] ; then
6+
echo "The REPO_DIR or WORK_DIR is empty and it needs to point to the corresponding directories."
7+
echo "Please run it with:"
8+
echo " $0 REPO_DIR WORK_DIR"
9+
exit 1
10+
fi
611

7-
# Ensure KAS workspace is outside of the checked out repo
8-
# Allows the caller to specify KAS_WORK_DIR, otherwise make temp one
9-
export KAS_WORK_DIR=$(realpath ${KAS_WORK_DIR:-$(mktemp -d)})
12+
REPO_DIR="$1"
13+
WORK_DIR="$2"
1014

11-
echo "Running kas in $KAS_WORK_DIR"
12-
kas shell $TOPDIR/ci/base.yml --command "$KAS_WORK_DIR/oe-core/scripts/contrib/patchreview.py -v -b -j status.json $TOPDIR"
15+
_is_dir(){
16+
test -d "$1" && return
17+
echo "The '$1' is not a directory."
18+
exit 1
19+
}
20+
21+
_is_dir "$REPO_DIR"
22+
_is_dir "$WORK_DIR"
23+
24+
25+
$WORK_DIR/oe-core/scripts/contrib/patchreview.py -v -b -j status.json $REPO_DIR
1326

1427
# return an error if any malformed patch is found
15-
cat $KAS_WORK_DIR/build/status.json |
28+
cat $WORK_DIR/build/status.json |
1629
python -c "import json,sys;obj=json.load(sys.stdin); sys.exit(1) if 'malformed-sob' in obj[0] or 'malformed-upstream-status' in obj[0] else sys.exit(0)"

ci/yocto-pybootchartgui.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,34 @@
22
# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
33
# SPDX-License-Identifier: MIT
44

5-
TOPDIR=$(realpath $(dirname $(readlink -f $0))/..)
6-
7-
if [ -z $KAS_WORK_DIR ]; then
8-
echo "KAS_WORK_DIR is empty and it needs to point to populated work dir"
5+
if [ -z $1 ] || [ -z $2 ] ; then
6+
echo "The REPO_DIR or WORK_DIR is empty and it needs to point to the corresponding directories."
7+
echo "Please run it with:"
8+
echo " $0 REPO_DIR WORK_DIR"
9+
exit 1
910
fi
1011

12+
REPO_DIR="$1"
13+
WORK_DIR="$2"
14+
15+
_is_dir(){
16+
test -d "$1" && return
17+
echo "The '$1' is not a directory."
18+
exit 1
19+
}
20+
21+
_is_dir "$REPO_DIR"
22+
_is_dir "$WORK_DIR"
23+
1124
# pybootchartgui tool
12-
CMD="$CMD $KAS_WORK_DIR/oe-core/scripts/pybootchartgui/pybootchartgui.py"
25+
CMD="$CMD $WORK_DIR/oe-core/scripts/pybootchartgui/pybootchartgui.py"
1326
# display time in minutes instead of seconds
1427
CMD="$CMD --minutes"
1528
# image format (png, svg, pdf); default format png
1629
CMD="$CMD --format=svg"
1730
# output path (file or directory) where charts are stored
1831
CMD="$CMD --output=buildchart"
1932
# /path/to/tmp/buildstats/<recipe-machine>/<BUILDNAME>/
20-
CMD="$CMD $KAS_WORK_DIR/build/tmp/buildstats"
33+
CMD="$CMD $WORK_DIR/build/tmp/buildstats"
2134

22-
exec kas shell $TOPDIR/ci/base.yml --command "$CMD"
35+
exec $CMD

0 commit comments

Comments
 (0)