forked from Mirror/pmbootstrap
parse: apkindex: fix provider_priority type (MR 2448)
should be an int, but was always a string... Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
da78b11dfd
commit
a874025bbe
1 changed files with 12 additions and 2 deletions
|
@ -91,13 +91,23 @@ def parse_next_block(path: Path, lines: list[str]) -> ApkindexBlock | None:
|
||||||
ret[key].append(value)
|
ret[key].append(value)
|
||||||
else:
|
else:
|
||||||
ret[key] = []
|
ret[key] = []
|
||||||
|
provider_priority = ret.get("provider_priority")
|
||||||
|
if provider_priority:
|
||||||
|
if not provider_priority.isdigit():
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Invalid provider_priority: '{provider_priority}' parsing block {ret}"
|
||||||
|
)
|
||||||
|
provider_priority = int(provider_priority)
|
||||||
|
else:
|
||||||
|
provider_priority = None
|
||||||
|
|
||||||
return ApkindexBlock(
|
return ApkindexBlock(
|
||||||
arch=Arch.from_str(ret["arch"]),
|
arch=Arch.from_str(ret["arch"]),
|
||||||
depends=ret["depends"],
|
depends=ret["depends"],
|
||||||
origin=ret.get("origin"),
|
origin=ret.get("origin"),
|
||||||
pkgname=ret["pkgname"],
|
pkgname=ret["pkgname"],
|
||||||
provides=ret["provides"],
|
provides=ret["provides"],
|
||||||
provider_priority=ret.get("provider_priority"),
|
provider_priority=provider_priority,
|
||||||
timestamp=ret.get("timestamp"),
|
timestamp=ret.get("timestamp"),
|
||||||
version=ret["version"],
|
version=ret["version"],
|
||||||
)
|
)
|
||||||
|
@ -306,7 +316,7 @@ def parse_blocks(path: Path) -> list[ApkindexBlock]:
|
||||||
|
|
||||||
|
|
||||||
def cache_key(path: Path) -> str:
|
def cache_key(path: Path) -> str:
|
||||||
return str(path.relative_to(get_context().config.work))
|
return str(path.relative_to(get_context().config.work, walk_up=True))
|
||||||
|
|
||||||
|
|
||||||
def clear_cache(path: Path) -> bool:
|
def clear_cache(path: Path) -> bool:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue