"Console" unexpectedly matches the reserved name regex. This revealed
that `cmCPackNSISGenerator::CreateComponentDescription()` needs to use
the name returned by `GetSanitizedDirOrFileName()` for the component
file glob.
Fix the change from commit a1af593291 (CPack: Support arbitrary
component name when packaging, 2024-05-01, v3.30.0-rc1~151^2~1) to
address these issues and add related checks to the `CPackNSISGenerator`
test case.
Issue: #23612
First, use `cmGeneratedFileStream` to avoid touching an existing file
unless its contents change and to get atomic replacement. Also add a
scope to ensure that the file is in place (at `fout`'s destructor)
before doing anything with the packaging scripts.
See: https://discourse.cmake.org/t/1773
CPack no longer blindly tries to create temporary packaging
(sub)directories that contain the verbatim name of a component, which
might contain characters that are not supported on the platform /
filesystem.
Instead, if the component's name contains a (possibly) problematic
character its MD5 hash will be used for that temporary packaging
(sub)directory.
Likewise, if the component's name resembles a reserved device name (e.g.
"COM1" on Windows) then the temporary packaging (sub)directory will get
this name prefixed with an underscore.
Similar, if it ends in a dot (on Windows) then the temporary packaging
(sub)directory will get this name suffixed with an underscore.
Fixes: #23612
The variable `CPACK_TEMPORARY_DIRECTORY` is an internal variable that is
required for proper packaging. Historically, a second variable
`CPACK_TEMPORARY_INSTALL_DIRECTORY` existed as well which had the same
purpose. Both variables had to be set to the same value. Otherwise,
CPack would not succeed with packaging.
In order to ease CPack's usage, the variable
`CPACK_TEMPORARY_INSTALL_DIRECTORY` is now no longer used.
However, as it cannot be guaranteed that neither of these two (internal)
variables have been used in the wild, some mechanism was introduced to
preserve backwards-compatibility: If one of these variables is set, the
other variable will be set to the same value. If, however, both are set
to different values, CPack still fails but with an explicit
error-message.
Fixes: #25046
Add a new `CPACK_WIX_INSTALL_SCOPE` variable to set the `InstallScope`
when using the default WiX template. Set the default to the bug-free
value `perMachine`.
Fixes: #20962
The latter call is no longer post-bootstrap only since 596439b1bb
(cmCustomCommandGenerator: Add option to transform depfile, 2020-10-05)
via !5325. Convert callers to just use `cmCryptoHash` directly and
remove the bootstrap guard.