From 38f49132706d260498ed221c51d3aeef36dde0e9 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Wed, 27 Jan 2016 12:44:54 +0000 Subject: 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 Signed-off-by: brian avery Signed-off-by: Richard Purdie --- bitbake/lib/toaster/orm/models.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'bitbake/lib/toaster/orm/models.py') diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 4e790c2dd6..ba1eb0f2c8 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py @@ -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, -- cgit v1.2.3-54-g00ecf