
Fix two separate problems: 1. We want to always visit parents before children while creating views (when it comes to ignoring conflicts, the first instance generated in the view is chosen, and we want the parent instance to have precedence). Our preorder traversal does not guarantee that, but our topological- order traversal does. 2. For copy style views with packages x depending on y, where <x-prefix>/foo is a symlink to <y-prefix>/foo, we want to guarantee that: * A conflict is not registered * <y-prefix>/foo is chosen (otherwise, the "foo" symlink would become self-referential if relocated relative to the view root) Note that * This is an exception to [1] (in this case the dependency instance overrides the dependent) * Prior to this change, if "foo" was ignored as a conflict, it was possible to create this self-referential symlink Add tests for each of these cases
24 lines
695 B
Python
24 lines
695 B
Python
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
|
#
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
import os
|
|
|
|
from spack.package import *
|
|
|
|
|
|
class ViewIgnoreConflict(Package):
|
|
"""Installs a file in <prefix>/bin/x, conflicting with the file <dep>/bin/x in a view. In
|
|
a view, we should find this package's file, not the dependency's file."""
|
|
|
|
has_code = False
|
|
|
|
version("0.1.0")
|
|
depends_on("view-file")
|
|
|
|
def install(self, spec, prefix):
|
|
os.mkdir(os.path.join(prefix, "bin"))
|
|
with open(os.path.join(prefix, "bin", "x"), "wb") as f:
|
|
f.write(b"file")
|