diff --git a/compilation/package_dist.py b/compilation/package_dist.py index e75b29d..451deba 100644 --- a/compilation/package_dist.py +++ b/compilation/package_dist.py @@ -417,7 +417,7 @@ def compile_nsis_installers(): f"-DAPP_VERSION={vi_ver}", f"-DDISPLAY_VERSION={display_ver}" ] - success = True + failed_scripts = [] for nsi in ["installer_client.nsi", "installer_server.nsi"]: nsi_path = os.path.join(compilation_dir, nsi) if os.path.exists(nsi_path): @@ -426,9 +426,11 @@ def compile_nsis_installers(): subprocess.run(makensis_cmd + [nsi_path], cwd=compilation_dir, check=True) print(f"[+] Successfully compiled NSIS installer for {nsi}") except Exception as e: - print(f"[!] Warning: Failed to compile {nsi} with {makensis_cmd}: {e}") - success = False - return success + print(f"[!] Error: Failed to compile {nsi} with {makensis_cmd}: {e}") + failed_scripts.append(nsi) + if failed_scripts: + raise RuntimeError(f"NSIS compilation failed for: {', '.join(failed_scripts)}") + return True def compile_inno_setup_installers(): @@ -459,6 +461,7 @@ def compile_inno_setup_installers(): display_ver, vi_ver = get_context_version() write_version_headers(display_ver, vi_ver) + failed_scripts = [] for iss in ["installer_client.iss", "installer_server.iss"]: iss_path = os.path.join(ROOT_DIR, "compilation", iss) if os.path.exists(iss_path): @@ -467,12 +470,17 @@ def compile_inno_setup_installers(): subprocess.run(iscc_cmd + [f"/DAppVersion={display_ver}", iss_path], check=True) print(f"[+] Successfully compiled {iss}") except Exception as e: - print(f"[!] Warning: Failed to compile {iss} with {iscc_cmd}: {e}") + print(f"[!] Error: Failed to compile {iss} with {iscc_cmd}: {e}") + failed_scripts.append(iss) + if failed_scripts: + raise RuntimeError(f"Inno Setup compilation failed for: {', '.join(failed_scripts)}") return True def compile_windows_installers(): - if not compile_nsis_installers(): + if ensure_makensis(): + compile_nsis_installers() + else: compile_inno_setup_installers() @@ -527,14 +535,14 @@ def build_windows(): write_checksum_file("win_agent_sha256sum", client_hash, "Win_Client.exe") sums.append(f"{client_hash} Win_Client.exe") else: - print(f"[!] Warning: Expected {client_bin} was not found.") + raise RuntimeError(f"Expected Windows client binary was not produced: {client_bin}") if os.path.exists(server_bin): server_hash = calculate_sha256(server_bin) write_checksum_file("win_server_sha256sum", server_hash, "Server.exe") sums.append(f"{server_hash} Server.exe") else: - print(f"[!] Warning: Expected {server_bin} was not found.") + raise RuntimeError(f"Expected Windows server binary was not produced: {server_bin}") # Inno Setup output checksums if present for inst in ["LOGAR-Client-Setup.exe", "LOGAR-Server-Setup.exe", "LOGAR-Windows-Client.zip", "LOGAR-Windows-Server.zip"]: @@ -621,14 +629,14 @@ def build_linux(): write_checksum_file("linux_agent_sha256sum", client_hash, "Linux_Client.bin") sums.append(f"{client_hash} Linux_Client.bin") else: - print(f"[!] Warning: Expected {client_bin} was not found.") + raise RuntimeError(f"Expected Linux client binary was not produced: {client_bin}") if os.path.exists(server_bin): server_hash = calculate_sha256(server_bin) write_checksum_file("linux_server_sha256sum", server_hash, "Server.bin") sums.append(f"{server_hash} Server.bin") else: - print(f"[!] Warning: Expected {server_bin} was not found.") + raise RuntimeError(f"Expected Linux server binary was not produced: {server_bin}") for item in ["install_linux_client.sh", "install_linux_server.sh", "LOGAR-Linux-Client.tar.gz", "LOGAR-Linux-Server.tar.gz"]: item_path = os.path.join(DIST_DIR, item)