Skip to content

Commit 6c382c5

Browse files
Alex J Lennoncursoragent
andcommitted
dotnet-native: wrapper script to fix NuGet HOME for all consumers
Instead of patching every recipe that invokes dotnet (whack-a-mole), replace the dotnet symlink in native builds with a wrapper script that ensures HOME is always writable before exec-ing the real binary. .NET SDK 6 NuGet MigrationRunner.Run() fires unconditionally before DOTNET_SKIP_FIRST_TIME_EXPERIENCE is checked, and hardcodes $HOME/.local/share/NuGet/Migrations. The wrapper redirects HOME to a writable temp directory, fixing python3-pythonnet, python3-clr-loader, dotnet-helloworld, and any future dotnet consumer automatically. Also add python3-pythonnet to the CI cleansstate list. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 889cc3d commit 6c382c5

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.github/workflows/CI_github.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
- name: Clean stale sstate
102102
run: |
103103
. ./${BRANCH}/poky/oe-init-build-env ${BRANCH}/build
104-
bitbake -c cleansstate dotnet dotnet-native python3-clr-loader python3-clr-loader-native dotnet-helloworld
104+
bitbake -c cleansstate dotnet dotnet-native python3-clr-loader python3-clr-loader-native dotnet-helloworld python3-pythonnet
105105
- name: Building Mono Test Image
106106
run: |
107107
. ./${BRANCH}/poky/oe-init-build-env ${BRANCH}/build

recipes-mono/dotnet/dotnet.inc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,25 @@ RRECOMMENDS:dotnet-dev[nodeprrecs] = "1"
100100
INSANE_SKIP:${PN} = "already-stripped libdir staticdev textrel dev-so"
101101
INSANE_SKIP:${PN}-dbg = "libdir"
102102

103+
# For native builds, replace the dotnet symlink with a wrapper script that
104+
# ensures HOME is always writable. .NET SDK 6 NuGet MigrationRunner.Run()
105+
# unconditionally writes to $HOME/.local/share/NuGet/Migrations *before*
106+
# checking DOTNET_SKIP_FIRST_TIME_EXPERIENCE. In CI containers HOME is
107+
# often read-only, breaking every recipe that invokes dotnet. The wrapper
108+
# fixes this for ALL consumer recipes automatically.
109+
do_install:append:class-native() {
110+
rm -f ${D}${bindir}/dotnet
111+
cat > ${D}${bindir}/dotnet << 'WRAPPER'
112+
#!/bin/sh
113+
export HOME="${DOTNET_CLI_HOME:-${TMPDIR:-/tmp}/dotnet-home}"
114+
mkdir -p "$HOME" 2>/dev/null || true
115+
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
116+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
117+
export DOTNET_NOLOGO=1
118+
SELF_DIR="$(cd "$(dirname "$0")" && pwd)"
119+
exec "${SELF_DIR}/../share/dotnet/dotnet" "$@"
120+
WRAPPER
121+
chmod 0755 ${D}${bindir}/dotnet
122+
}
123+
103124
BBCLASSEXTEND = "native nativesdk"

0 commit comments

Comments
 (0)