Skip to content

Commit

Permalink
Make msys live inside overriden config path by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Feb 26, 2024
1 parent 89379d2 commit 2ff58d7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
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
4 changes: 2 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,4 @@
with Alire.Platforms.Folders;
with Alire.Config.Edit;

package Alire.Config.Builtins.Windows is

Expand All @@ -19,7 +19,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
13 changes: 13 additions & 0 deletions testsuite/drivers/alr.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ 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)

# Set the msys2 path to the default one, so that every test does not try to
# reinstall a new copy in their private config
if platform.system() == "Windows":
run_alr("-c", config_dir, "config", "--global",
"--set", "msys2.install_dir",
os.path.join(os.environ.get("LocalAppData"), "alire", "msys64"))

# And, to make completely sure, disable msys2 installation, as tests
# use their own config that should not rely on a fresh msys2 anyway. On
# GitHub CI, msys2 is set up in advance.
run_alr("-c", config_dir, "config", "--global",
"--set", "msys2.do_not_install", "true")

# 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

0 comments on commit 2ff58d7

Please sign in to comment.