summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/bcl2fastq2
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2019-06-12 17:07:47 -0700
committerPeter Scheibel <scheibel1@llnl.gov>2019-06-12 17:07:47 -0700
commit16530f84be04b8466769b9b74fe920d67006b988 (patch)
tree176d21a328e0014ac77d7e14f0f653353581b1af /var/spack/repos/builtin/packages/bcl2fastq2
parent3ce90741a3dd82b22139f82a555e0158c796c169 (diff)
downloadspack-16530f84be04b8466769b9b74fe920d67006b988.tar.gz
spack-16530f84be04b8466769b9b74fe920d67006b988.tar.bz2
spack-16530f84be04b8466769b9b74fe920d67006b988.tar.xz
spack-16530f84be04b8466769b9b74fe920d67006b988.zip
Update remaining packages to use Stage.source_path (#11662)
#11528 updated Stage to always store a Package's source in a fixed directory accessible via `Stage.source_path` This left behind a number of packages which were expecting to access the source code via `Stage.path`. This Updates those packages to use `Stage.source_path` instead. This also updates the name of the fixed directory: The original name of the fixed directory was "src", so if an expanded archive created a "src" directory, then users inspecting the directory structure could see paths like "src/src" (which wasn't wrong but could be confusing). Therefore this also updates the name of the fixed directory to "spack-src".
Diffstat (limited to 'var/spack/repos/builtin/packages/bcl2fastq2')
-rw-r--r--var/spack/repos/builtin/packages/bcl2fastq2/package.py34
1 files changed, 24 insertions, 10 deletions
diff --git a/var/spack/repos/builtin/packages/bcl2fastq2/package.py b/var/spack/repos/builtin/packages/bcl2fastq2/package.py
index 22fab13126..8250b23112 100644
--- a/var/spack/repos/builtin/packages/bcl2fastq2/package.py
+++ b/var/spack/repos/builtin/packages/bcl2fastq2/package.py
@@ -5,7 +5,6 @@
from spack import *
import os
-import shutil
import glob
import llnl.util.tty as tty
@@ -70,19 +69,34 @@ class Bcl2fastq2(Package):
def unpack_it(self, f):
def wrap():
f() # call the original expand_archive()
+
+ # The tarfile should now reside in the well-known source
+ # directory (i.e., self.stage.source_path).
with working_dir(self.stage.path):
- if os.path.isdir('bcl2fastq'):
- tty.msg("The tarball has already been unpacked")
- else:
+ source_subdir = os.path.relpath(self.stage.source_path,
+ self.stage.path)
+ files = glob.glob(os.path.join(source_subdir,
+ 'bcl2fastq2*.tar.gz'))
+ if len(files) == 1:
+ # Rename the tarball so it resides in self.stage.path
+ # alongside the original zip file before unpacking it.
+ tarball = files[0]
+ basename = os.path.basename(tarball)
+ os.rename(tarball, basename)
tty.msg("Unpacking bcl2fastq2 tarball")
- tarball = glob.glob(join_path('spack-expanded-archive',
- 'bcl2fastq2*.tar.gz'))[0]
- copy(tarball, '.')
- shutil.rmtree('spack-expanded-archive')
tar = which('tar')
- tarball = os.path.basename(tarball)
- tar('-xf', tarball)
+ tar('-xf', basename)
+
+ # Rename the unpacked directory to the well-known
+ # source path self.stage.source_path.
+ os.rename('bcl2fastq', source_subdir)
tty.msg("Finished unpacking bcl2fastq2 tarball")
+
+ elif self.stage.expanded:
+ # The unpacked files already reside in the "well known"
+ # source directory (i.e., self.stage.source_path).
+ tty.msg("The tarball has already been unpacked.")
+
return wrap
def install(self, spec, prefix):