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.
This commit is contained in:
parent
1b9becc541
commit
c994565c62
@ -50,8 +50,14 @@ class Perl(Package):
|
|||||||
# things cleanly.
|
# things cleanly.
|
||||||
variant('cpanm', default=True,
|
variant('cpanm', default=True,
|
||||||
description='Having cpanm in core simplifies adding modules.')
|
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):
|
def install(self, spec, prefix):
|
||||||
configure = Executable('./Configure')
|
configure = Executable('./Configure')
|
||||||
@ -62,9 +68,8 @@ def install(self, spec, prefix):
|
|||||||
make("install")
|
make("install")
|
||||||
|
|
||||||
if '+cpanm' in spec:
|
if '+cpanm' in spec:
|
||||||
perl_exe = join_path(prefix.bin, 'perl')
|
with working_dir(join_path('cpanm', 'cpanm')):
|
||||||
perl = Executable(perl_exe)
|
perl = Executable(join_path(prefix.bin, 'perl'))
|
||||||
cpanm_installer = join_path(self.package_dir, 'cpanm-installer.pl')
|
perl('Makefile.PL')
|
||||||
cpanm_version = spec.variants['cpanm_version'].value
|
make()
|
||||||
cpanm_package_spec = 'App::cpanminus' + '@' + cpanm_version
|
make('install')
|
||||||
perl(cpanm_installer, cpanm_package_spec)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user