summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorMilton Woods <miltonjwoods@gmail.com>2017-10-20 08:24:49 +1100
committerTodd Gamblin <tgamblin@llnl.gov>2017-10-19 14:24:49 -0700
commitd72bcc91f4f11095e72b99aa7ff9dee6dfbc3a52 (patch)
tree1248e56d60d46407154d488a5ed2edc939a18fce /var
parenta1c19f8389aa5135330042c72df36e603c1645db (diff)
downloadspack-d72bcc91f4f11095e72b99aa7ff9dee6dfbc3a52.tar.gz
spack-d72bcc91f4f11095e72b99aa7ff9dee6dfbc3a52.tar.bz2
spack-d72bcc91f4f11095e72b99aa7ff9dee6dfbc3a52.tar.xz
spack-d72bcc91f4f11095e72b99aa7ff9dee6dfbc3a52.zip
perl: ignore perllocal.pod files during package activation (#5271)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/perl/package.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py
index d354332b16..5813d0f150 100644
--- a/var/spack/repos/builtin/packages/perl/package.py
+++ b/var/spack/repos/builtin/packages/perl/package.py
@@ -33,6 +33,8 @@
from spack import *
import os
from contextlib import contextmanager
+import spack
+from llnl.util.lang import match_predicate
class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
@@ -224,3 +226,40 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
os.chmod(path, perm | 0o200)
yield
os.chmod(path, perm)
+
+ # ========================================================================
+ # Handle specifics of activating and deactivating perl modules.
+ # ========================================================================
+
+ def perl_ignore(self, ext_pkg, args):
+ """Add some ignore files to activate/deactivate args."""
+ ignore_arg = args.get('ignore', lambda f: False)
+
+ # Many perl packages describe themselves in a perllocal.pod file,
+ # so the files conflict when multiple packages are activated.
+ # We could merge the perllocal.pod files in activated packages,
+ # but this is unnecessary for correct operation of perl.
+ # For simplicity, we simply ignore all perllocal.pod files:
+ patterns = [r'perllocal\.pod$']
+
+ return match_predicate(ignore_arg, patterns)
+
+ def activate(self, ext_pkg, **args):
+ ignore = self.perl_ignore(ext_pkg, args)
+ args.update(ignore=ignore)
+
+ super(Perl, self).activate(ext_pkg, **args)
+
+ exts = spack.store.layout.extension_map(self.spec)
+ exts[ext_pkg.name] = ext_pkg.spec
+
+ def deactivate(self, ext_pkg, **args):
+ ignore = self.perl_ignore(ext_pkg, args)
+ args.update(ignore=ignore)
+
+ super(Perl, self).deactivate(ext_pkg, **args)
+
+ exts = spack.store.layout.extension_map(self.spec)
+ # Make deactivate idempotent
+ if ext_pkg.name in exts:
+ del exts[ext_pkg.name]