Resources: use expanded archive name by default (#11688)

For resources, it is desirable to use the expanded archive name of
the resource as the name of the directory when adding it to the root
staging area.

#11528 established 'spack-src' as the universal directory where
source files are placed, which also affected the behavior of
resources managed with Stages.

This adds a new property ('srcdir') to Stage to remember the name of
the expanded source directory, and uses this as the default name when
placing a resource directory in the root staging area.

This also:

* Ensures that downloaded sources are archived using the expanded
  archive name (otherwise Spack will not be able to determine the
  original directory name when using a cached archive).
* Updates working_dir context manager to guarantee restoration of
  original working directory when an exception occurs
* Adds a "temp_cwd" context manager which creates a temporary
  directory and sets it as the working directory
This commit is contained in:
Peter Scheibel
2019-06-20 11:09:31 -07:00
committed by GitHub
parent 4858d8c275
commit 284ae9d1cc
6 changed files with 138 additions and 51 deletions

View File

@@ -41,7 +41,7 @@ class IntelXed(Package):
version(vers, commit=xed_hash)
resource(name='mbuild',
git='https://github.com/intelxed/mbuild.git',
commit=mbuild_hash, placement='mbuild',
commit=mbuild_hash,
when='@{0}'.format(vers))
variant('debug', default=False, description='Enable debug symbols')

View File

@@ -40,19 +40,16 @@ class Warpx(MakefilePackage):
resource(name='amrex',
git='https://github.com/AMReX-Codes/amrex.git',
when='@master',
tag='master',
placement='amrex')
tag='master')
resource(name='amrex',
git='https://github.com/AMReX-Codes/amrex.git',
when='@dev',
tag='development',
placement='amrex')
tag='development')
resource(name='picsar',
git='https://bitbucket.org/berkeleylab/picsar.git',
tag='master',
placement='picsar')
tag='master')
@property
def build_targets(self):