]> code.ossystems Code Review - openembedded-core.git/commitdiff
build-recipe-list: improvements
authorRoss Burton <ross.burton@intel.com>
Mon, 12 Mar 2018 16:37:47 +0000 (16:37 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 15 Mar 2018 10:38:47 +0000 (03:38 -0700)
scripts/distro/build-recipe-list.py

index 3f5f7c2fcc97a3cbdee4726de553814b72d818eb..21627648509e9b45c6de2f5316577c4c73259832 100755 (executable)
@@ -20,15 +20,27 @@ import argparse
 
 __version__ = "0.1.0"
 
-recipenames = []
-allrecipes = []
+# set of BPNs
+recipenames = set()
+# map of recipe -> data
+allrecipes = {}
+
+def make_bpn(recipe):
+    prefixes = ("nativesdk-",)
+    suffixes = ("-native", "-cross", "-initial", "-intermediate", "-crosssdk", "-cross-canadian")
+    for ix in prefixes + suffixes:
+        if ix in recipe:
+            recipe = recipe.replace(ix, "")
+    return recipe
+
 def gather_recipes(rows):
-    # store the data into the array
     for row in rows:
-        if row[0] not in recipenames:
-            recipenames.append(row[0])
-            allrecipes.append(row)
+        recipe = row[0]
+        bpn = make_bpn(recipe)
+        if bpn not in recipenames:
+            recipenames.add(bpn)
+        if recipe not in allrecipes:
+            allrecipes[recipe] = row
 
 def generate_recipe_list():
     # machine list
@@ -60,8 +72,8 @@ def generate_recipe_list():
     print("file : recipe-list.txt is created with %d entries." % len(recipenames))
 
     with open('all-recipe-list.txt', 'w') as f:
-        for recipe in sorted(allrecipes):
-            f.write("%s\n" % ','.join([str(data) for data in recipe]))
+        for recipe, row in sorted(allrecipes.items()):
+            f.write("%s\n" % ','.join(row))
 
 
 def diff_for_new_recipes(recipe1, recipe2):