aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/toaster/orm/models.py12
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py25
2 files changed, 33 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index f9f1b46cdb6..ca5b9b16cda 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -630,13 +630,15 @@ class Package(models.Model):
class CustomImagePackage(Package):
# CustomImageRecipe fields to track pacakges appended,
- # included and excluded from a CustomImageRecipe
+ # included and excluded or depends from a CustomImageRecipe
recipe_includes = models.ManyToManyField('CustomImageRecipe',
related_name='includes_set')
recipe_excludes = models.ManyToManyField('CustomImageRecipe',
related_name='excludes_set')
recipe_appends = models.ManyToManyField('CustomImageRecipe',
related_name='appends_set')
+ recipe_depends = models.ManyToManyField('CustomImageRecipe',
+ related_name='depends_set')
@@ -1308,10 +1310,12 @@ class CustomImageRecipe(Recipe):
project = models.ForeignKey(Project)
def get_all_packages(self):
- """Get the included packages and any appended packages"""
+ """Get the included packages and any appended packages and any
+ packages added as a dependencies"""
return CustomImagePackage.objects.filter((Q(recipe_appends=self) |
- Q(recipe_includes=self)) &
- ~Q(recipe_excludes=self))
+ Q(recipe_includes=self) |
+ Q(recipe_depends=self)) &
+ ~Q(recipe_excludes=self))
def generate_recipe_file_contents(self):
"""Generate the contents for the recipe file."""
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 68ef652fa02..9b0863476f1 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2841,6 +2841,7 @@ if True:
"packages" : list(packages),
"total" : len(packages)
}
+ # GET package_id
else:
all_current_packages = recipe.get_all_packages()
# TODO Django 1.8 will allow us to map these to nicer keys
@@ -2912,15 +2913,39 @@ if True:
else:
recipe.appends_set.add(package)
+ # Add the dependencies we think will be added to the recipe
+ # as a result of appending this package.
+ # TODO this should recurse down the entire deps tree
+ for dep in package.package_dependencies_source.all():
+ try:
+ cust_package =\
+ CustomImagePackage.objects.get(
+ name=dep.depends_on.name)
+
+ logger.info("adding %s", cust_package.name)
+ recipe.depends_set.add(cust_package)
+ except:
+ logger.warning("Could not add package's suggested"
+ "dependencies to the list")
+
+
+
+
return {"error": "ok"}
elif request.method == 'DELETE':
try:
+ depends_packages = recipe.depends_set.values_list('pk',
+ flat=True)
# If we're deleting a package which is included we need to
# Add it to the excludes list.
if package.pk in included_packages:
recipe.excludes_set.add(package)
+ # The package we're removing was added to indicate
+ # a package dependency
+ elif package.pk in depends_packages:
+ recipe.depends_set.remove(package)
else:
recipe.appends_set.remove(package)
return {"error": "ok"}