summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn W. Parent <45471568+johnwparent@users.noreply.github.com>2024-05-16 19:00:02 -0400
committerGitHub <noreply@github.com>2024-05-16 17:00:02 -0600
commit81fe460194477fb54dcbb83edb9c0a5abf406539 (patch)
treede0fd64552d60544951664d60ce56fb76d287a77 /lib
parentb894f996c0401b32ca12fcbf5362eee7d0c84652 (diff)
downloadspack-81fe460194477fb54dcbb83edb9c0a5abf406539.tar.gz
spack-81fe460194477fb54dcbb83edb9c0a5abf406539.tar.bz2
spack-81fe460194477fb54dcbb83edb9c0a5abf406539.tar.xz
spack-81fe460194477fb54dcbb83edb9c0a5abf406539.zip
Gitlab CI: Windows Configs (#43967)
Add support for Gitlab CI on Windows This PR adds the config changes required to configure and execute Gitlab pipelines running Windows builds on Windows runners using the existing Gitlab CI infrastructure (and newly added Windows infrastructure). * Adds support for generating child pipelines dispatched to Windows runners * Refactors the relevant pre-scripts, scripts, and post scripts to be compatible with Windows * Adds Windows config section describing Windows jobs * Adds VTK as Windows build stack (to be expanded later) * Modifies proj to build on Windows * Refactors Windows rpath symlinking to avoid system libs and externals --------- Co-authored-by: Ryan Krattiger <ryan.krattiger@kitware.com> Co-authored-by: Mike VanDenburgh <michael.vandenburgh@kitware.com> Co-authored-by: Todd Gamblin <tgamblin@llnl.gov> Co-authored-by: Scott Wittenburg <scott.wittenburg@kitware.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/filesystem.py10
-rw-r--r--lib/spack/spack/ci.py22
-rw-r--r--lib/spack/spack/package_base.py17
3 files changed, 43 insertions, 6 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index f79cd48543..f233828df8 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -2531,8 +2531,14 @@ class WindowsSimulatedRPath:
# for each binary install dir in self.pkg (i.e. pkg.prefix.bin, pkg.prefix.lib)
# install a symlink to each dependent library
- for library, lib_dir in itertools.product(self.rpaths, self.library_dependents):
- self._link(library, lib_dir)
+
+ # do not rpath for system libraries included in the dag
+ # we should not be modifying libraries managed by the Windows system
+ # as this will negatively impact linker behavior and can result in permission
+ # errors if those system libs are not modifiable by Spack
+ if "windows-system" not in getattr(self.pkg, "tags", []):
+ for library, lib_dir in itertools.product(self.rpaths, self.library_dependents):
+ self._link(library, lib_dir)
@system_path_filter
diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py
index c08d2e00a1..bd664c664d 100644
--- a/lib/spack/spack/ci.py
+++ b/lib/spack/spack/ci.py
@@ -684,6 +684,22 @@ def generate_gitlab_ci_yaml(
"instead.",
)
+ def ensure_expected_target_path(path):
+ """Returns passed paths with all Windows path separators exchanged
+ for posix separators only if copy_only_pipeline is enabled
+
+ This is required as copy_only_pipelines are a unique scenario where
+ the generate job and child pipelines are run on different platforms.
+ To make this compatible w/ Windows, we cannot write Windows style path separators
+ that will be consumed on by the Posix copy job runner.
+
+ TODO (johnwparent): Refactor config + cli read/write to deal only in posix
+ style paths
+ """
+ if copy_only_pipeline and path:
+ path = path.replace("\\", "/")
+ return path
+
pipeline_mirrors = spack.mirror.MirrorCollection(binary=True)
deprecated_mirror_config = False
buildcache_destination = None
@@ -807,7 +823,7 @@ def generate_gitlab_ci_yaml(
if scope not in include_scopes and scope not in env_includes:
include_scopes.insert(0, scope)
env_includes.extend(include_scopes)
- env_yaml_root["spack"]["include"] = env_includes
+ env_yaml_root["spack"]["include"] = [ensure_expected_target_path(i) for i in env_includes]
if "gitlab-ci" in env_yaml_root["spack"] and "ci" not in env_yaml_root["spack"]:
env_yaml_root["spack"]["ci"] = env_yaml_root["spack"].pop("gitlab-ci")
@@ -1228,6 +1244,9 @@ def generate_gitlab_ci_yaml(
"SPACK_REBUILD_EVERYTHING": str(rebuild_everything),
"SPACK_REQUIRE_SIGNING": os.environ.get("SPACK_REQUIRE_SIGNING", "False"),
}
+ output_vars = output_object["variables"]
+ for item, val in output_vars.items():
+ output_vars[item] = ensure_expected_target_path(val)
# TODO: Remove this block in Spack 0.23
if deprecated_mirror_config and remote_mirror_override:
@@ -1284,7 +1303,6 @@ def generate_gitlab_ci_yaml(
sorted_output = {}
for output_key, output_value in sorted(output_object.items()):
sorted_output[output_key] = output_value
-
if known_broken_specs_encountered:
tty.error("This pipeline generated hashes known to be broken on develop:")
display_broken_spec_messages(broken_specs_url, known_broken_specs_encountered)
diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py
index 46f9860932..4726635750 100644
--- a/lib/spack/spack/package_base.py
+++ b/lib/spack/spack/package_base.py
@@ -161,7 +161,11 @@ class WindowsRPath:
Performs symlinking to incorporate rpath dependencies to Windows runtime search paths
"""
- if sys.platform == "win32":
+ # If spec is an external, we should not be modifying its bin directory, as we would
+ # be doing in this method
+ # Spack should in general not modify things it has not installed
+ # we can reasonably expect externals to have their link interface properly established
+ if sys.platform == "win32" and not self.spec.external:
self.win_rpath.add_library_dependent(*self.win_add_library_dependent())
self.win_rpath.add_rpath(*self.win_add_rpath())
self.win_rpath.establish_link()
@@ -2446,9 +2450,18 @@ class PackageBase(WindowsRPath, PackageViewMixin, RedistributionMixin, metaclass
# on Windows, libraries of runtime interest are typically
# stored in the bin directory
+ # Do not include Windows system libraries in the rpath interface
+ # these libraries are handled automatically by VS/VCVARS and adding
+ # Spack derived system libs into the link path or address space of a program
+ # can result in conflicting versions, which makes Spack packages less useable
if sys.platform == "win32":
rpaths = [self.prefix.bin]
- rpaths.extend(d.prefix.bin for d in deps if os.path.isdir(d.prefix.bin))
+ rpaths.extend(
+ d.prefix.bin
+ for d in deps
+ if os.path.isdir(d.prefix.bin)
+ and "windows-system" not in getattr(d.package, "tags", [])
+ )
else:
rpaths = [self.prefix.lib, self.prefix.lib64]
rpaths.extend(d.prefix.lib for d in deps if os.path.isdir(d.prefix.lib))