Skip to contentSkip to conversation

toaster: orm better detect requires during CustomImageRecipe generation

PATCH In review Joshua Lock 2 participants 2 messages Mar 31, 2016 – Apr 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster: orm better detect requires during CustomImageRecipe generation

We were doing a string search for the literal string "require" and assuming that a match meant the recipe uses the require keyword to include the contents of another recipe. This test isn't very smart (it should at least have matched on "require ") and triggers on the word require anywhere in the recipe, i.e. the word "required" in the DESCRIPTION of core-image-lsb.bb, and then breaks as the much smarter regex fails to match anything.

Instead always run the regex search and only try to update the require entry when the regex matches.

---
 bitbake/lib/toaster/orm/models.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
bitbake/lib/toaster/orm/models.py +2 -3
index 6ae6316..610d542 100644
@@ -1547,11 +1547,10 @@ class CustomImageRecipe(Recipe):
         # "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*$)',
+        req_search = re.search(r'(require\s+)(.+\.bb\s*$)',
                                    base_recipe,
                                    re.MULTILINE)
-
+        if req_search:
             require_filename = req_search.group(2).strip()
 
             corrected_location = Recipe.objects.filter(
Signature · 1 line
2.5.5
#1 lore raw

Sent upstream to bitbake-devel and added to toaster-next.

Elliot

Quoted 44 lines · Joshua Lock

We were doing a string search for the literal string "require" and assuming that a match meant the recipe uses the require keyword to include the contents of another recipe. This test isn't very smart (it should at least have matched on "require ") and triggers on the word require anywhere in the recipe, i.e. the word "required" in the DESCRIPTION of core-image-lsb.bb, and then breaks as the much smarter regex fails to match anything.

Instead always run the regex search and only try to update the require entry when the regex matches.

---
 bitbake/lib/toaster/orm/models.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
bitbake/lib/toaster/orm/models.py +2 -4
index 6ae6316..610d542 100644
@@ -1547,11 +1547,10 @@ class CustomImageRecipe(Recipe):
         # "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*$)',
+        req_search = re.search(r'(require\s+)(.+\.bb\s*$)',
                                    base_recipe,
                                    re.MULTILINE)
-
+        if req_search:
             require_filename = req_search.group(2).strip()
 
             corrected_location = Recipe.objects.filter(
--

2.5.5

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre