From fe9af72684f85d709ce45096534aa51854a6da9b Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 4 Sep 2023 08:49:39 -0400 Subject: wrap: Use MESON_PACKAGE_CACHE_DIR as default packagecache path Allow packagecache to contain already extracted directory to match what some distro does with Cargo source packages in /usr/share/cargo/registry. Note that there is no need to lock the cache directory because we download into a temporary name and atomically rename afterward. It means we could be downloading the same file twice, but at least integrity is guaranteed. Fixes: #12211 --- unittests/platformagnostictests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'unittests') diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py index efe3109..92c613d 100644 --- a/unittests/platformagnostictests.py +++ b/unittests/platformagnostictests.py @@ -18,6 +18,7 @@ import pickle import tempfile import subprocess import textwrap +import shutil from unittest import skipIf, SkipTest from pathlib import Path @@ -261,3 +262,12 @@ class PlatformAgnosticTests(BasePlatformTests): self.assertEqual(data['modules'], expected) self.assertEqual(data['count'], 68) + + def test_meson_package_cache_dir(self): + # Copy testdir into temporary directory to not pollute meson source tree. + testdir = os.path.join(self.unit_test_dir, '116 meson package cache dir') + srcdir = os.path.join(self.builddir, 'srctree') + shutil.copytree(testdir, srcdir) + builddir = os.path.join(srcdir, '_build') + self.change_builddir(builddir) + self.init(srcdir, override_envvars={'MESON_PACKAGE_CACHE_DIR': os.path.join(srcdir, 'cache_dir')}) -- cgit v1.1