Skip to content

Commit e570c98

Browse files
authored
Merge pull request #528 from jkloetzke/fix-pwsh-fingerprints
Fix PowerShell fingerprints
2 parents eb0f993 + 440ff09 commit e570c98

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

pym/bob/input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3722,7 +3722,7 @@ def __createSchemas(self):
37223722
schema.Optional('environment') : VarDefineValidator("provideTools::environment"),
37233723
schema.Optional('fingerprintScript', default="") : str,
37243724
schema.Optional('fingerprintScriptBash') : str,
3725-
schema.Optional('fingerprintScriptPwsh', default="") : str,
3725+
schema.Optional('fingerprintScriptPwsh') : str,
37263726
schema.Optional('fingerprintIf') : schema.Or(None, str, bool, IfExpression),
37273727
schema.Optional('fingerprintVars') : [ varNameUseSchema ],
37283728
})
@@ -3742,7 +3742,7 @@ def __createSchemas(self):
37423742
schema.Optional('packageNetAccess') : bool,
37433743
schema.Optional('fingerprintScript', default="") : str,
37443744
schema.Optional('fingerprintScriptBash') : str,
3745-
schema.Optional('fingerprintScriptPwsh', default="") : str,
3745+
schema.Optional('fingerprintScriptPwsh') : str,
37463746
schema.Optional('fingerprintIf') : schema.Or(None, str, bool, IfExpression),
37473747
schema.Optional('fingerprintVars') : [ varNameUseSchema ],
37483748
schema.Optional('scriptLanguage') : schema.And(schema.Or("bash", "PowerShell"),

pym/bob/languages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ def mangleFingerprints(scriptFragments, env):
637637
# Add snippets as they match and a default settings preamble
638638
ret = [script]
639639
ret.extend(['$ErrorActionPreference="Stop"', 'Set-PSDebug -Strict'])
640-
for n,v in sorted(env.items()):
640+
for k,v in sorted(env.items()):
641641
ret.append('$Env:{}="{}"'.format(k, escapePwsh(v)))
642642
ret.append(PwshLanguage.HELPERS)
643643

test/black-box/pwsh/recipes/root.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,21 @@ depends:
44
- name: sandbox
55
use: [sandbox]
66

7+
environment:
8+
FOO: bar
9+
10+
fingerprintIf: True
11+
fingerprintVars: [FOO]
12+
fingerprintScript: |
13+
Write-Output $Env:FOO
14+
if ($Env:FOO -ne "bar") {
15+
exit 1
16+
}
17+
718
checkoutDeterministic: True
819
checkoutScript: |
920
Copy-Item $<<file.txt>> file.txt
21+
buildVars: [FOO]
1022
buildScript: |
1123
Copy-Item ($args[0] + "/file.txt")
1224
packageScript: |

test/black-box/pwsh/recipes/sandbox.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Empty sandbox that mounts the whole host
22
provideSandbox:
3-
paths: []
3+
paths: ["/usr/local/bin", "/usr/bin", "/bin"]
44
mount:
55
- /bin
66
- /etc

test/black-box/pwsh/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ RES=$(run_bob query-path -f '{dist}' --develop root)
1414
diff -u "$RES/file.txt" recipes/file.txt
1515

1616
cleanup
17-
run_bob dev root
18-
RES=$(run_bob query-path -f '{dist}' --develop root)
17+
run_bob dev bash
18+
RES=$(run_bob query-path -f '{dist}' --develop bash)
1919
diff -u "$RES/file.txt" recipes/file.txt
2020

2121
# Run the sandbox check only if namespace feature works on this host.

0 commit comments

Comments
 (0)