Signed-off-by: Paolo Bonzini <[email protected]>
---
scripts/get-wraps-from-cargo-registry.py | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/scripts/get-wraps-from-cargo-registry.py
b/scripts/get-wraps-from-cargo-registry.py
index b3ae5a2c284..a26fe135eb9 100755
--- a/scripts/get-wraps-from-cargo-registry.py
+++ b/scripts/get-wraps-from-cargo-registry.py
@@ -166,10 +166,13 @@ def update_subproject(self, wrap_file: str,
source_namever: str) -> None:
orig_dir = section["directory"]
if self.dry_run:
- if orig_dir == source_namever:
- print(f"Will install {orig_dir} from registry.")
- else:
+ if orig_dir != source_namever:
print(f"Will replace {orig_dir} with {source_namever}.")
+ elif not os.path.exists(orig_dir) or self.cargo_registry:
+ print(f"Will install {orig_dir} from {self.source.origin}.")
+ else:
+ print(f"Will update {orig_dir} from cache.")
+ return
self.changes += 1
return
@@ -181,10 +184,19 @@ def update_subproject(self, wrap_file: str,
source_namever: str) -> None:
with open(wrap_file, "w") as f:
config.write(f)
- if orig_dir == source_namever:
+ if orig_dir != source_namever:
+ print(f"π Replacing {orig_dir} with {source_namever}.")
+ elif not os.path.exists(orig_dir) or self.cargo_registry:
print(f"π Installing {orig_dir} from {self.source.origin}.")
else:
- print(f"π Replacing {orig_dir} with {source_namever}.")
+ print(f"π Updating {orig_dir} from cache.")
+ subprocess.run(
+ ["meson", "subprojects", "update", "--reset", wrap_name],
+ cwd=self.top_srcdir,
+ env=env,
+ check=True,
+ )
+ return
subprocess.run(
["meson", "subprojects", "download", wrap_name],
--
2.55.0