Quickly sandbox your AI agent.
Python
fix(build): Extract base images from dep wheels before overlay builds
Tyler Payne5741b5ac39b7
diff --git a/uvr_hooks.py b/uvr_hooks.pyindex 5824edd..8f905f4 100644--- a/uvr_hooks.py+++ b/uvr_hooks.py@@ -125,10 +125,37 @@ class Hooks(ReleaseHook):return plandef pre_build(self) -> None:- """Install gh CLI on Windows runners (not pre-installed on self-hosted)."""+ """Extract images from dep wheels and install gh CLI on Windows."""import osimport platformimport urllib.request+ import zipfile++ # When building overlays from --packages (base images not rebuilt),+ # uv resolves build-system.requires from workspace sources which lack+ # qcow2 images. Extract images from pre-built dep wheels so the+ # workspace source directories have them.+ deps_dir = Path("deps")+ if deps_dir.exists():+ for whl in deps_dir.glob("*.whl"):+ with zipfile.ZipFile(whl) as zf:+ for name in zf.namelist():+ if not any(name.endswith(ext) for ext in (".qcow2", ".kernel", ".initrd")):+ continue+ # e.g. quicksand_ubuntu/images/ubuntu-24.04-amd64.qcow2+ parts = Path(name).parts+ if len(parts) < 2:+ continue+ pkg_dir = Path("packages")+ # quicksand_ubuntu -> quicksand-ubuntu+ pkg_name = parts[0].replace("_", "-")+ dest = pkg_dir / pkg_name / name+ if dest.exists():+ continue+ dest.parent.mkdir(parents=True, exist_ok=True)+ print(f" Extracting {name} from {whl.name}")+ with zf.open(name) as src, open(dest, "wb") as dst:+ shutil.copyfileobj(src, dst)if platform.system() != "Windows":return