aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2021-06-21 17:45:08 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2021-07-03 13:14:20 +0300
commitf21685a83330a4bbe1e59c3641a0d24f1efe8825 (patch)
treec5a25643159ec7058283895ebf77c01d6b1f998f /mesonbuild
parent6f3f43bb2d31797b0f3128e1664652571fe314e6 (diff)
downloadmeson-f21685a83330a4bbe1e59c3641a0d24f1efe8825.zip
meson-f21685a83330a4bbe1e59c3641a0d24f1efe8825.tar.gz
meson-f21685a83330a4bbe1e59c3641a0d24f1efe8825.tar.bz2
Delete redirected wrap files in subprojects purge
We need to store the original filename as well as whether the wrap was redirected in order to properly purge the redirected wrap.
Diffstat (limited to 'mesonbuild')
-rwxr-xr-xmesonbuild/msubprojects.py8
-rw-r--r--mesonbuild/wrap/wrap.py4
2 files changed, 11 insertions, 1 deletions
diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py
index 63ea98a..5d1fb72 100755
--- a/mesonbuild/msubprojects.py
+++ b/mesonbuild/msubprojects.py
@@ -386,6 +386,12 @@ class Runner:
if not self.wrap.type:
return True
+ if self.wrap.redirected:
+ redirect_file = Path(self.wrap.original_filename).resolve()
+ if self.options.confirm:
+ redirect_file.unlink()
+ mlog.log(f'Deleting {redirect_file}')
+
if self.wrap.type == 'redirect':
redirect_file = Path(self.wrap.filename).resolve()
if self.options.confirm:
@@ -416,7 +422,7 @@ class Runner:
# parallelized, another thread could have deleted it already.
try:
if not any(packagecache.iterdir()):
- packagecache.rmdir()
+ windows_proof_rmtree(str(packagecache))
except FileNotFoundError:
pass
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index 4a6583f..6c145ab 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -101,6 +101,8 @@ class PackageDefinition:
self.name = self.basename[:-5] if self.has_wrap else self.basename
self.directory = self.name
self.provided_deps[self.name] = None
+ self.original_filename = fname
+ self.redirected = False
if self.has_wrap:
self.parse_wrap()
self.directory = self.values.get('directory', self.name)
@@ -109,6 +111,7 @@ class PackageDefinition:
if self.type and self.type not in ALL_TYPES:
raise WrapException(f'Unknown wrap type {self.type!r}')
self.filesdir = os.path.join(os.path.dirname(self.filename), 'packagefiles')
+ # What the original file name was before redirection
def parse_wrap(self) -> None:
try:
@@ -137,6 +140,7 @@ class PackageDefinition:
raise WrapException(f'wrap-redirect {fname} filename does not exist')
self.filename = str(fname)
self.parse_wrap()
+ self.redirected = True
return
self.parse_provide_section(config)