From 34d7f9b9845ebff892a0c8c8483ae0b9f45031b0 Mon Sep 17 00:00:00 2001
From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
Date: Mon, 18 Jul 2022 19:29:12 +0200
Subject: [PATCH] .oniro-ci: find DEPLOY_DIR, not TMPDIR

Some jobs care about images and licenses, those look at the
$TMPDIR/deploy, taking some effort to find the correct tmpdir while
hard-coding the deploy dir. Take a shortcut and query for the right
variable (DEPLOY_DIR).

This allows non-trivial layouts with DEPLOY_DIR and TMPDIR placed on
distinct filesystems, for efficiency.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
---
 .oniro-ci/build-generic.yaml | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/.oniro-ci/build-generic.yaml b/.oniro-ci/build-generic.yaml
index bc79cda5..927bf423 100644
--- a/.oniro-ci/build-generic.yaml
+++ b/.oniro-ci/build-generic.yaml
@@ -265,22 +265,21 @@
     # subdirectories.
     - mkdir -p "$CI_PROJECT_DIR"/artifacts
     - rm -rf "$CI_PROJECT_DIR"/artifacts/*
-    # The name of the build-specific tmp directory may vary. Ask bitbake
-    # instead of hard-coding it. This is currently only relevant for Zephyr,
-    # which uses tmp-newlib.
-    - eval "$(bitbake -e | grep ^TMPDIR= | sed -e 's/^TMPDIR/BITBAKE_TMPDIR/g')"
+    # The name of the build-specific deploy dir may vary. Ask bitbake instead
+    # of hard-coding it.
+    - eval "$(bitbake -e | grep ^DEPLOY_DIR= | sed -e 's/^DEPLOY_DIR/BITBAKE_DEPLOY_DIR/g')"
     # Uncompressed wic image is not needed in CI. We cannot remove it from
     # meta-oniro-core/classes/oniro-image.bbclass as runqemu needs it for local
     # build and boot.
-    - find "$BITBAKE_TMPDIR"/deploy/images/ -name *.wic -exec rm -rf {} \;
-    - cp -a "$BITBAKE_TMPDIR"/deploy/licenses/ "$CI_PROJECT_DIR"/artifacts || true
+    - find "$BITBAKE_DEPLOY_DIR"/images/ -name *.wic -exec rm -rf {} \;
+    - cp -a "$BITBAKE_DEPLOY_DIR"/licenses/ "$CI_PROJECT_DIR"/artifacts || true
     # Only copy the files defined in the CI_ONIRO_JOB_ARTIFACTS variable. Most
     # of the remaining files are redundant and quite large.
     - |
       set -x
-      if test -n "$CI_ONIRO_JOB_ARTIFACTS" && test -d "$BITBAKE_TMPDIR"/deploy/; then
+      if test -n "$CI_ONIRO_JOB_ARTIFACTS" && test -d "$BITBAKE_DEPLOY_DIR"; then
         (
-          cd "$BITBAKE_TMPDIR"/deploy/
+          cd "$BITBAKE_DEPLOY_DIR"
           for artifact in $CI_ONIRO_JOB_ARTIFACTS; do
             find ./ \( -type f -o -type l \) -name "$artifact" -exec cp --verbose --archive --parents {} "$CI_PROJECT_DIR"/artifacts \;
           done
-- 
GitLab