bitbake: toaster: orm generate_recipe_file_contents Handler for require recipe

Add a special case for when the recipe we have based a custom image
recipe on requires another recipe.
In this case we need to adjust the file location to be able to
require
the recipe when we're in the toaster-custom-images layer.

For example:
"require core-image-minimal.bb" is changed to:
"require recipes-core/images/core-image-minimal.bb"

(Bitbake rev: 26025e1ea49b3ebfcfd508d1608fa8c9e722ad03)

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>
This commit is contained in:
Michael Wood 2016-01-27 12:44:54 +00:00 committed by Richard Purdie
parent 769017e477
commit 38f4913270
1 changed files with 23 additions and 1 deletions

View File

@ -1426,7 +1426,6 @@ class CustomImageRecipe(Recipe):
Q(pk__in=self.excludes_set.values_list('pk', flat=True)) |
Q(name__icontains="packagegroup") |
Q(name__icontains="locale")):
print pkg.name
packages_conf += pkg.name+' '
packages_conf += "\""
@ -1435,6 +1434,29 @@ class CustomImageRecipe(Recipe):
(self.base_recipe.layer_version.dirpath,
self.base_recipe.file_path), 'r').read()
# Add a special case for when the recipe we have based a custom image
# recipe on requires another recipe.
# For example:
# "require core-image-minimal.bb" is changed to:
# "require recipes-core/images/core-image-minimal.bb"
if "require" in base_recipe:
req_search = re.search(r'(require\s+)(.+\.bb\s*$)',
base_recipe,
re.MULTILINE)
require_filename = req_search.group(2).strip()
corrected_location = Recipe.objects.filter(
Q(layer_version=self.base_recipe.layer_version) &
Q(file_path__icontains=require_filename)).last().file_path
new_require_line = "require %s" % corrected_location
base_recipe = \
base_recipe.replace(req_search.group(0), new_require_line)
info = {"date" : timezone.now().strftime("%Y-%m-%d %H:%M:%S"),
"base_recipe" : base_recipe,
"recipe_name" : self.name,