Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make msys live inside overridden config path by default #1589

Merged
merged 5 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/alire/alire-config-edit-early_load.adb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ package body Alire.Config.Edit.Early_Load is
Alire.Config.Edit.Load_Config;
end Load_Config;

begin
Load_Config;
end Alire.Config.Edit.Early_Load;
2 changes: 1 addition & 1 deletion src/alire/alire-config-edit-early_load.ads
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Alire.Config.Edit.Early_Load is
package Alire.Config.Edit.Early_Load with Elaborate_Body is

procedure Load_Config;
-- For internal use of Alire_Early_Elaboration, DO NOT CALL otherwise.
Expand Down
4 changes: 4 additions & 0 deletions src/alire/alire-platforms-folders.ads
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package Alire.Platforms.Folders is

-- This spec must be fulfilled by bodies for each different OS we support

-- IMPORTANT NOTE: these are not intended to be used directly in most
-- cases; instead, use the ones in Alire.Config.Edit that take into
-- account user overriding of the config location.

function Config return Absolute_Path;
-- Folder where alire will store its global configuration, indexes, and
-- any other global data. Deleting it is akin to running alr afresh for
Expand Down
6 changes: 4 additions & 2 deletions src/alire/os_windows/alire-config-builtins-windows.ads
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
with Alire.Platforms.Folders;
-- Ensure config is loaded for some defaults below
with Alire.Config.Edit.Early_Load;
pragma Unreferenced (Alire.Config.Edit.Early_Load);

package Alire.Config.Builtins.Windows is

Expand All @@ -19,7 +21,7 @@ package Alire.Config.Builtins.Windows is
Msys2_Install_Dir : constant Builtin := New_Builtin
(Key => "msys2.install_dir",
Kind => Cfg_Absolute_Path,
Def => Platforms.Folders.Cache / "msys64",
Def => Config.Edit.Cache_Path / "msys64",
Help =>
"Directory where Alire will detect and/or install" &
" msys2 system package manager. (Windows only)");
Expand Down
11 changes: 11 additions & 0 deletions testsuite/drivers/alr.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ def prepare_env(config_dir, env):
# We pass config location explicitly in the following calls since env is
# not yet applied (it's just a dict to be passed later to subprocess)

if platform.system() == "Windows":
# Disable msys inadvertent installation
run_alr("-c", config_dir, "config", "--global",
"--set", "msys2.do_not_install", "true")

# And configure the one set up in the environment so it is used by
# tests that need it.
run_alr("-c", config_dir, "config", "--global",
"--set", "msys2.install_dir",
os.path.join(os.environ.get("LocalAppData"), "alire", "msys64"))

# Disable autoconfig of the community index, to prevent unintended use of
# it in tests, besides the overload of fetching it
run_alr("-c", config_dir, "config", "--global",
Expand Down
Loading