diff --git a/src/alire/alire-install.adb b/src/alire/alire-install.adb index 6bc1bc370..795e31fae 100644 --- a/src/alire/alire-install.adb +++ b/src/alire/alire-install.adb @@ -49,9 +49,15 @@ package body Alire.Install is -- Use or regular deployment facilities, in case there are any -- actions to perform. - Rel.Deploy (Env => Platforms.Current.Properties, - Parent_Folder => Prefix, - Was_There => Was_There); + Rel.Deploy (Env => Platforms.Current.Properties, + Parent_Folder => Prefix, + Was_There => Was_There, + Mark_Completion => False); + -- We set Mark_Completion to False because the deployment folder + -- is temporary, so we don't need to track completion if the + -- installation fails, and otherwise we will have a common file to + -- all installations (the ./alire/ canary file) that will cause a + -- clash after the first installation. if not Rel.Project_Files (Platforms.Current.Properties, With_Path => False).Is_Empty diff --git a/src/alire/alire-releases.adb b/src/alire/alire-releases.adb index f7440cae6..769e35f23 100644 --- a/src/alire/alire-releases.adb +++ b/src/alire/alire-releases.adb @@ -247,7 +247,8 @@ package body Alire.Releases is Was_There : out Boolean; Perform_Actions : Boolean := True; Create_Manifest : Boolean := False; - Include_Origin : Boolean := False) + Include_Origin : Boolean := False; + Mark_Completion : Boolean := True) is use Alire.Directories; use all type Alire.Properties.Actions.Moments; @@ -350,7 +351,9 @@ package body Alire.Releases is end; end if; - Completed.Mark (Complete => True); + if Mark_Completion then + Completed.Mark (Complete => True); + end if; exception when E : others => diff --git a/src/alire/alire-releases.ads b/src/alire/alire-releases.ads index 3733d6fb8..4d69e4e79 100644 --- a/src/alire/alire-releases.ads +++ b/src/alire/alire-releases.ads @@ -348,11 +348,15 @@ package Alire.Releases is Was_There : out Boolean; Perform_Actions : Boolean := True; Create_Manifest : Boolean := False; - Include_Origin : Boolean := False); + Include_Origin : Boolean := False; + Mark_Completion : Boolean := True); -- Deploy the sources of this release under the given Parent_Folder. If -- Create_Manifest, any packaged manifest will be moved out of the way -- and an authoritative manifest will be generated from index information. - -- The created manifest may optionally Include_Origin information. + -- The created manifest may optionally Include_Origin information. When + -- Mark_Completion, a trace file will be created in ./alire/copy_complete + -- so future inspections of the folder can ensure the operation wasn't + -- interrupted. private diff --git a/testsuite/tests/install/independent/my_index/crates/crate/crate1.tgz b/testsuite/tests/install/independent/my_index/crates/crate/crate1.tgz new file mode 100644 index 000000000..a8623c93b Binary files /dev/null and b/testsuite/tests/install/independent/my_index/crates/crate/crate1.tgz differ diff --git a/testsuite/tests/install/independent/my_index/crates/crate/crate2.tgz b/testsuite/tests/install/independent/my_index/crates/crate/crate2.tgz new file mode 100644 index 000000000..14a2617ac Binary files /dev/null and b/testsuite/tests/install/independent/my_index/crates/crate/crate2.tgz differ diff --git a/testsuite/tests/install/independent/my_index/index/cr/crate1/crate1-1.0.0.toml b/testsuite/tests/install/independent/my_index/index/cr/crate1/crate1-1.0.0.toml new file mode 100644 index 000000000..61c8709b7 --- /dev/null +++ b/testsuite/tests/install/independent/my_index/index/cr/crate1/crate1-1.0.0.toml @@ -0,0 +1,10 @@ +description = "Sample crate" +name = "crate1" +version = "1.0.0" +licenses = [] +maintainers = ["any@bo.dy"] +maintainers-logins = ["someone"] + +[origin."case(os)"."..."] +url = "file:../../../crates/crate/crate1.tgz" +hashes = ["sha256:d35efed8325f646652f533fa4094d580cf28bccc9cc1d85751738b446bbed37a"] \ No newline at end of file diff --git a/testsuite/tests/install/independent/my_index/index/cr/crate2/crate2-1.0.0.toml b/testsuite/tests/install/independent/my_index/index/cr/crate2/crate2-1.0.0.toml new file mode 100644 index 000000000..776771516 --- /dev/null +++ b/testsuite/tests/install/independent/my_index/index/cr/crate2/crate2-1.0.0.toml @@ -0,0 +1,10 @@ +description = "Sample crate" +name = "crate2" +version = "1.0.0" +licenses = [] +maintainers = ["any@bo.dy"] +maintainers-logins = ["someone"] + +[origin."case(os)"."..."] +url = "file:../../../crates/crate/crate2.tgz" +hashes = ["sha256:8a814f2f0683b3b4db10a1c1e08e951d81de0deff2fa0f70a29295e45184b795"] \ No newline at end of file diff --git a/testsuite/tests/install/independent/my_index/index/index.toml b/testsuite/tests/install/independent/my_index/index/index.toml new file mode 100644 index 000000000..c2a2c7dbc --- /dev/null +++ b/testsuite/tests/install/independent/my_index/index/index.toml @@ -0,0 +1 @@ +version = "1.2" diff --git a/testsuite/tests/install/independent/test.py b/testsuite/tests/install/independent/test.py new file mode 100644 index 000000000..c55980097 --- /dev/null +++ b/testsuite/tests/install/independent/test.py @@ -0,0 +1,23 @@ +""" +Test installation of two independent crates with `alr install` to verify that +our deployment system doesn't introduce any conflicts. +""" + +from drivers.alr import run_alr, init_local_crate +from drivers.asserts import assert_eq, assert_match, assert_installed +from subprocess import run + +import os + + +PREFIX=os.path.join(os.getcwd(), "install") +PREFIX_ARG=f"--prefix={PREFIX}" + +# Install both crates one after the other, shouldn't fail +run_alr("install", PREFIX_ARG, "crate1") +run_alr("install", PREFIX_ARG, "crate2") + +# Check contents of the prefix +assert_installed(PREFIX, ["crate1=1.0.0", "crate2=1.0.0"]) + +print('SUCCESS') \ No newline at end of file diff --git a/testsuite/tests/install/independent/test.yaml b/testsuite/tests/install/independent/test.yaml new file mode 100644 index 000000000..0a859639c --- /dev/null +++ b/testsuite/tests/install/independent/test.yaml @@ -0,0 +1,4 @@ +driver: python-script +indexes: + my_index: + in_fixtures: false