forked from Mirror/pmbootstrap
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 <caleb@postmarketos.org>
This commit is contained in:
parent
4a52f46bf0
commit
5c652e0602
1 changed files with 5 additions and 0 deletions
|
@ -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":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue