summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/test/conftest.py1
-rw-r--r--lib/spack/spack/test/patch.py23
-rw-r--r--var/spack/repos/builtin.mock/packages/patch-a-dependency/foo.patch1
-rw-r--r--var/spack/repos/builtin.mock/packages/patch-a-dependency/libelf.patch11
-rw-r--r--var/spack/repos/builtin.mock/packages/patch-a-dependency/package.py2
5 files changed, 33 insertions, 5 deletions
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index 860732b873..5a2ee699e1 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -388,6 +388,7 @@ def install_mockery(tmpdir, config, mock_packages):
with spack.config.override('config:checksum', False):
yield
+ tmpdir.join('opt').remove()
spack.store.store = real_store
diff --git a/lib/spack/spack/test/patch.py b/lib/spack/spack/test/patch.py
index 3e8bc62ba0..0b16a3f5be 100644
--- a/lib/spack/spack/test/patch.py
+++ b/lib/spack/spack/test/patch.py
@@ -31,6 +31,7 @@ from llnl.util.filesystem import working_dir, mkdirp
import spack.paths
import spack.util.compression
+from spack.util.executable import Executable
from spack.stage import Stage
from spack.spec import Spec
@@ -108,16 +109,32 @@ def test_patch_in_spec(mock_packages, config):
spec.variants['patches'].value)
-def test_patched_dependency(mock_packages, config):
+def test_patched_dependency(
+ mock_packages, config, install_mockery, mock_fetch):
"""Test whether patched dependencies work."""
spec = Spec('patch-a-dependency')
spec.concretize()
assert 'patches' in list(spec['libelf'].variants.keys())
- # foo
- assert (('b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c',) ==
+ # make sure the patch makes it into the dependency spec
+ assert (('c45c1564f70def3fc1a6e22139f62cb21cd190cc3a7dbe6f4120fa59ce33dcb8',) ==
spec['libelf'].variants['patches'].value)
+ # make sure the patch in the dependent's directory is applied to the
+ # dependency
+ libelf = spec['libelf']
+ pkg = libelf.package
+ pkg.do_patch()
+ with pkg.stage:
+ with working_dir(pkg.stage.source_path):
+ # output a Makefile with 'echo Patched!' as the default target
+ configure = Executable('./configure')
+ configure()
+
+ # Make sure the Makefile contains the patched text
+ with open('Makefile') as mf:
+ assert 'Patched!' in mf.read()
+
def test_multiple_patched_dependencies(mock_packages, config):
"""Test whether multiple patched dependencies work."""
diff --git a/var/spack/repos/builtin.mock/packages/patch-a-dependency/foo.patch b/var/spack/repos/builtin.mock/packages/patch-a-dependency/foo.patch
deleted file mode 100644
index 257cc5642c..0000000000
--- a/var/spack/repos/builtin.mock/packages/patch-a-dependency/foo.patch
+++ /dev/null
@@ -1 +0,0 @@
-foo
diff --git a/var/spack/repos/builtin.mock/packages/patch-a-dependency/libelf.patch b/var/spack/repos/builtin.mock/packages/patch-a-dependency/libelf.patch
new file mode 100644
index 0000000000..02bfad9103
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/patch-a-dependency/libelf.patch
@@ -0,0 +1,11 @@
+--- patch-a-dependency/configure 2018-08-13 23:13:51.000000000 -0700
++++ patch-a-dependency/configure.patched 2018-08-13 23:14:15.000000000 -0700
+@@ -2,7 +2,7 @@
+ prefix=$(echo $1 | sed 's/--prefix=//')
+ cat > Makefile <<EOF
+ all:
+- echo Building...
++ echo Patched!
+
+ install:
+ mkdir -p $prefix
diff --git a/var/spack/repos/builtin.mock/packages/patch-a-dependency/package.py b/var/spack/repos/builtin.mock/packages/patch-a-dependency/package.py
index 8d43739d07..01f13a98a2 100644
--- a/var/spack/repos/builtin.mock/packages/patch-a-dependency/package.py
+++ b/var/spack/repos/builtin.mock/packages/patch-a-dependency/package.py
@@ -33,7 +33,7 @@ class PatchADependency(Package):
version('1.0', '0123456789abcdef0123456789abcdef')
- depends_on('libelf', patches=patch('foo.patch'))
+ depends_on('libelf', patches=patch('libelf.patch'))
def install(self, spec, prefix):
pass