From 5c652e06022e8da431642c99f5bf4769cf10ccc9 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Sat, 15 Jun 2024 18:47:57 +0200 Subject: [PATCH] parse: apkindex: handle empty APKINDEX (MR 2252) Sometimes the local binary repo will have no packages but still an APKINDEX. It will be empty in this case. Handle this gracefully. Signed-off-by: Caleb Connolly --- pmb/parse/apkindex.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pmb/parse/apkindex.py b/pmb/parse/apkindex.py index 42e2ee70..eb84c25e 100644 --- a/pmb/parse/apkindex.py +++ b/pmb/parse/apkindex.py @@ -197,6 +197,11 @@ def parse(path: Path, multiple_providers=True): with path.open("r", encoding="utf-8") as handle: lines = handle.read().splitlines() + # The APKINDEX might be empty, for example if you run "pmbootstrap index" and have no local + # packages + if not lines: + return {} + # Parse the whole APKINDEX file ret: Dict[str, Any] = collections.OrderedDict() if lines[-1] == "\n":