Skip to content

Commit

Permalink
2nd self-review
Browse files Browse the repository at this point in the history
commit 7d8b2cc
Author: Alejandro R. Mosteo <[email protected]>
Date:   Fri Aug 2 09:53:22 2024 +0200

    Debug trouble with relative path finder

commit 0951457
Author: Alejandro R. Mosteo <[email protected]>
Date:   Thu Aug 1 22:32:48 2024 +0200

    Use simpler relative path from Den

commit 76417fa
Author: Alejandro R. Mosteo <[email protected]>
Date:   Thu Aug 1 22:32:09 2024 +0200

    Revert "Try with gprbuild<24"

    This reverts commit b6ca84e.

commit f6e0a96
Author: Alejandro R. Mosteo <[email protected]>
Date:   Thu Aug 1 00:04:00 2024 +0200

    Repair find relative part output

commit 6ad595f
Author: Alejandro R. Mosteo <[email protected]>
Date:   Wed Jul 31 23:28:48 2024 +0200

    Flush testsuite output at start

commit a52e555
Author: Alejandro R. Mosteo <[email protected]>
Date:   Wed Jul 31 18:18:44 2024 +0200

    Fix damaged test

commit b6ca84e
Author: Alejandro R. Mosteo <[email protected]>
Date:   Wed Jul 31 14:16:11 2024 +0200

    Try with gprbuild<24

commit 5000210
Author: Alejandro R. Mosteo <[email protected]>
Date:   Wed Jul 31 14:04:07 2024 +0200

    Show GNAT/GPRBUILD versions prior to testsuite run
  • Loading branch information
mosteo committed Aug 2, 2024
1 parent 5e15e40 commit afe5067
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ commit = "56bbdc008e16996b6f76e443fd0165a240de1b13"

[pins.den]
url = "https://github.com/mosteo/den"
commit = "58eaaa99a4db8117295681919310ee073d5e7ddc"
commit = "56174cde77a17bdfc645ad9553aca497909d5ee8"

[pins.dirty_booleans]
url = "https://github.com/mosteo/dirty_booleans"
Expand Down
15 changes: 8 additions & 7 deletions src/alire/alire-directories.adb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ with Alire.Platforms.Folders;
with Alire.VFS;
with Alire.Utils;

with Den.Filesystem;
with Den.Walk;

with GNAT.String_Hash;
Expand Down Expand Up @@ -437,9 +438,9 @@ package body Alire.Directories is
return Any_Path
is
begin
return AAA.Directories.Relative_Path
(Den.Absnormal (Den.Scrub (Parent)),
Den.Absnormal (Den.Scrub (Child)));
return Result : constant Any_Path :=
Den.Filesystem.Relative (Den.Scrub (Parent),
Den.Scrub (Child));
end Find_Relative_Path;

----------------------
Expand Down Expand Up @@ -808,8 +809,8 @@ package body Alire.Directories is
Remove_From_Source : Boolean)
is

Base : constant Absolute_Path := Den.Absolute (Src);
Target : constant Absolute_Path := Den.Absolute (Dst);
Base : constant Absolute_Path := Den.Filesystem.Absolute (Src);
Target : constant Absolute_Path := Den.Filesystem.Absolute (Dst);

-----------
-- Merge --
Expand All @@ -820,7 +821,7 @@ package body Alire.Directories is
Stop : in out Boolean)
is
use all type Den.Kinds;
Src : constant Absolute_Path := Den.Absolute (Item);
Src : constant Absolute_Path := Den.Filesystem.Absolute (Item);
Rel_Path : constant Relative_Path :=
Find_Relative_Path (Base, Src);
-- If this proves to be too slow, we should do our own recursion,
Expand Down Expand Up @@ -857,7 +858,7 @@ package body Alire.Directories is
-- Copy file into place

Trace.Debug (" Merge: copying "
& Den.Absolute (Item)
& Den.Filesystem.Absolute (Item)
& " into " & Dst);

if Den.Exists (Dst) then
Expand Down
16 changes: 11 additions & 5 deletions src/alire/alire-roots.adb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ with Alire.Utils.TTY;
with Alire.Utils.User_Input;
with Alire.VFS;

with Den;
with Den.Filesystem;

with GNAT.OS_Lib;
with GNAT.SHA256;
Expand Down Expand Up @@ -1253,13 +1253,19 @@ package body Alire.Roots is

declare
Opt : Optional.Root :=
Optional.Detect_Root (Den.Full_Name (Item));
Optional.Detect_Root (Den.Filesystem.Full_Name (Item));
begin
if Opt.Is_Valid then
Found.Insert
(TTY.URL (String (VFS.To_Portable
(Directories.Find_Relative_Path
(Starting_Path, Den.Full_Name (Item))))
(TTY.URL
(String
(VFS.To_Portable
(Directories.Find_Relative_Path
(Den.Filesystem.Full_Name (Starting_Path),
Den.Filesystem.Full_Name (Item))))
-- We use both full names because on Windows we see
-- mixed short/long names for the same path if we
-- apply Full_Name to only one of them.
& "/"
& Opt.Value.Release.Constant_Reference.Milestone.TTY_Image)
& ": "
Expand Down
4 changes: 2 additions & 2 deletions src/alr/alr-files.adb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
with Den;
with Den.Filesystem;

package body Alr.Files is

Expand All @@ -21,7 +21,7 @@ package body Alr.Files is
if Den.Kind (File) in Den.File
and then Has_Suffix (To_Lower_Case (File), ".gpr")
then
Candidates.Append (Den.Full (File));
Candidates.Append (Den.Filesystem.Full (File));
end if;
end Check;
begin
Expand Down
6 changes: 5 additions & 1 deletion testsuite/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import os.path
import shutil
import subprocess
import sys
from argparse import ArgumentTypeError

Expand Down Expand Up @@ -41,7 +42,10 @@ def require_executable(self, name):
if path is None:
raise FileNotFoundError(f"{name} not found in PATH")
else:
print(f"Using {name} at {path}")
print(f"Testsuite using {name} at {path} with version:", )
print(subprocess.run([name, '--version'],
stdout=subprocess.PIPE).stdout.decode())
sys.stdout.flush()

def set_up(self):
super().set_up()
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/show/nested/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# After entering the crate, it is no longer nested and shouldn't be detected

os.chdir("xxx")
assert_match("\s*",
assert_match(r"\s*",
run_alr("show", "--nested", quiet=False).out)

# If we initialize another crate without entering it, it should again be
Expand Down

0 comments on commit afe5067

Please sign in to comment.