pmb.helpers.pmaports: cache _glob_apkbuilds results (!1896)
This commit is contained in:
parent
f598a7fd41
commit
0c179a5cf9
|
@ -131,6 +131,7 @@ def add_cache(args):
|
|||
"find_aport": {},
|
||||
"pmb.helpers.package.depends_recurse": {},
|
||||
"pmb.helpers.package.get": {},
|
||||
"pmb.helpers.pmaports._glob_apkbuilds": {},
|
||||
"pmb.helpers.repo.update": repo_update})
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,16 @@ import pmb.parse
|
|||
|
||||
|
||||
def _glob_apkbuilds(args, pkgname='*'):
|
||||
return glob.glob(args.aports + "/**/" + pkgname + "/APKBUILD", recursive=True)
|
||||
# Try to get a cached result first (we assume, that the aports don't change
|
||||
# in one pmbootstrap call)
|
||||
if pkgname in args.cache["pmb.helpers.pmaports._glob_apkbuilds"]:
|
||||
return args.cache["pmb.helpers.pmaports._glob_apkbuilds"][pkgname]
|
||||
|
||||
ret = glob.glob(args.aports + "/**/" + pkgname + "/APKBUILD", recursive=True)
|
||||
|
||||
# Save result in cache
|
||||
args.cache["pmb.helpers.pmaports._glob_apkbuilds"][pkgname] = ret
|
||||
return ret
|
||||
|
||||
|
||||
def get_list(args, pkgname='*'):
|
||||
|
|
Loading…
Reference in New Issue