pmb.core.chroot: add a chroot glob helper (MR 2252)

Add a static method to glob all the chroot directories that exist on the
filesystem.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-04-04 03:53:19 +02:00 committed by Oliver Smith
parent 233cbdadeb
commit 425b61f7db
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -152,3 +152,12 @@ class Chroot:
yield f"chroot_{stype.value}"
else:
yield f"chroot_{stype.value}_*"
@staticmethod
def glob() -> Generator[Path, None, None]:
"""
Glob all initialized chroot directories
"""
for pattern in Chroot.iter_patterns():
yield from Path(pmb.config.work).glob(pattern)