summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorscheibelp <scheibel1@llnl.gov>2018-08-17 22:08:38 -0400
committerGitHub <noreply@github.com>2018-08-17 22:08:38 -0400
commit638cc64571fd038f5ae7f47a664399b9f2629d66 (patch)
treeadf9b69a2c048ba23ae230b51888fc37778f7f47 /var
parenta7a674512013d4c79fda14dbbf98bced955c437b (diff)
downloadspack-638cc64571fd038f5ae7f47a664399b9f2629d66.tar.gz
spack-638cc64571fd038f5ae7f47a664399b9f2629d66.tar.bz2
spack-638cc64571fd038f5ae7f47a664399b9f2629d66.tar.xz
spack-638cc64571fd038f5ae7f47a664399b9f2629d66.zip
install_tree: symlink handling and add 'ignore' option (#9019)
Fixes #9001 #8289 added support for install_tree and copy_tree to merge into an existing directory structure. However, it did not properly handle relative symlinks and also removed support for the 'ignore' keyword. Additionally, some of the tests were overly-strict when checking the permissions on the copied files. This updates the install_tree/copy_tree methods and their tests: * copy_tree/install_tree now preserve relative link targets (if the symlink in the source directory structure is relative, the symlink created in the destination will be relative) * Added support for 'ignore' argument back to copy_tree/install_tree (removed in #8289). It is no longer the object output by shutil.ignore_patterns: you pass a function that accepts a path relative to the source and returns whether that path should be copied. * The openfoam packages (currently the only ones making use of the 'ignore' argument) are updated for the new API * When a symlink target is absolute, copy_tree and install_tree now rewrite the source prefix to be the destination prefix * copy_tree tests no longer check permissions: copy_tree doesn't enforce anything about permissions so its tests don't check for that * install_tree tests no longer check for exact permission matching since it can add file permissions
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/foam-extend/package.py11
-rw-r--r--var/spack/repos/builtin/packages/openfoam-com/package.py6
-rw-r--r--var/spack/repos/builtin/packages/openfoam-org/package.py6
3 files changed, 12 insertions, 11 deletions
diff --git a/var/spack/repos/builtin/packages/foam-extend/package.py b/var/spack/repos/builtin/packages/foam-extend/package.py
index 7de30232a3..2821c58eb9 100644
--- a/var/spack/repos/builtin/packages/foam-extend/package.py
+++ b/var/spack/repos/builtin/packages/foam-extend/package.py
@@ -54,7 +54,6 @@
##############################################################################
import glob
import re
-import shutil
import os
from spack import *
@@ -382,7 +381,6 @@ class FoamExtend(Package):
def install(self, spec, prefix):
"""Install under the projectdir"""
- opts = str(self.foam_arch)
# Fairly ugly since intermediate targets are scattered inside sources
appdir = 'applications'
@@ -419,19 +417,22 @@ class FoamExtend(Package):
subitem = join_path(appdir, 'Allwmake')
install(subitem, join_path(self.projectdir, subitem))
- ignored = [opts] # Ignore intermediate targets
+ foam_arch_str = str(self.foam_arch)
+ # Ignore intermediate targets
+ ignore = lambda p: os.path.basename(p) == foam_arch_str
+
for d in ['src', 'tutorials']:
install_tree(
d,
join_path(self.projectdir, d),
- ignore=shutil.ignore_patterns(*ignored),
+ ignore=ignore,
symlinks=True)
for d in ['solvers', 'utilities']:
install_tree(
join_path(appdir, d),
join_path(self.projectdir, appdir, d),
- ignore=shutil.ignore_patterns(*ignored),
+ ignore=ignore,
symlinks=True)
etc_dir = join_path(self.projectdir, 'etc')
diff --git a/var/spack/repos/builtin/packages/openfoam-com/package.py b/var/spack/repos/builtin/packages/openfoam-com/package.py
index 08d5dbcf8b..7613d688f7 100644
--- a/var/spack/repos/builtin/packages/openfoam-com/package.py
+++ b/var/spack/repos/builtin/packages/openfoam-com/package.py
@@ -60,7 +60,6 @@
##############################################################################
import glob
import re
-import shutil
import os
from spack import *
@@ -692,12 +691,13 @@ class OpenfoamCom(Package):
dirs.extend(['doc'])
# Install platforms (and doc) skipping intermediate targets
- ignored = ['src', 'applications', 'html', 'Guides']
+ relative_ignore_paths = ['src', 'applications', 'html', 'Guides']
+ ignore = lambda p: p in relative_ignore_paths
for d in dirs:
install_tree(
d,
join_path(self.projectdir, d),
- ignore=shutil.ignore_patterns(*ignored),
+ ignore=ignore,
symlinks=True)
etc_dir = join_path(self.projectdir, 'etc')
diff --git a/var/spack/repos/builtin/packages/openfoam-org/package.py b/var/spack/repos/builtin/packages/openfoam-org/package.py
index dfb3af51f6..9db7597c49 100644
--- a/var/spack/repos/builtin/packages/openfoam-org/package.py
+++ b/var/spack/repos/builtin/packages/openfoam-org/package.py
@@ -55,7 +55,6 @@
##############################################################################
import glob
import re
-import shutil
import os
import llnl.util.tty as tty
@@ -345,12 +344,13 @@ class OpenfoamOrg(Package):
dirs.extend(['doc'])
# Install platforms (and doc) skipping intermediate targets
- ignored = ['src', 'applications', 'html', 'Guides']
+ relative_ignore_paths = ['src', 'applications', 'html', 'Guides']
+ ignore = lambda p: p in relative_ignore_paths
for d in dirs:
install_tree(
d,
join_path(self.projectdir, d),
- ignore=shutil.ignore_patterns(*ignored),
+ ignore=ignore,
symlinks=True)
etc_dir = join_path(self.projectdir, 'etc')