Allow the guest disk fixture to use separate scratch storage
@@ -16,7 +16,8 @@ def digest(path):
1616
1717def prepare(args):
1818 work = args.work
19- if args.root == Path("/") or work.is_relative_to(args.root):
19+ disk_directory = args.disk_directory or work
20+ if args.root == Path("/") or work.is_relative_to(args.root) or disk_directory.is_relative_to(args.root):
2021 raise ValueError("use a separate package root and a new worker output directory")
2122 work.mkdir()
2223 seed = work / "seed"
@@ -24,7 +25,7 @@ def prepare(args):
2425 shutil.copy2(args.root / "bin/busybox", seed / "bin/busybox")
2526 identity = f"vinix-ports-{uuid.uuid4()}\n"
2627 (seed / ".vinix-image-id").write_text(identity)
27- disk = work / "root.ext2"
28+ disk = disk_directory / "root.ext2"
2829 with tempfile.TemporaryDirectory(dir=work) as tmp, (work / "format.log").open("x") as log:
2930 root = Path(tmp) / "root"
3031 copy_mode = ["-al"] if args.link_inputs else ["-a", "--reflink=auto"]
@@ -112,6 +113,8 @@ if __name__ == "__main__":
112113 help="reserve bytes and inodes for a separate installed package tree")
113114 parser.add_argument("--link-inputs", action="store_true",
114115 help="stage immutable input files with hard links on the same build volume")
116+ parser.add_argument("--disk-directory", type=lambda path: Path(path).resolve(),
117+ help="place the disposable disk in a separate scratch filesystem")
115118 for arg in ("root", "fixture", "iso", "boot", "work"):
116119 parser.add_argument(arg, type=lambda path: Path(path).resolve())
117120 run(parser.parse_args())