rrs_distros: ensure we only run distro processing once

We do not need to get the distro package lists for every layerbranch,
just once.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-09-04 15:30:43 +12:00
parent 9d0e048ded
commit 549c5377db

View File

@ -113,6 +113,7 @@ if __name__=="__main__":
logger.debug("Starting recipe distros update ...") logger.debug("Starting recipe distros update ...")
origsyspath = sys.path origsyspath = sys.path
pkglst_dir = None
for maintplan in maintplans: for maintplan in maintplans:
for item in maintplan.maintenanceplanlayerbranch_set.all(): for item in maintplan.maintenanceplanlayerbranch_set.all():
layerbranch = item.layerbranch layerbranch = item.layerbranch
@ -127,10 +128,12 @@ if __name__=="__main__":
with transaction.atomic(): with transaction.atomic():
utils.setup_core_layer_sys_path(settings, layerbranch.branch.name) utils.setup_core_layer_sys_path(settings, layerbranch.branch.name)
from oe import distro_check if not pkglst_dir:
logger.debug("Downloading distro's package information ...") # Only need to do this once
distro_check.create_distro_packages_list(fetchdir, d) from oe import distro_check
pkglst_dir = os.path.join(fetchdir, "package_lists") logger.debug("Downloading distro's package information ...")
distro_check.create_distro_packages_list(fetchdir, d)
pkglst_dir = os.path.join(fetchdir, "package_lists")
RecipeDistro.objects.filter(recipe__layerbranch = layerbranch).delete() RecipeDistro.objects.filter(recipe__layerbranch = layerbranch).delete()