From e049fc2840ba81cdff2ca7edd798c5e961ae94e9 Mon Sep 17 00:00:00 2001
From: Todd Gamblin <tgamblin@llnl.gov>
Date: Sun, 27 Mar 2016 11:47:20 -0700
Subject: [PATCH] Run post-install hoooks before build stage is removed.

- Build will properly fail when post-install hoooks fail.

- Post-install hooks have a proper working directory set now.
---
 lib/spack/spack/package.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 9af3221837..c17bec4a14 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -926,6 +926,9 @@ def build_process():
                      install(env_path, env_install_path)
                      dump_packages(self.spec, packages_dir)
 
+                # Run post install hooks before build stage is removed.
+                spack.hooks.post_install(self)
+
             # Stop timer.
             self._total_time = time.time() - start_time
             build_time = self._total_time - self._fetch_time
@@ -954,9 +957,6 @@ def build_process():
         # the database, so that we don't need to re-read from file.
         spack.installed_db.add(self.spec, self.prefix)
 
-        # Once everything else is done, run post install hooks
-        spack.hooks.post_install(self)
-
 
     def sanity_check_prefix(self):
         """This function checks whether install succeeded."""
-- 
GitLab