From 91182a37dde2e1e7cbb8e8a260455607c0477943 Mon Sep 17 00:00:00 2001 From: Stephan Maka Date: Thu, 14 Nov 2019 00:13:03 +0100 Subject: [PATCH] windows: add sshUnquoted to for interpolated parameters This partially reverts commit 525b91cb214d7265241f1e67cbae25e3a56041d4. --- artiq-fast/windows/qemu.nix | 9 +++++---- artiq-fast/windows/run-test.nix | 14 ++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/artiq-fast/windows/qemu.nix b/artiq-fast/windows/qemu.nix index c99ad80..e575f0d 100644 --- a/artiq-fast/windows/qemu.nix +++ b/artiq-fast/windows/qemu.nix @@ -33,13 +33,14 @@ let # Pass empty config file to prevent ssh from failing to create ~/.ssh sshOpts = "-F /dev/null -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=\$TMP/known_hosts"; - ssh = cmd: '' - echo ssh windows '${cmd}' + sshWithQuotes = quotes: cmd: '' + echo ssh windows ${quotes}${cmd}${quotes} ${sshpass}/bin/sshpass -p${sshPassword} -- \ ${openssh}/bin/ssh -np 2022 ${sshOpts} \ ${sshUser}@localhost \ - '${cmd}' + ${quotes}${cmd}${quotes} ''; + ssh = sshWithQuotes "'"; scp = src: target: '' echo "Copy ${src} to ${target}" ${sshpass}/bin/sshpass -p${sshPassword} -- \ @@ -49,6 +50,6 @@ let in { - inherit qemu-img runQemu ssh scp; + inherit qemu-img runQemu ssh sshWithQuotes scp; inputs = [ qemu_kvm openssh sshpass ]; } diff --git a/artiq-fast/windows/run-test.nix b/artiq-fast/windows/run-test.nix index 9d891da..3e44780 100644 --- a/artiq-fast/windows/run-test.nix +++ b/artiq-fast/windows/run-test.nix @@ -17,6 +17,7 @@ let }; # Double-escape because we produce a script from a shell heredoc ssh = cmd: qemu.ssh (escape cmd); + sshUnquoted = qemu.sshWithQuotes "\""; scp = qemu.scp; condaEnv = "artiq-env"; tcpPorts = [ 1380 1381 1382 1383 ]; @@ -53,14 +54,11 @@ stdenv.mkDerivation { echo "Wait for Windows to boot" sleep 10 ${ssh "ver"} - # FIXME: clean up this hack with the for loops - for pkg in ${sipycoPkg}/noarch/sipyco*.tar.bz2 ; do - ${scp "\\$pkg" "sipyco.tar.bz2"} - ${ssh "anaconda\\scripts\\activate ${condaEnv} && conda install sipyco.tar.bz2"} - done - for pkg in ${artiqPkg}/noarch/artiq*.tar.bz2 ; do - ${scp "\\$pkg" "artiq.tar.bz2"} - ${ssh "anaconda\\scripts\\activate ${condaEnv} && conda install artiq.tar.bz2"} + i=0 + for pkg in ${sipycoPkg}/noarch/sipyco*.tar.bz2 ${artiqPkg}/noarch/artiq*.tar.bz2 ; do + ${scp "\\$pkg" "to_install\\$i.tar.bz2"} + ${sshUnquoted "anaconda\\scripts\\activate ${condaEnv} && conda install to_install\\$i.tar.bz2"} + ((i=i+1)) done # Schedule a timed shutdown against hanging test runs