aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-02-05 11:59:17 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-10 13:29:22 +0000
commit8d5b61e495b1862ee775bc75ff4babb4a62cca6c (patch)
treeeef2bf55058779a0ff400fe800988097e2e2f582 /bitbake
parent86db0bd7f213c192214b4e3dc4d42b0374004fc6 (diff)
downloadopenembedded-core-contrib-8d5b61e495b1862ee775bc75ff4babb4a62cca6c.tar.gz
bitbake: toaster: models Add update_package_list for CustomImageRecipe
Add a method to update the packages included list from the last build, this effectively "synchronises" the package list from what we think will happen at the Customise image stage with what actually was produced with a build. It's not ideal to have this function here but we also need to make sure that no race condition of the user accessing this list and it being updated occurs. (Bitbake rev: 8cf6e67a955574b33856a082bdadf3194f2b6ba4) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/orm/models.py50
1 files changed, 48 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index ee8f1f7166..5e715e302f 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1455,11 +1455,57 @@ class CustomImageRecipe(Recipe):
Q(build__project=self.project) &
Q(target=self.name)).last()
+ def update_package_list(self):
+ """ Update the package list from the last good build of this
+ CustomImageRecipe
+ """
+ # Check if we're aldready up-to-date or not
+ target = self.get_last_successful_built_target()
+ if target == None:
+ # So we've never actually built this Custom recipe but what about
+ # the recipe it's based on?
+ target = \
+ Target.objects.filter(Q(build__outcome=Build.SUCCEEDED) &
+ Q(build__project=self.project) &
+ Q(target=self.base_recipe.name)).last()
+ if target == None:
+ return
+
+ if target.build.completed_on == self.last_updated:
+ return
+
+ self.includes_set.clear()
+
+ excludes_list = self.excludes_set.values_list('name', flat=True)
+ appends_list = self.appends_set.values_list('name', flat=True)
+
+ built_packages_list = \
+ target.target_installed_package_set.values_list('package__name',
+ flat=True)
+ for built_package in built_packages_list:
+ # Is the built package in the custom packages list?
+ if built_package in excludes_list:
+ continue
+
+ if built_package in appends_list:
+ continue
+
+ cust_img_p = \
+ CustomImagePackage.objects.get(name=built_package)
+ self.includes_set.add(cust_img_p)
+
+
+ self.last_updated = target.build.completed_on
+ self.save()
+
def get_all_packages(self):
"""Get the included packages and any appended packages"""
+ self.update_package_list()
+
return CustomImagePackage.objects.filter((Q(recipe_appends=self) |
- Q(recipe_includes=self)) &
- ~Q(recipe_excludes=self))
+ Q(recipe_includes=self)) &
+ ~Q(recipe_excludes=self))
+
def generate_recipe_file_contents(self):
"""Generate the contents for the recipe file."""