From adb9fdef3a426b9f458666f4683a002294a535b0 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Sat, 20 Oct 2018 09:50:51 -0400 Subject: [PATCH] wrap: Fix crash with file based wraps Add unit test to avoid regressions in the future. --- mesonbuild/wrap/wrap.py | 6 +++--- .../158 wrap file should not failed/meson.build | 1 + .../subprojects/foo.wrap | 11 +++++++++++ .../subprojects/packagecache/foo-1.0-patch.tar.xz | Bin 0 -> 232 bytes .../subprojects/packagecache/foo-1.0.tar.xz | Bin 0 -> 180 bytes 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 test cases/common/158 wrap file should not failed/subprojects/foo.wrap create mode 100644 test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz create mode 100644 test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index a4dd7496f..248c3652f 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -198,7 +198,7 @@ class Resolver: raise WrapException(m.format(out)) def get_file(self): - path = self.get_file_internal(self.wrap, 'source') + path = self.get_file_internal('source') extract_dir = self.subdir_root # Some upstreams ship packages that do not have a leading directory. # Create one for them. @@ -319,8 +319,8 @@ class Resolver: self.download(what, cache_path) return cache_path - def apply_patch(self, p): - path = self.get_file_internal(p, 'patch') + def apply_patch(self): + path = self.get_file_internal('patch') try: shutil.unpack_archive(path, self.subdir_root) except Exception: diff --git a/test cases/common/158 wrap file should not failed/meson.build b/test cases/common/158 wrap file should not failed/meson.build index 9d707eec5..f4ec2a8c5 100644 --- a/test cases/common/158 wrap file should not failed/meson.build +++ b/test cases/common/158 wrap file should not failed/meson.build @@ -3,6 +3,7 @@ project('mainproj', 'c', ) subproject('zlib') +subproject('foo') executable('grabprog', files('src/subprojects/prog.c')) executable('grabprog2', files('src/subprojects/foo/prog2.c')) diff --git a/test cases/common/158 wrap file should not failed/subprojects/foo.wrap b/test cases/common/158 wrap file should not failed/subprojects/foo.wrap new file mode 100644 index 000000000..90d6d4005 --- /dev/null +++ b/test cases/common/158 wrap file should not failed/subprojects/foo.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = foo-1.0 + +source_url = http://something.invalid +source_filename = foo-1.0.tar.xz +source_hash = ae5fc03185654f76b459db16ca25809703f8821aeb39a433902244bb479c4b79 +lead_directory_missing = true + +patch_url = https://something.invalid/patch +patch_filename = foo-1.0-patch.tar.xz +patch_hash = 8f2e286a4b190228d4e0c25ddc91195449cfb5e5c52006355838964b244037da diff --git a/test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz b/test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..26d2927e34aebacfe5bfd1b509f26d4d1fd87ae6 GIT binary patch literal 232 zcmVvv1>{>Aw`D=kij|b<7 zsqdHKkKOY}qnJrd$~)fZkv#uCjnMf!ZB=~5s{*ASD8Ai9$!4wI;AS*$QCf-96~39c zgh%6plgD_WL5^sCKSu2#Jt2vv1>|A32YI-8jc*Gk? zoaVyH{CG