Previous changes to this file stopped directly processing CL args to
stop batch `for` from interpolating batch reserved characters needed in
arguments like URLS. In doing so, we relied on `for` for an easy
"split" operation, however this incorrectly splits paths with spaces in
certain cases. Processing everything ourselves with manual looping via
`goto` statements allows for full control over CL parsing and handling
of both paths with spaces and reserved characters.
PowerShell requires explicit shell and env support in Spack.
This is due to the distinct differences in shell interactions between
cmd and pwsh. Add a doskey in pwsh piping 'spack' commands to a
powershell script similar to the sh function 'spack'. Add
support for PowerShell-specific shell interactions from Spack
(set/unset shell variables).
* Current develop spack.bat file cannot handle any reserved characters
being passed via the CLI, particularly '=' and '?'. To address this,
re-do the CLI parsing for loop to use custom logic to allow for more
granular handling of CLI args.
* We take a less-than-ideal approach to escaping local scope and
handling unset variables as well as the actual parsing of CL
arguments. To address this, don't quote the args and then try to
parse the quotes we just added (resulting in spack flags being
undefined). Instead, leverage batch script features. Since we are
not unnecessarily quoting things, we don't need to think about
removing them, and in the case of paths with spaces, we should _not_
be removing the quotes as we currently do.
Batch scripts in general will not function without carriage return line
endings on Windows. We rely on these scripts to support cmd, so we
should not allow these scripts to be converted to lf.
Note: Windows 11 supports lf line endings due to the use of Windows
Terminal. Once support for Windows 10 is dropped, this change can be
reverted.
This PR enables the successful execution of the spack binary cache
tutorial on Windows. It assumes gnupg and file are available (they
can be installed with choco).
* Fix handling of args with quotes in spack.bat
* `file` utility can be installed on Windows (e.g. with choco): update
error message accordingly