From 7e54754c566d4d1e7b4861bd19c94a8024c8605f Mon Sep 17 00:00:00 2001
From: Lorenzo Pagliai <lorenzo.pagliai@seco.com>
Date: Thu, 9 May 2024 13:39:18 +0200
Subject: [PATCH] [SRCREV] Improve search for recipe names

Since now, when searching for a recipe name, if the line in the SRCREV.conf
file was matched, a break occurred, and all the lines with the same commit SHA
of that line were updated. This could be the case of the SRCREV.conf file
for meta-seco-rk layer where there need to be two recipes (one for u-boot
 and one for fw-sysdata) pointing to the same commit SHA.
In that case, if both recipes had the same commit SHA, the
script could handle it and update both lines. However, if a misalignment
occured by any chance, the script could not handle it. For this reason
we search for all occurrencies of the same recipe name in the
SRCREV.conf and update separately each occurrency.
---
 scripts/integrate_into_layer.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/integrate_into_layer.py b/scripts/integrate_into_layer.py
index 03e4e82..de47d69 100755
--- a/scripts/integrate_into_layer.py
+++ b/scripts/integrate_into_layer.py
@@ -22,16 +22,16 @@ def update_srcrev(srcrev, recipe_name, new_revision):
     for line in srcrev.splitlines():
         if pattern.search(line):
             project_line = line
-            break
+            
+            # Get current project revision from SRCREV file
+            # Assuming notation: <project> = "<hash>"
+            old_revision = project_line.split('"')[1]
+            
+            # Update SRCREV file
+            srcrev = srcrev.replace(old_revision, new_revision)
     if project_line is None:
         return None
 
-    # Get current project revision from SRCREV file
-    # Assuming notation: <project> = "<hash>"
-    old_revision = project_line.split('"')[1]
-
-    # Update SRCREV file
-    srcrev = srcrev.replace(old_revision, new_revision)
     return srcrev
 
 
-- 
GitLab