diff --git a/pym/bob/input.py b/pym/bob/input.py index b2c461311..fb7a3705d 100644 --- a/pym/bob/input.py +++ b/pym/bob/input.py @@ -3722,7 +3722,7 @@ def __createSchemas(self): schema.Optional('environment') : VarDefineValidator("provideTools::environment"), schema.Optional('fingerprintScript', default="") : str, schema.Optional('fingerprintScriptBash') : str, - schema.Optional('fingerprintScriptPwsh', default="") : str, + schema.Optional('fingerprintScriptPwsh') : str, schema.Optional('fingerprintIf') : schema.Or(None, str, bool, IfExpression), schema.Optional('fingerprintVars') : [ varNameUseSchema ], }) @@ -3742,7 +3742,7 @@ def __createSchemas(self): schema.Optional('packageNetAccess') : bool, schema.Optional('fingerprintScript', default="") : str, schema.Optional('fingerprintScriptBash') : str, - schema.Optional('fingerprintScriptPwsh', default="") : str, + schema.Optional('fingerprintScriptPwsh') : str, schema.Optional('fingerprintIf') : schema.Or(None, str, bool, IfExpression), schema.Optional('fingerprintVars') : [ varNameUseSchema ], schema.Optional('scriptLanguage') : schema.And(schema.Or("bash", "PowerShell"), diff --git a/pym/bob/languages.py b/pym/bob/languages.py index 4cc47b3a0..019149ed1 100644 --- a/pym/bob/languages.py +++ b/pym/bob/languages.py @@ -632,7 +632,7 @@ def mangleFingerprints(scriptFragments, env): # Add snippets as they match and a default settings preamble ret = [script] ret.extend(['$ErrorActionPreference="Stop"', 'Set-PSDebug -Strict']) - for n,v in sorted(env.items()): + for k,v in sorted(env.items()): ret.append('$Env:{}="{}"'.format(k, escapePwsh(v))) ret.append(PwshLanguage.HELPERS) diff --git a/test/black-box/pwsh/recipes/root.yaml b/test/black-box/pwsh/recipes/root.yaml index 2fdeffb10..7892256f4 100644 --- a/test/black-box/pwsh/recipes/root.yaml +++ b/test/black-box/pwsh/recipes/root.yaml @@ -4,9 +4,21 @@ depends: - name: sandbox use: [sandbox] +environment: + FOO: bar + +fingerprintIf: True +fingerprintVars: [FOO] +fingerprintScript: | + Write-Output $Env:FOO + if ($Env:FOO -ne "bar") { + exit 1 + } + checkoutDeterministic: True checkoutScript: | Copy-Item $<> file.txt +buildVars: [FOO] buildScript: | Copy-Item ($args[0] + "/file.txt") packageScript: | diff --git a/test/black-box/pwsh/recipes/sandbox.yaml b/test/black-box/pwsh/recipes/sandbox.yaml index f491d9114..3fbdffa76 100644 --- a/test/black-box/pwsh/recipes/sandbox.yaml +++ b/test/black-box/pwsh/recipes/sandbox.yaml @@ -1,6 +1,6 @@ # Empty sandbox that mounts the whole host provideSandbox: - paths: [] + paths: ["/usr/local/bin", "/usr/bin", "/bin"] mount: - /bin - /etc diff --git a/test/black-box/pwsh/run.sh b/test/black-box/pwsh/run.sh index 9d4301fe0..1ba597c57 100755 --- a/test/black-box/pwsh/run.sh +++ b/test/black-box/pwsh/run.sh @@ -14,8 +14,8 @@ RES=$(run_bob query-path -f '{dist}' --develop root) diff -u "$RES/file.txt" recipes/file.txt cleanup -run_bob dev root -RES=$(run_bob query-path -f '{dist}' --develop root) +run_bob dev bash +RES=$(run_bob query-path -f '{dist}' --develop bash) diff -u "$RES/file.txt" recipes/file.txt # Run the sandbox check only if namespace feature works on this host.