From 2b5f38c5d3621c09566eb135ce4cacda29397649 Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Sun, 16 Jun 2024 10:45:47 +0200 Subject: [PATCH] Self-review --- src/alire/alire-directories.adb | 10 ++++++++++ testsuite/drivers/builds.py | 6 +++++- testsuite/tests/printenv/out-of-root/test.py | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/alire/alire-directories.adb b/src/alire/alire-directories.adb index 936c3d8b0..29ea5e53f 100644 --- a/src/alire/alire-directories.adb +++ b/src/alire/alire-directories.adb @@ -693,6 +693,16 @@ package body Alire.Directories is end if; + -- Ensure that for some bizarre reason, the temp name does not exist + -- already. + + if Adirs.Exists (+This.Name) then + Trace.Debug + ("Name clash for tempfile: " & (+This.Name) & ", retrying..."); + This.Initialize; + return; + end if; + Trace.Debug ("Selected name for tempfile: " & (+This.Name) & " when at dir: " & Current); diff --git a/testsuite/drivers/builds.py b/testsuite/drivers/builds.py index f83448a04..48ff323d9 100644 --- a/testsuite/drivers/builds.py +++ b/testsuite/drivers/builds.py @@ -7,6 +7,7 @@ from shutil import rmtree import subprocess from drivers.alr import alr_builds_dir, run_alr +from drivers.helpers import content_of def clear_builds_dir() -> None: @@ -40,7 +41,10 @@ def find_dir(crate_name: str) -> str: forward slashes in the returned folder path. """ if len(found := glob(f"{path()}/{crate_name}*/*")) != 1: - raise AssertionError(f"Unexpected number of dirs for crate {crate_name}: {found}") + raise AssertionError(f"Unexpected number of dirs for crate {crate_name}: {found}" + \ + str(['\nINPUTS:\n' + content_of(os.path.join(f, "alire", "build_hash_inputs")) \ + for f in found]) + ) return glob(f"{path()}/{crate_name}*/*")[0].replace(os.sep, "/") diff --git a/testsuite/tests/printenv/out-of-root/test.py b/testsuite/tests/printenv/out-of-root/test.py index 6edc36078..90e05de26 100644 --- a/testsuite/tests/printenv/out-of-root/test.py +++ b/testsuite/tests/printenv/out-of-root/test.py @@ -20,11 +20,11 @@ # Verify root crate proper path in GPR_PROJECT_PATH assert_match(r".*GPR_PROJECT_PATH[^\n]+" + re.escape(os.path.join(parent, "base")) - + "(:|\")", p.out) + + "(:|;|\")", p.out) # Verify pinned crate proper path in GPR_PROJECT_PATH assert_match(r".*GPR_PROJECT_PATH[^\n]+" + re.escape(os.path.join(parent, "base", "pinned")) - + "(:|\")", p.out) + + "(:|;|\")", p.out) print("SUCCESS")