dotnet-core-sdk: Fix environment setup (#43842)

The "DOTNET_CLI_TELEMETRY_OPTOUT" environment variable should be defined when using the product, not when installing it (the installation phase is just extract the files anyway).

Also use `~` instead of `-` to check for the variant and fix the second argument for `env.set`  which should also be a string.
This commit is contained in:
Rémi Lacroix 2024-04-29 23:47:37 +02:00 committed by GitHub
parent f7dbb59d13
commit a3aa5b59cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -86,9 +86,9 @@ class DotnetCoreSdk(Package):
variant("telemetry", default=False, description="allow collection of telemetry data")
def setup_build_environment(self, env):
if "-telemetry" in self.spec:
env.set("DOTNET_CLI_TELEMETRY_OPTOUT", 1)
def setup_run_environment(self, env):
if "~telemetry" in self.spec:
env.set("DOTNET_CLI_TELEMETRY_OPTOUT", "1")
def install(self, spec, prefix):
mkdirp("bin")