aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliugang <galen.gang.liu@gmail.com>2017-10-14 22:44:59 +0800
committerJussi Pakkanen <jpakkane@gmail.com>2017-10-14 18:09:13 +0300
commit36d85db5d41b1f3a8e3f13a1680d1758353b23f7 (patch)
tree7fa911875b3532d731634049211c94a746aacd9f
parent3f18e3b89f0f7c42c3bb1479d64ea9aa4f75240c (diff)
downloadmeson-36d85db5d41b1f3a8e3f13a1680d1758353b23f7.zip
meson-36d85db5d41b1f3a8e3f13a1680d1758353b23f7.tar.gz
meson-36d85db5d41b1f3a8e3f13a1680d1758353b23f7.tar.bz2
fix all subproject using wrap-file broken
subproject using wrap-file is broken since commit (68bd64c Prevent projects from directly grabbing files from other subprojects. ) subproject with wrap-file usually have version number after name - **sproj_name** is `zlib-1.2.8` according to `directory = zlib-1.2.8` of zlib.wrap - but **self.subproject** `zlib`
-rw-r--r--mesonbuild/interpreter.py6
-rw-r--r--test cases/common/162 wrap file should not failed/meson.build3
-rw-r--r--test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip1
-rw-r--r--test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz1
-rw-r--r--test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c0
-rw-r--r--test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build2
-rw-r--r--test cases/common/162 wrap file should not failed/subprojects/zlib.wrap10
7 files changed, 21 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index f4bc11f..bfd946a 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1373,6 +1373,9 @@ class Interpreter(InterpreterBase):
self.coredata = self.environment.get_coredata()
self.backend = backend
self.subproject = subproject
+ # Subproject directory is usually the name of the subproject, but can
+ # be different for dependencies provided by wrap files.
+ self.subproject_directory_name = subdir.split(os.path.sep)[-1]
self.subproject_dir = subproject_dir
self.option_file = os.path.join(self.source_root, self.subdir, 'meson_options.txt')
self.load_root_meson_file()
@@ -2785,7 +2788,6 @@ different subdirectory.
super().run()
mlog.log('Build targets in project:', mlog.bold(str(len(self.build.targets))))
-
# Check that the indicated file is within the same subproject
# as we currently are. This is to stop people doing
# nasty things like:
@@ -2816,7 +2818,7 @@ different subdirectory.
if num_sps > 1:
raise InterpreterException('Sandbox violation: Tried to grab file %s from a nested subproject.' % segments[-1])
sproj_name = segments[segments.index(self.subproject_dir) + 1]
- if sproj_name != self.subproject:
+ if sproj_name != self.subproject_directory_name:
raise InterpreterException('Sandbox violation: Tried to grab file %s from a different subproject.' % segments[-1])
def source_strings_to_files(self, sources):
diff --git a/test cases/common/162 wrap file should not failed/meson.build b/test cases/common/162 wrap file should not failed/meson.build
new file mode 100644
index 0000000..64d8d1f
--- /dev/null
+++ b/test cases/common/162 wrap file should not failed/meson.build
@@ -0,0 +1,3 @@
+project('mainproj', 'c')
+
+subproject('zlib')
diff --git a/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip
new file mode 100644
index 0000000..421376d
--- /dev/null
+++ b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip
@@ -0,0 +1 @@
+dummy
diff --git a/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz
new file mode 100644
index 0000000..421376d
--- /dev/null
+++ b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz
@@ -0,0 +1 @@
+dummy
diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c
diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build
new file mode 100644
index 0000000..8d8008e
--- /dev/null
+++ b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build
@@ -0,0 +1,2 @@
+project('shared lib', 'c')
+shared_library('foo', 'foo.c')
diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap b/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap
new file mode 100644
index 0000000..6d5896f
--- /dev/null
+++ b/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap
@@ -0,0 +1,10 @@
+[wrap-file]
+directory = zlib-1.2.8
+
+source_url = http://zlib.net/fossils/zlib-1.2.8.tar.gz
+source_filename = zlib-1.2.8.tar.gz
+source_hash = 36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d
+
+patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/8/get_zip
+patch_filename = zlib-1.2.8-8-wrap.zip
+patch_hash = 17c52a0e0c59ce926d3959005d5cd8178c6c7e2c9a4a1304279a8320c955ac60