diff --git a/mpsd-software-environment.py b/mpsd-software-environment.py index 569d3a528dc695409bc4f8288595fad2dc22cabf..be8712400eecf057f3707bc6e2a21b3ce2e02309 100755 --- a/mpsd-software-environment.py +++ b/mpsd-software-environment.py @@ -792,19 +792,22 @@ def main(): # Get machine configs os.environ.get("MPSD_OS", "UNKNOWN_OS") - os.environ.get("MPSD_MICROARCH", "UNKNOWN_MICROARCH") + mpsd_microarch = os.environ.get("MPSD_MICROARCH", "UNKNOWN_MICROARCH") + # release `dev` in script_dir/dev-23a + script_dir = Path(os.path.dirname(os.path.realpath(__file__))) + mpsd_release = args.release # parse logging first # decide the log_file_name - ( - config_vars["build_log_file"] - .replace("mpsd_spack_ver_", f"{mpsd_release}_") - .replace("_toolchains_", f"_{toolchain}_") + installer_log_name, build_log_name = create_log_file_names( + mpsd_release=mpsd_release, mpsd_microarch=mpsd_microarch, action=args.action + ) + installer_log_file = ( + script_dir / mpsd_release / mpsd_microarch / "logs" / installer_log_name ) - set_up_logging(args.loglevel) + + set_up_logging(args.loglevel, installer_log_file) # target dir is the place where this script exists. the - # release `dev` in script_dir/dev-23a - script_dir = Path(os.path.dirname(os.path.realpath(__file__))) # Check the command and run related function if args.action == "remove": diff --git a/tests.py b/tests.py index 9fa98972e383883604508c42acb53fcaf26bf4f8..d2a35f2fc8508afaf9ef59cb8b811c1fd846be73 100644 --- a/tests.py +++ b/tests.py @@ -385,7 +385,7 @@ def test_create_log_file_names(): toolchain=toolchain, ) assert installer_log_file == f"{mpsd_release}_{mpsd_microarch}_{date}_status.log" - assert build_log_file == None + assert build_log_file is None # test no build log file for incorrect toolchain installer_log_file, build_log_file = create_log_file_names( mpsd_microarch=mpsd_microarch, @@ -395,7 +395,7 @@ def test_create_log_file_names(): toolchain=None, ) assert installer_log_file == f"{mpsd_release}_{mpsd_microarch}_{date}_reinstall.log" - assert build_log_file == None + assert build_log_file is None def test_interface(tmp_path):