forked from KolibriOS/kolibrios
[WS] Use lib/build.py to download kolibri.img
git-svn-id: svn://kolibrios.org@9390 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a68941be35
commit
23fe7cf9ee
@ -25,8 +25,6 @@ def create_workspace_script(name, script_to_execute):
|
|||||||
log("Done")
|
log("Done")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Create _tools/cache folder if not exist
|
|
||||||
os.makedirs(tools_cache, exist_ok = True)
|
|
||||||
# Create (in current directory) scripts that execute
|
# Create (in current directory) scripts that execute
|
||||||
# the same named scripts from _tools/workspace
|
# the same named scripts from _tools/workspace
|
||||||
tools_workspace_run_py = os.path.join(tools_workspace, "run.py")
|
tools_workspace_run_py = os.path.join(tools_workspace, "run.py")
|
||||||
@ -36,6 +34,3 @@ if __name__ == "__main__":
|
|||||||
# Initalize tup here
|
# Initalize tup here
|
||||||
# TODO: Do anything if tup doesn't exist
|
# TODO: Do anything if tup doesn't exist
|
||||||
os.system("tup init")
|
os.system("tup init")
|
||||||
# Download IMG to _tools/cache
|
|
||||||
img_url = "http://builds.kolibrios.org/eng/data/data/kolibri.img"
|
|
||||||
download(img_url, tools_cache_kolibri_img, skip_exist = True)
|
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
from .network import download
|
from .network import download
|
||||||
from .constants import tools_cache
|
from .constants import tools_cache
|
||||||
|
|
||||||
def builds_get(path):
|
def builds_get(path, output_path = None):
|
||||||
url = f"http://builds.kolibrios.org/{path}"
|
url = f"http://builds.kolibrios.org/{path}"
|
||||||
output_path = f"{tools_cache}/builds.kolibrios.org/{path}"
|
cached_path = f"{tools_cache}/builds.kolibrios.org/{path}"
|
||||||
output_dir = os.path.dirname(output_path)
|
os.makedirs(os.path.dirname(cached_path), exist_ok = True)
|
||||||
os.makedirs(output_dir, exist_ok = True)
|
download(url, cached_path, skip_exist = True)
|
||||||
download(url, output_path, skip_exist = True)
|
if output_path != None:
|
||||||
return output_path
|
shutil.copyfile(cached_path, output_path)
|
||||||
|
return output_path
|
||||||
|
return cached_path
|
||||||
|
|
||||||
def builds_get_contents(path):
|
def builds_get_contents(path):
|
||||||
output_path = builds_get(path)
|
output_path = builds_get(path)
|
||||||
|
@ -11,7 +11,7 @@ sys.path.append(path_to_tools)
|
|||||||
|
|
||||||
from workspace.build import build
|
from workspace.build import build
|
||||||
|
|
||||||
from lib.builds import builds_get_contents
|
from lib.builds import builds_get, builds_get_contents
|
||||||
from lib.makeflop import Floppy
|
from lib.makeflop import Floppy
|
||||||
from lib.platform import is_win32, path
|
from lib.platform import is_win32, path
|
||||||
from lib.logging import log
|
from lib.logging import log
|
||||||
@ -46,10 +46,10 @@ if __name__ == "__main__":
|
|||||||
os.makedirs("workspace", exist_ok = True)
|
os.makedirs("workspace", exist_ok = True)
|
||||||
|
|
||||||
# Create a copy of IMG
|
# Create a copy of IMG
|
||||||
shutil.copyfile(tools_cache_kolibri_img, "workspace/kolibri.img")
|
kolibri_img = builds_get("eng/data/data/kolibri.img", "workspace/kolibri.img")
|
||||||
|
|
||||||
# Open the IMG
|
# Open the IMG
|
||||||
with open("workspace/kolibri.img", "rb") as img:
|
with open(kolibri_img, "rb") as img:
|
||||||
img_data = img.read()
|
img_data = img.read()
|
||||||
img = Floppy(img_data)
|
img = Floppy(img_data)
|
||||||
|
|
||||||
@ -79,6 +79,6 @@ if __name__ == "__main__":
|
|||||||
img.add_file_path("SETTINGS\AUTORUN.DAT", autorun_dat)
|
img.add_file_path("SETTINGS\AUTORUN.DAT", autorun_dat)
|
||||||
log("Done")
|
log("Done")
|
||||||
|
|
||||||
img.save("workspace/kolibri.img")
|
img.save(kolibri_img)
|
||||||
|
|
||||||
run_qemu()
|
run_qemu()
|
||||||
|
Loading…
Reference in New Issue
Block a user