diff --git a/src/alire/alire-platforms-folders.ads b/src/alire/alire-platforms-folders.ads index 768313865..456866be4 100644 --- a/src/alire/alire-platforms-folders.ads +++ b/src/alire/alire-platforms-folders.ads @@ -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 diff --git a/src/alire/os_windows/alire-config-builtins-windows.ads b/src/alire/os_windows/alire-config-builtins-windows.ads index c787506f2..1cde220ff 100644 --- a/src/alire/os_windows/alire-config-builtins-windows.ads +++ b/src/alire/os_windows/alire-config-builtins-windows.ads @@ -1,4 +1,4 @@ -with Alire.Platforms.Folders; +with Alire.Config.Edit; package Alire.Config.Builtins.Windows is @@ -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)"); diff --git a/testsuite/drivers/alr.py b/testsuite/drivers/alr.py index 4ad58ed7a..5635af9f6 100644 --- a/testsuite/drivers/alr.py +++ b/testsuite/drivers/alr.py @@ -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",