Skip to content

Commit

Permalink
Fix use of canary file during alr install
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Aug 22, 2023
1 parent 239ac4e commit e72d43a
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/alire/alire-install.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/alire/alire-releases.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 =>
Expand Down
8 changes: 6 additions & 2 deletions src/alire/alire-releases.ads
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
description = "Sample crate"
name = "crate1"
version = "1.0.0"
licenses = []
maintainers = ["[email protected]"]
maintainers-logins = ["someone"]

[origin."case(os)"."..."]
url = "file:../../../crates/crate/crate1.tgz"
hashes = ["sha256:d35efed8325f646652f533fa4094d580cf28bccc9cc1d85751738b446bbed37a"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
description = "Sample crate"
name = "crate2"
version = "1.0.0"
licenses = []
maintainers = ["[email protected]"]
maintainers-logins = ["someone"]

[origin."case(os)"."..."]
url = "file:../../../crates/crate/crate2.tgz"
hashes = ["sha256:8a814f2f0683b3b4db10a1c1e08e951d81de0deff2fa0f70a29295e45184b795"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = "1.2"
23 changes: 23 additions & 0 deletions testsuite/tests/install/independent/test.py
Original file line number Diff line number Diff line change
@@ -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')
4 changes: 4 additions & 0 deletions testsuite/tests/install/independent/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: python-script
indexes:
my_index:
in_fixtures: false

0 comments on commit e72d43a

Please sign in to comment.