aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-09-04 08:49:39 -0400
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2023-09-05 09:05:24 +0530
commitfe9af72684f85d709ce45096534aa51854a6da9b (patch)
tree0b41f1df5e985a9943bc7f3d321f47786a7e9291 /unittests
parentf07476a89677f5c87a62b6756b76a0e8ebc4bceb (diff)
downloadmeson-fe9af72684f85d709ce45096534aa51854a6da9b.zip
meson-fe9af72684f85d709ce45096534aa51854a6da9b.tar.gz
meson-fe9af72684f85d709ce45096534aa51854a6da9b.tar.bz2
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
Diffstat (limited to 'unittests')
-rw-r--r--unittests/platformagnostictests.py10
1 files changed, 10 insertions, 0 deletions
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')})