From 00c4efb96e56bf62d3dc6c91be9636d62123e4ba Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Fri, 19 Jan 2024 17:10:03 +0100 Subject: [PATCH] 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 `/.spack-env/logs/*`, but this is redundant because: 1. Views already add `/.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. --- lib/spack/spack/environment/environment.py | 24 ---------------------- 1 file changed, 24 deletions(-) diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 320cf4d2b82..bbdc549cc2f 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -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"""