forked from Mirror/pmbootstrap
pmaports._find_apkbuilds: use new cache logic (MR 2480)
Use the nice @Cache decorator that Caleb introduced earlier.
This commit is contained in:
parent
214abed0bb
commit
444d9e256f
1 changed files with 1 additions and 10 deletions
|
@ -18,13 +18,8 @@ from pmb.meta import Cache
|
|||
import pmb.parse
|
||||
|
||||
|
||||
@Cache("skip_extra_repos")
|
||||
def _find_apkbuilds(skip_extra_repos: bool = False) -> dict[str, Path]:
|
||||
# Try to get a cached result first (we assume that the aports don't change
|
||||
# in one pmbootstrap call)
|
||||
apkbuilds = pmb.helpers.other.cache.get("pmb.helpers.pmaports.apkbuilds")
|
||||
if apkbuilds is not None:
|
||||
return apkbuilds
|
||||
|
||||
apkbuilds = {}
|
||||
for package in pkgrepo_iter_package_dirs(skip_extra_repos=skip_extra_repos):
|
||||
pkgname = package.name
|
||||
|
@ -38,10 +33,6 @@ def _find_apkbuilds(skip_extra_repos: bool = False) -> dict[str, Path]:
|
|||
# Sort dictionary so we don't need to do it over and over again in
|
||||
# get_list()
|
||||
apkbuilds = dict(sorted(apkbuilds.items()))
|
||||
|
||||
# Save result in cache
|
||||
if not skip_extra_repos:
|
||||
pmb.helpers.other.cache["pmb.helpers.pmaports.apkbuilds"] = apkbuilds
|
||||
return apkbuilds
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue