diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index b528d2860e0..9e5fbef8800 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -868,7 +868,6 @@ def __init__( pkg: "spack.package_base.PackageBase", request: BuildRequest, *, - compiler: bool = False, start: float = 0.0, attempts: int = 0, status: BuildStatus = BuildStatus.QUEUED, @@ -1198,15 +1197,15 @@ def execute(self, install_status): tty.msg(install_msg(pkg_id, self.pid, install_status)) self.start = self.start or time.time() - self.status = STATUS_INSTALLING + self.status = BuildStatus.INSTALLING try: if _install_from_cache(pkg, self.explicit, unsigned): - if self.compiler: - _add_compiler_package_to_config(pkg) return ExecuteResult.SUCCESS elif self.cache_only: - raise InstallError("No binary found when cache-only was specified", pkg=pkg) + raise spack.error.InstallError( + "No binary found when cache-only was specified", pkg=pkg + ) else: tty.msg(f"No binary for {pkg_id} found: installing from source") return ExecuteResult.MISSING_BINARY @@ -1224,10 +1223,9 @@ def build_task(self, installed): build_task = BuildTask( pkg=self.pkg, request=self.request, - compiler=self.compiler, start=0, attempts=self.attempts, - status=STATUS_ADDED, + status=BuildStatus.QUEUED, installed=installed, ) @@ -1756,7 +1754,7 @@ def _requeue_as_build_task(self, task): # Add a new task if we need one if dep_id not in self.build_tasks and dep_id not in self.installed: - self._add_init_task(dep_pkg, task.request, False, self.all_dependencies) + self._add_init_task(dep_pkg, task.request, self.all_dependencies) # Add edges for an existing task if it exists elif dep_id in self.build_tasks: for parent in dep.dependents(): @@ -1862,28 +1860,6 @@ def _overwrite_install_task(self, task: Task, install_status: InstallStatus) -> too, mark the spec as uninstalled. This function always the original install error if installation fails. """ - - -class OverwriteInstall: - def __init__( - self, - installer: PackageInstaller, - database: spack.database.Database, - task: Task, - install_status: InstallStatus, - ): - self.installer = installer - self.database = database - self.task = task - self.install_status = install_status - - def install(self): - """ - Try to run the install task overwriting the package prefix. - If this fails, try to recover the original install prefix. If that fails - too, mark the spec as uninstalled. This function always the original - install error if installation fails. - """ try: with fs.replace_directory_transaction(task.pkg.prefix): rc = self._install_task(task, install_status) diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index 2fc8beeaf92..4488eaf6542 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -81,7 +81,7 @@ def create_install_task( pkg: spack.package_base.PackageBase, install_args: Optional[dict] = None ) -> inst.InstallTask: request = inst.BuildRequest(pkg, {} if install_args is None else install_args) - return inst.InstallTask(pkg, request, False, 0, 0, inst.STATUS_ADDED, set()) + return inst.InstallTask(pkg, request=request, status=inst.BuildStatus.QUEUED) def create_installer(