From d43e6d34a26800ce66fd5086e1d9d3026fa89f2c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wdconinc@gmail.com> Date: Sun, 24 Apr 2022 22:29:00 -0500 Subject: [PATCH] dawn and dawncut to use geant4.kek.jp url (dawncut rewrite) --- spack/packages/dawn/package.py | 3 +-- spack/packages/dawncut/package.py | 31 +++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/spack/packages/dawn/package.py b/spack/packages/dawn/package.py index 703a134b3..52da825cc 100644 --- a/spack/packages/dawn/package.py +++ b/spack/packages/dawn/package.py @@ -32,8 +32,7 @@ class Dawn(MakefilePackage): # Note: Dawn homepage not available anymore... homepage = "https://geant4.kek.jp/~tanaka" - #url = "http://geant4.kek.jp/~tanaka/src/dawn_3_91a.tgz" - url = "http://10.10.241.24/software/dawn_3_91a.tgz" + url = "http://geant4.kek.jp/~tanaka/src/dawn_3_91a.tgz" maintainers = ['sly2j'] diff --git a/spack/packages/dawncut/package.py b/spack/packages/dawncut/package.py index 56727106c..ffe9adfa3 100644 --- a/spack/packages/dawncut/package.py +++ b/spack/packages/dawncut/package.py @@ -15,17 +15,36 @@ class Dawncut(MakefilePackage): # dawn webpage not available anymore homepage = "https://geant4.kek.jp/~tanaka" - url = "http://10.10.241.24/software/dawncut_1_54a.tar.gz" + url = "http://geant4.kek.jp/~tanaka/src/dawncut_1_54a.taz" maintainers = ['sly2j'] version('1_54a', - sha256='17d7ccd2ff863e2f3700cc3e751cfca37a1425abfa0edc3b8f6497d8746ddcf4') + url='http://geant4.kek.jp/~tanaka/src/dawncut_1_54a.taz', + sha256='531e1f0e2ed35de3e2b1803108c0efb732d83a0c676f14083bd41a71346b4fa9', + expand=False) - # FIXME: Add dependencies if required. - # depends_on('foo') + phases = ['unpack', 'repatch', 'edit', 'build', 'install'] - ## Patch to add install directive to Makefile - patch('install.patch') + def unpack(self, spec, prefix): + # Untar inner tar files + def members(tf, tld): + l = len(tld) + for member in tf.getmembers(): + if member.path.startswith(tld): + member.path = member.path[l:] + yield member + + with working_dir(self.stage.source_path): + import tarfile + install_tar = tarfile.open('dawncut_1_54a.taz') + install_tar.extractall(members=members(install_tar, 'dawncut_1_54a/')) + + def repatch(self, spec, prefix): + # Patch to add install directive to Makefile + src = self.stage.source_path + patches = self.package_dir + which('patch')('-N', '-l', '-p1', + '-i', join_path(patches, 'install.patch')) def edit(self, spec, prefix): makefile = FileFilter("Makefile") -- GitLab