diff --git a/src/alire/alire-releases.adb b/src/alire/alire-releases.adb index 0cbcc4052..4341e42e7 100644 --- a/src/alire/alire-releases.adb +++ b/src/alire/alire-releases.adb @@ -270,9 +270,16 @@ package body Alire.Releases is Paths.Working_Folder_Inside_Root / (Paths.Crate_File_Name & ".upstream"); begin + -- Backup if already there Alire.Directories.Backup_If_Existing (Upstream_File, Base_Dir => Paths.Working_Folder_Inside_Root); + -- Remove just backed up file + if Directories.Is_File (Upstream_File) then + Directories.Delete_Tree + (Directories.Full_Name (Upstream_File)); + end if; + -- And rename the original manifest into upstream Ada.Directories.Rename (Old_Name => Paths.Crate_File_Name, New_Name => Upstream_File); @@ -299,9 +306,12 @@ package body Alire.Releases is Trace.Debug ("Deploying " & This.Milestone.TTY_Image & " into " & TTY.URL (Folder)); - -- Deploy if the target dir is not already there + -- Deploy if the target dir is not already there. We only skip for + -- releases that require a folder to be deployed; system releases + -- require the deploy attempt as the installation check is done by + -- the deployer. - if Completed.Exists then + if This.Origin.Is_Index_Provided and then Completed.Exists then Was_There := True; Trace.Detail ("Skipping checkout of already available " & This.Milestone.Image); diff --git a/src/alire/alire-roots.adb b/src/alire/alire-roots.adb index c7a9b2d7d..e56a900ae 100644 --- a/src/alire/alire-roots.adb +++ b/src/alire/alire-roots.adb @@ -3,7 +3,6 @@ with Ada.Unchecked_Deallocation; with Alire.Builds; with Alire.Conditional; with Alire.Dependencies.Containers; -with Alire.Directories; with Alire.Environment.Loading; with Alire.Errors; with Alire.Flags; @@ -757,9 +756,12 @@ package body Alire.Roots is ); -- If the release was newly deployed, we can inform about its - -- nested crates now. + -- nested crates now (if it has its own folder where nested + -- crates could be found). - if not Was_There and then not CLIC.User_Input.Not_Interactive + if Rel.Origin.Is_Index_Provided + and then not Was_There + and then not CLIC.User_Input.Not_Interactive then Print_Nested_Crates (This.Release_Base (Rel.Name, For_Deploy)); @@ -1435,7 +1437,7 @@ package body Alire.Roots is Rel : constant Releases.Release := Release (This, Crate); begin if not This.Requires_Build_Sync (Rel) then - return This.Release_Parent (Rel, For_Build) / Rel.Base_Folder; + return This.Release_Parent (Rel, For_Deploy) / Rel.Base_Folder; else case Usage is when For_Deploy => diff --git a/src/alire/alire-roots.ads b/src/alire/alire-roots.ads index 57b3bc01c..a5623b9e8 100644 --- a/src/alire/alire-roots.ads +++ b/src/alire/alire-roots.ads @@ -7,6 +7,7 @@ private with Alire.Builds.Hashes; with Alire.Containers; with Alire.Crate_Configuration; with Alire.Dependencies.States; +with Alire.Directories; limited with Alire.Environment; private with Alire.Lockfiles; with Alire.Paths; @@ -333,7 +334,8 @@ package Alire.Roots is -- overwrite even if existing (so `alr update` can deal with any -- corner case). - procedure Print_Nested_Crates (Path : Any_Path); + procedure Print_Nested_Crates (Path : Any_Path) + with Pre => Directories.Is_Directory (Path); -- Look for nested crates below the given path and print a summary of -- path/milestone:description for each one found. Won't enter `alire` dirs. diff --git a/testsuite/fixtures/system_index/gn/gnat_external/gnat_external-external.toml b/testsuite/fixtures/system_index/gn/gnat_external/gnat_external-external.toml new file mode 100644 index 000000000..f1171a6ba --- /dev/null +++ b/testsuite/fixtures/system_index/gn/gnat_external/gnat_external-external.toml @@ -0,0 +1,12 @@ +description = "GNAT is a compiler for the Ada programming language" +name = "gnat_external" + +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mosteo"] + +[[external]] +kind = "version-output" +# We look for make instead that should be always installed. +version-command = ["make", "--version"] +version-regexp = ".*Make ([\\d\\.]+).*" +provides = "gnat" diff --git a/testsuite/fixtures/system_index/index.toml b/testsuite/fixtures/system_index/index.toml new file mode 100644 index 000000000..bad265e4f --- /dev/null +++ b/testsuite/fixtures/system_index/index.toml @@ -0,0 +1 @@ +version = "1.1" diff --git a/testsuite/fixtures/system_index/ma/make/make-external.toml b/testsuite/fixtures/system_index/ma/make/make-external.toml new file mode 100644 index 000000000..eb8ffc3a7 --- /dev/null +++ b/testsuite/fixtures/system_index/ma/make/make-external.toml @@ -0,0 +1,9 @@ +description = "Utility for directing compilation" +name = "make" +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] + +[[external]] +kind = "version-output" +version-command = ["make", "--version"] +version-regexp = ".*Make ([\\d\\.]+).*" \ No newline at end of file diff --git a/testsuite/tests/with/system-crate/test.py b/testsuite/tests/with/system-crate/test.py new file mode 100644 index 000000000..60dbbee87 --- /dev/null +++ b/testsuite/tests/with/system-crate/test.py @@ -0,0 +1,10 @@ +""" +Check that a system crate dependency can be added without issue +""" + +from drivers.alr import init_local_crate, run_alr + +init_local_crate() +run_alr("with", "make") + +print("SUCCESS") diff --git a/testsuite/tests/with/system-crate/test.yaml b/testsuite/tests/with/system-crate/test.yaml new file mode 100644 index 000000000..9d5ee6d15 --- /dev/null +++ b/testsuite/tests/with/system-crate/test.yaml @@ -0,0 +1,4 @@ +driver: python-script +build_mode: both # one of shared, sandboxed, both (default) +indexes: + system_index: {}