Support listing

This commit is contained in:
Greg Hellings
2023-11-27 10:03:21 -06:00
parent c8510c94aa
commit 149a509803
+5 -2
View File
@@ -17,7 +17,7 @@ parser = ArgumentParser("Build a box")
parser.add_argument("--distro", "-d", help="Name of the distro/ folder") parser.add_argument("--distro", "-d", help="Name of the distro/ folder")
parser.add_argument("--version", "-v", help="Version of the distro to build") parser.add_argument("--version", "-v", help="Version of the distro to build")
parser.add_argument("--build", "-b", help="Name of the target build, e.g. qemu.x86_64, virtualbox-iso.x86_64") parser.add_argument("--build", "-b", help="Name of the target build, e.g. qemu.x86_64, virtualbox-iso.x86_64")
parser.add_argument("--list", "-l", help="List all build targets") parser.add_argument("--list", "-l", help="List all build targets", action="store_true")
parser.add_argument("--all", "-a", help="Build all applicable targets", action="store_true") parser.add_argument("--all", "-a", help="Build all applicable targets", action="store_true")
parser.add_argument("--upload", "-u", help="Force doing uploads", action="store_true") parser.add_argument("--upload", "-u", help="Force doing uploads", action="store_true")
parser.add_argument("--headless", help="Run builds headless", action="store_true") parser.add_argument("--headless", help="Run builds headless", action="store_true")
@@ -54,6 +54,9 @@ def do_build(build):
else: else:
headless = "headless=false" headless = "headless=false"
if args.list:
print(f"Would build: {build.var_file}")
else:
if args.upload: if args.upload:
if "VAGRANT_CLOUD_TOKEN" not in ${...}: if "VAGRANT_CLOUD_TOKEN" not in ${...}:
print("You need to set your cloud token") print("You need to set your cloud token")
@@ -68,7 +71,7 @@ def do_build(build):
else: else:
packer build -var @(headless) -var @(args.stamp) @(build.var_file) @(build.only) -except=upload @(BASE / "sources") packer build -var @(headless) -var @(args.stamp) @(build.var_file) @(build.only) -except=upload @(BASE / "sources")
if args.all or (args.distro and args.version and args.build): if args.all or args.list or (args.distro and args.version and args.build):
process_all() process_all()
else: else:
print("Doing menu stuff") print("Doing menu stuff")