mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
build: T3664: typo fixes and small refactoring
This commit is contained in:
parent
53c3486d46
commit
f6b0809f47
@ -68,7 +68,7 @@ except Exception as e:
|
|||||||
# so that we can import modules from it.
|
# so that we can import modules from it.
|
||||||
VYOS1X_DIR = os.path.join(os.getcwd(), 'packages/vyos-1x/python')
|
VYOS1X_DIR = os.path.join(os.getcwd(), 'packages/vyos-1x/python')
|
||||||
if not os.path.exists(VYOS1X_DIR):
|
if not os.path.exists(VYOS1X_DIR):
|
||||||
print("E: vyos-1x subdirectory does not exist, did git submodules fail to initialize?")
|
print("E: packages/vyos-1x subdirectory does not exist, did git submodules fail to initialize?")
|
||||||
else:
|
else:
|
||||||
sys.path.append(VYOS1X_DIR)
|
sys.path.append(VYOS1X_DIR)
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ if __name__ == "__main__":
|
|||||||
if "boot_settings" not in build_config:
|
if "boot_settings" not in build_config:
|
||||||
build_config["boot_settings"] = defaults.boot_settings
|
build_config["boot_settings"] = defaults.boot_settings
|
||||||
else:
|
else:
|
||||||
build_config["boot_settings"] = merge_dicts(defaults.default_consolede, build_config["boot_settings"])
|
build_config["boot_settings"] = merge_dicts(defaults.boot_settings, build_config["boot_settings"])
|
||||||
|
|
||||||
## Convert the image_format field to a single-item list if it's a scalar
|
## Convert the image_format field to a single-item list if it's a scalar
|
||||||
## (like `image_format = "iso"`)
|
## (like `image_format = "iso"`)
|
||||||
@ -607,15 +607,17 @@ if __name__ == "__main__":
|
|||||||
if build_config["image_format"] != ["iso"]:
|
if build_config["image_format"] != ["iso"]:
|
||||||
raw_image = raw_image.create_raw_image(build_config, iso_file, "tmp/")
|
raw_image = raw_image.create_raw_image(build_config, iso_file, "tmp/")
|
||||||
|
|
||||||
other_formats = filter(lambda x: x not in ["iso", "raw"], build_config["image_format"])
|
|
||||||
for f in other_formats:
|
|
||||||
target = f"{os.path.splitext(raw_image)[0]}.{f}"
|
|
||||||
print(f"I: building {f} file {target}")
|
|
||||||
os.system(f"qemu-img convert -f raw -O {f} {raw_image} {target}")
|
|
||||||
|
|
||||||
# Some flavors require special procedures that aren't covered by qemu-img
|
|
||||||
# (most notable, the VMware OVA that requires a custom tool to make and sign the image).
|
|
||||||
# Such procedures are executed as post-build hooks.
|
|
||||||
if has_nonempty_key(build_config, "post_build_hook"):
|
if has_nonempty_key(build_config, "post_build_hook"):
|
||||||
|
# Some flavors require special procedures that aren't covered by qemu-img
|
||||||
|
# (most notably, the VMware OVA that requires a custom tool to make and sign the image).
|
||||||
|
# For those cases, we support running a post-build hook on the raw image.
|
||||||
|
# The image_format field should be 'raw' if a post-build hook is used.
|
||||||
hook_path = build_config["post_build_hook"]
|
hook_path = build_config["post_build_hook"]
|
||||||
os.system(f"{hook_path} {raw_image}")
|
os.system(f"{hook_path} {raw_image}")
|
||||||
|
else:
|
||||||
|
# Most other formats, thankfully, can be produced with just `qemu-img convert`
|
||||||
|
other_formats = filter(lambda x: x not in ["iso", "raw"], build_config["image_format"])
|
||||||
|
for f in other_formats:
|
||||||
|
target = f"{os.path.splitext(raw_image)[0]}.{f}"
|
||||||
|
print(f"I: Building {f} file {target}")
|
||||||
|
os.system(f"qemu-img convert -f raw -O {f} {raw_image} {target}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user