environment.py: remove symlinking of logs (#42148)

The piece of code that is removed in this PR predates environment views.

Spack would symlink build logs in `<env>/.spack-env/logs/*`, but this is
redundant because:

1. Views already add `<prefix>/.spack` (and there's logic there to avoid
   clashes)
2. The code was broken anyways: it would only symlink the logs of
   environment roots, not their deps, even if they were just built.

If users disable views, I'm pretty sure they're not waiting for
`.spack-env/logs` either. So, imo we can delete this code, and it was
probably overlooked in the past.
This commit is contained in:
Harmen Stoppels 2024-01-19 17:10:03 +01:00 committed by GitHub
parent edc8a5f249
commit 00c4efb96e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -993,10 +993,6 @@ def env_subdir_path(self):
def repos_path(self):
return os.path.join(self.path, env_subdir_name, "repos")
@property
def log_path(self):
return os.path.join(self.path, env_subdir_name, "logs")
@property
def config_stage_dir(self):
"""Directory for any staged configuration file(s)."""
@ -1833,20 +1829,6 @@ def _get_overwrite_specs(self):
if depth == 0 or spec.installed
]
def _install_log_links(self, spec):
if spec.external:
return
# Make sure log directory exists
log_path = self.log_path
fs.mkdirp(log_path)
with fs.working_dir(self.path):
# Link the resulting log file into logs dir
build_log_link = os.path.join(log_path, f"{spec.name}-{spec.dag_hash(7)}.log")
if os.path.lexists(build_log_link):
os.remove(build_log_link)
symlink(spec.package.install_log_path, build_log_link)
def _partition_roots_by_install_status(self):
"""Partition root specs into those that do not have to be passed to the
installer, and those that should be, taking into account development
@ -1926,12 +1908,6 @@ def install_specs(self, specs=None, **install_args):
for spec in specs_to_install:
if spec.installed:
self.new_installs.append(spec)
try:
self._install_log_links(spec)
except OSError as e:
tty.warn(
"Could not install log links for {0}: {1}".format(spec.name, str(e))
)
def all_specs_generator(self) -> Iterable[Spec]:
"""Returns a generator for all concrete specs"""