From a68941be35d1cf18150806a89cd45e4df95b9642 Mon Sep 17 00:00:00 2001 From: "Magomed Kostoev (mkostoevr)" Date: Sat, 4 Dec 2021 11:50:32 +0000 Subject: [PATCH] [WS][run.py] Add --fast key to use non-compressed kernel git-svn-id: svn://kolibrios.org@9389 a494cfbc-eb01-0410-851d-a64ba20cac60 --- _tools/lib/builds.py | 18 ++++++++++++++++++ _tools/workspace/run.py | 6 ++++++ 2 files changed, 24 insertions(+) create mode 100644 _tools/lib/builds.py diff --git a/_tools/lib/builds.py b/_tools/lib/builds.py new file mode 100644 index 0000000000..89ba13160b --- /dev/null +++ b/_tools/lib/builds.py @@ -0,0 +1,18 @@ +import os + +from .network import download +from .constants import tools_cache + +def builds_get(path): + url = f"http://builds.kolibrios.org/{path}" + output_path = f"{tools_cache}/builds.kolibrios.org/{path}" + output_dir = os.path.dirname(output_path) + os.makedirs(output_dir, exist_ok = True) + download(url, output_path, skip_exist = True) + return output_path + +def builds_get_contents(path): + output_path = builds_get(path) + with open(output_path, "rb") as f: + return f.read() + diff --git a/_tools/workspace/run.py b/_tools/workspace/run.py index 553252a2b2..cbe1aa4490 100644 --- a/_tools/workspace/run.py +++ b/_tools/workspace/run.py @@ -11,6 +11,7 @@ sys.path.append(path_to_tools) from workspace.build import build +from lib.builds import builds_get_contents from lib.makeflop import Floppy from lib.platform import is_win32, path from lib.logging import log @@ -57,6 +58,11 @@ if __name__ == "__main__": img.delete_path("DEMOS") img.delete_path("3D") + # Insert faster kernel if need + if len(sys.argv) > 1 and sys.argv[1] == "--fast": + new_kernel = builds_get_contents("eng/data/kernel/trunk/kernel.mnt.pretest") + img.add_file_path("KERNEL.MNT", new_kernel) + log("Moving program into kolibri image... ", end = "") with open(program_name, "rb") as file: file_data = file.read()