Support listing
This commit is contained in:
@@ -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,21 +54,24 @@ def do_build(build):
|
|||||||
else:
|
else:
|
||||||
headless = "headless=false"
|
headless = "headless=false"
|
||||||
|
|
||||||
if args.upload:
|
if args.list:
|
||||||
if "VAGRANT_CLOUD_TOKEN" not in ${...}:
|
print(f"Would build: {build.var_file}")
|
||||||
print("You need to set your cloud token")
|
|
||||||
sys.exit(1)
|
|
||||||
packer build -var @(headless) -var @(args.stamp) @(build.var_file) @(build.only) @(BASE / "sources")
|
|
||||||
else:
|
else:
|
||||||
upload = "-except=upload"
|
if args.upload:
|
||||||
# Skip building file if we already have built it
|
if "VAGRANT_CLOUD_TOKEN" not in ${...}:
|
||||||
output = Path(__file__).parent / "output" / get_vagrant_provider(build.provider.name) / f"{build.distro}-{build.version}-{build.provider.arch}.box"
|
print("You need to set your cloud token")
|
||||||
if output.exists():
|
sys.exit(1)
|
||||||
print(f"Skipping {build} as box already exists")
|
packer build -var @(headless) -var @(args.stamp) @(build.var_file) @(build.only) @(BASE / "sources")
|
||||||
else:
|
else:
|
||||||
packer build -var @(headless) -var @(args.stamp) @(build.var_file) @(build.only) -except=upload @(BASE / "sources")
|
upload = "-except=upload"
|
||||||
|
# Skip building file if we already have built it
|
||||||
|
output = Path(__file__).parent / "output" / get_vagrant_provider(build.provider.name) / f"{build.distro}-{build.version}-{build.provider.arch}.box"
|
||||||
|
if output.exists():
|
||||||
|
print(f"Skipping {build} as box already exists")
|
||||||
|
else:
|
||||||
|
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")
|
||||||
|
|||||||
Reference in New Issue
Block a user