From c994565c621f4283736ac70f7792c20e2d9e1b11 Mon Sep 17 00:00:00 2001 From: George Hartzell Date: Mon, 1 Aug 2016 23:56:58 -0400 Subject: Use "resource" machinery to manage cpanm tarball Use the resource machinery to fetch/cache/unpack/... the App::cpanminus tarball. - this hardcodes the version, I can't figure out how to use a variant to hold/set the value and access it in the resource(). - change up the install to use the `with working_dir()` meme. --- var/spack/repos/builtin/packages/perl/package.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py index 47623e87c1..2c90b788ec 100644 --- a/var/spack/repos/builtin/packages/perl/package.py +++ b/var/spack/repos/builtin/packages/perl/package.py @@ -50,8 +50,14 @@ class Perl(Package): # things cleanly. variant('cpanm', default=True, description='Having cpanm in core simplifies adding modules.') - variant('cpanm_version', default='1.7042', - description='Version of cpanm to install into core if +cpanm.') + + resource( + name="cpanm", + url="http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7042.tar.gz", + md5="e87f55fbcb3c13a4754500c18e89219f", + destination="cpanm", + placement="cpanm" + ) def install(self, spec, prefix): configure = Executable('./Configure') @@ -62,9 +68,8 @@ class Perl(Package): make("install") if '+cpanm' in spec: - perl_exe = join_path(prefix.bin, 'perl') - perl = Executable(perl_exe) - cpanm_installer = join_path(self.package_dir, 'cpanm-installer.pl') - cpanm_version = spec.variants['cpanm_version'].value - cpanm_package_spec = 'App::cpanminus' + '@' + cpanm_version - perl(cpanm_installer, cpanm_package_spec) + with working_dir(join_path('cpanm', 'cpanm')): + perl = Executable(join_path(prefix.bin, 'perl')) + perl('Makefile.PL') + make() + make('install') -- cgit v1.2.3-60-g2f50