diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-04-28 19:37:47 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-04-28 19:37:47 +0000 |
| commit | 751b99dc32d7d439031df42730a8ed65e82b3e95 (patch) | |
| tree | cb021f72731aecf6860cea9dc202f75d18062e9f | |
| parent | cd15723c5d62bbfa4c07c36eb7ab7bd962bd4936 (diff) | |
| download | meta-virtualization-master-next.tar.gz | |
vcontainer-tarball: add CI-safe environment script for autobuildermaster-next
The existing environment-setup-* script uses BASH_SOURCE to derive
VCONTAINER_DIR, which is empty when parsed by yocto-autobuilder-helper's
enable_tools_tarball() since it doesn't evaluate shell expressions.
Generate a separate environment-setup-ci with flat export lines using
baked-in absolute paths from ${SDKPATH}/${SDKPATHNATIVE}. The AB parser
picks these up directly. SDK relocation rewrites the paths at install
time. The interactive bash script is unchanged.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| -rw-r--r-- | recipes-containers/vcontainer/vcontainer-tarball.bb | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/recipes-containers/vcontainer/vcontainer-tarball.bb b/recipes-containers/vcontainer/vcontainer-tarball.bb index ed9b8e13..42a13527 100644 --- a/recipes-containers/vcontainer/vcontainer-tarball.bb +++ b/recipes-containers/vcontainer/vcontainer-tarball.bb | |||
| @@ -316,8 +316,9 @@ Quick Start: | |||
| 316 | Architectures included: ${ARCHITECTURES} | 316 | Architectures included: ${ARCHITECTURES} |
| 317 | 317 | ||
| 318 | Contents: | 318 | Contents: |
| 319 | init-env.sh - Environment setup script | 319 | init-env.sh - Environment setup script (interactive bash) |
| 320 | vdkr, vdkr-<arch> - Docker CLI wrapper | 320 | environment-setup-ci - CI environment (for yocto-autobuilder-helper) |
| 321 | vdkr, vdkr-<arch> - Docker CLI wrapper | ||
| 321 | vpdmn, vpdmn-<arch> - Podman CLI wrapper | 322 | vpdmn, vpdmn-<arch> - Podman CLI wrapper |
| 322 | vrunner.sh - Shared QEMU runner | 323 | vrunner.sh - Shared QEMU runner |
| 323 | vcontainer-common.sh - Shared CLI code | 324 | vcontainer-common.sh - Shared CLI code |
| @@ -408,6 +409,30 @@ ENVEOF | |||
| 408 | # Create init-env.sh symlink for convenience | 409 | # Create init-env.sh symlink for convenience |
| 409 | ln -sf environment-setup-${REAL_MULTIMACH_TARGET_SYS} ${SDK_OUTPUT}/${SDKPATH}/init-env.sh | 410 | ln -sf environment-setup-${REAL_MULTIMACH_TARGET_SYS} ${SDK_OUTPUT}/${SDKPATH}/init-env.sh |
| 410 | 411 | ||
| 412 | # ----------------------------------------------------------------------- | ||
| 413 | # CI/AutoBuilder environment script | ||
| 414 | # ----------------------------------------------------------------------- | ||
| 415 | # yocto-autobuilder-helper's enable_tools_tarball() parses environment | ||
| 416 | # scripts line-by-line in Python. It only honours lines starting with | ||
| 417 | # "export " at column 0, only substitutes $PATH, and treats "unset " at | ||
| 418 | # column 0 as a removal. It does NOT evaluate shell expressions like | ||
| 419 | # $(...) or variable references like $FOO. | ||
| 420 | # | ||
| 421 | # Rather than adding conditional logic to the interactive bash script, | ||
| 422 | # generate a separate flat file with baked-in absolute paths that the | ||
| 423 | # AB parser can consume directly. SDK relocation rewrites these paths | ||
| 424 | # at install time just like the primary environment-setup-* script. | ||
| 425 | ci_script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-ci | ||
| 426 | cat > $ci_script <<CISCRIPT | ||
| 427 | # vcontainer CI environment — for yocto-autobuilder-helper | ||
| 428 | # Flat export lines with absolute paths; no shell logic. | ||
| 429 | # SDK relocation rewrites these paths at install time. | ||
| 430 | export VCONTAINER_DIR="${SDKPATH}" | ||
| 431 | export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}" | ||
| 432 | export PATH="${SDKPATH}:${SDKPATHNATIVE}/usr/bin:/usr/bin:/bin:\$PATH" | ||
| 433 | CISCRIPT | ||
| 434 | chmod 755 $ci_script | ||
| 435 | |||
| 411 | # Create version file | 436 | # Create version file |
| 412 | echo "vcontainer SDK version: ${PV}" > ${SDK_OUTPUT}/${SDKPATH}/version.txt | 437 | echo "vcontainer SDK version: ${PV}" > ${SDK_OUTPUT}/${SDKPATH}/version.txt |
| 413 | echo "Built: $(date)" >> ${SDK_OUTPUT}/${SDKPATH}/version.txt | 438 | echo "Built: $(date)" >> ${SDK_OUTPUT}/${SDKPATH}/version.txt |
