Skip to content

Commit

Permalink
spack#11528 established 'spack-src' as the universal directory where …
Browse files Browse the repository at this point in the history
…source files are placed. For resources, it is desirable to use the expanded archive name as the default; therefore this stores the expanded archive name and uses it as the default for 'placement'
  • Loading branch information
scheibelp committed Jun 13, 2019
1 parent 16530f8 commit 6922e40
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
11 changes: 9 additions & 2 deletions lib/spack/spack/fetch_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from six import string_types, with_metaclass

import llnl.util.tty as tty
from llnl.util.filesystem import working_dir, mkdirp
from llnl.util.filesystem import working_dir, mkdirp, join_path

import spack.config
import spack.error
Expand Down Expand Up @@ -371,6 +371,7 @@ def expand(self):
if len(non_hidden) == 1:
src = os.path.join(tarball_container, non_hidden[0])
if os.path.isdir(src):
self.stage.srcdir = non_hidden[0]
shutil.move(src, self.stage.source_path)
if len(files) > 1:
files.remove(non_hidden[0])
Expand All @@ -385,7 +386,13 @@ def expand(self):
shutil.move(tarball_container, self.stage.source_path)

else:
shutil.move(tarball_container, self.stage.source_path)
# TODO: note this is note specifically an issue with resources,
# but I think there was an issue with handling exploding tarballs
os.makedirs(self.stage.source_path)
for fname in non_hidden:
fpath = join_path(tarball_container, fname)
shutil.move(fpath, self.stage.source_path)
os.rmdir(tarball_container)

def archive(self, destination):
"""Just moves this archive to the destination."""
Expand Down
13 changes: 10 additions & 3 deletions lib/spack/spack/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ def __init__(
# used for mirrored archives of repositories.
self.skip_checksum_for_mirror = True

self.srcdir = None

# TODO : this uses a protected member of tempfile, but seemed the only
# TODO : way to get a temporary name besides, the temporary link name
# TODO : won't be the same as the temporary stage area in tmp_root
Expand Down Expand Up @@ -512,9 +514,14 @@ def _add_to_root_stage(self):
"""
root_stage = self.root_stage
resource = self.resource
placement = os.path.basename(self.source_path) \
if resource.placement is None \
else resource.placement

if resource.placement:
placement = resource.placement
elif self.srcdir:
placement = self.srcdir
else:
placement = self.source_path

if not isinstance(placement, dict):
placement = {'': placement}

Expand Down
9 changes: 3 additions & 6 deletions var/spack/repos/builtin/packages/warpx/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 6922e40

Please sign in to comment.