Skip to contentSkip to conversation

lib/bb: Drop BBFILE_PRIORITY support

PATCH In review Richard Purdie 4 participants 7 messages Feb 6, 2024 – Jun 27, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/bb: Drop BBFILE_PRIORITY support

These entries, usually in layer.conf are part of an old, pre-layers part of bitbake for overlay/collection support. This is not really used any more and was replaced by the idea of layers.

In a recent discussion, we asked the question "When do you need to use proprities?" and the answer was "almost never" given all the other tools and techniques now available in layers.

These layer priorities cause users huge amounts of confusion. It is unclear to people how the "magic values" work if it is unset and if they are set differently, users don't expect the way it actually works and the effects it has between layers.

In discussions I've had, there has been surprisingly strong support for removing them entirely, even if that does means we'd need to fix some corner caes.

I wholly agree and support that idea, so lets remove the support and take a simplification where we can. The functionality had a and place but it has passed and we've moved on.

Developers are about to need to change layer.conf to update the series comparibility for the next release so it is a good time to do it.

This patch removes the core support and replaces it with a warning. It does not chase down every last reference or function parmeter, that can follow as time allows.

---
 lib/bb/cache.py     |  1 -
 lib/bb/cooker.py    | 51 +++++++--------------------------------
 lib/bb/providers.py | 58 +++++++++++++++++++--------------------------
 lib/bb/utils.py     |  2 +-
 4 files changed, 34 insertions(+), 78 deletions(-)
lib/bb/cache.py +0 -1
index 18d5574a31..64dbffc0f6 100644
@@ -818,7 +818,6 @@ class CacheData(object):
         # Indirect Cache variables (set elsewhere)
         self.ignored_dependencies = []
         self.world_target = set()
-        self.bbfile_priority = {}
 
     def add_from_recipeinfo(self, fn, info_array):
         for info in info_array:
lib/bb/cooker.py +9 -42

124 lines not on this page · raw message

lib/bb/providers.py +24 -34

95 lines not on this page · raw message

lib/bb/utils.py +1 -1
index 068b631c94..3ee3aa8875 100644
@@ -1563,7 +1563,7 @@ def get_file_layer(filename, d, collection_res={}):
         return match
 
     result = None
-    bbfiles = (d.getVar('BBFILES_PRIORITIZED') or '').split()
+    bbfiles = (d.getVar('BBFILES') or '').split()
     bbfilesmatch = False
     for bbfilesentry in bbfiles:
         if fnmatch.fnmatchcase(filename, bbfilesentry):
Signature · 1 line
2.40.1
#1 lore raw

Hi Richard, there is a word missing in the commit message:
" The functionality had a and place" -> "the functionality had a time and place"
Also a typo: "comparibility" -> " compatibility "

What is the correct way to set layer priorities after this patch (I'm asking because the BSP I'm using makes use of BBFILE_PRIORITY)?

Etienne

Quoted 359 lines · Richard Purdie

These entries, usually in layer.conf are part of an old, pre-layers part of bitbake for overlay/collection support. This is not really used any more and was replaced by the idea of layers.

In a recent discussion, we asked the question "When do you need to use proprities?" and the answer was "almost never" given all the other tools and techniques now available in layers.

These layer priorities cause users huge amounts of confusion. It is unclear to people how the "magic values" work if it is unset and if they are set differently, users don't expect the way it actually works and the effects it has between layers.

In discussions I've had, there has been surprisingly strong support for removing them entirely, even if that does means we'd need to fix some corner caes.

I wholly agree and support that idea, so lets remove the support and take a simplification where we can. The functionality had a and place but it has passed and we've moved on.

Developers are about to need to change layer.conf to update the series comparibility for the next release so it is a good time to do it.

This patch removes the core support and replaces it with a warning. It does not chase down every last reference or function parmeter, that can follow as time allows.

---
 lib/bb/cache.py     |  1 -
 lib/bb/cooker.py    | 51 +++++++--------------------------------
 lib/bb/providers.py | 58 +++++++++++++++++++--------------------------
 lib/bb/utils.py     |  2 +-
 4 files changed, 34 insertions(+), 78 deletions(-)
lib/bb/cache.py +0 -1
index 18d5574a31..64dbffc0f6 100644
@@ -818,7 +818,6 @@ class CacheData(object):
         # Indirect Cache variables (set elsewhere)
         self.ignored_dependencies = []
         self.world_target = set()
-        self.bbfile_priority = {}
 
     def add_from_recipeinfo(self, fn, info_array):
         for info in info_array:
lib/bb/cooker.py +1 -12
index c5bfef55d6..381379086a 100644
@@ -1124,26 +1124,15 @@ class BBCooker:
         errors = False
         self.bbfile_config_priorities = []
         if collections:
-            collection_priorities = {}
             collection_depends = {}
             collection_list = collections.split()
             min_prio = 0
             for c in collection_list:
                 bb.debug(1,'Processing %s in collection list' % (c))
 
-                # Get collection priority if defined explicitly
                 priority = self.data.getVar("BBFILE_PRIORITY_%s" % c)
                 if priority:
-                    try:
-                        prio = int(priority)
-                    except ValueError:
-                        parselog.error("invalid value for
 BBFILE_PRIORITY_%s: \"%s\"", c, priority)
-                        errors = True
-                    if min_prio == 0 or prio < min_prio:
-                        min_prio = prio
-                    collection_priorities[c] = prio
-                else:
-                    collection_priorities[c] = None
+                    bb.warn("Ignoring obsolete BBFILE_PRIORITY_%s" % c)
 
                 # Check dependencies and store information for priority

calculation
deps = self.data.getVar("LAYERDEPENDS_%s" % c)

lib/bb/cooker.py +0 -1
@@ -1204,22 +1193,9 @@ class BBCooker:
                         else:
                             parselog.debug3("Layer '%s' recommends layer
 '%s', but this layer is not enabled in your configuration", c, rec)
 
-            # Recursively work out collection priorities based on

dependencies

lib/bb/cooker.py +0 -10
-            def calc_layer_priority(collection):
-                if not collection_priorities[collection]:
-                    max_depprio = min_prio
-                    for dep in collection_depends[collection]:
-                        calc_layer_priority(dep)
-                        depprio = collection_priorities[dep]
-                        if depprio > max_depprio:
-                            max_depprio = depprio
-                    max_depprio += 1
-                    parselog.debug("Calculated priority of layer %s as

%d", collection, max_depprio)

lib/bb/cooker.py +0 -3
-                    collection_priorities[collection] = max_depprio
-
-            # Calculate all layer priorities using calc_layer_priority

and store in bbfile_config_priorities

lib/bb/cooker.py +3 -2
+
+            # Store all layer priorities in bbfile_config_priorities
             for c in collection_list:
-                calc_layer_priority(c)
                 regex = self.data.getVar("BBFILE_PATTERN_%s" % c)
                 if regex is None:
                     parselog.error("BBFILE_PATTERN_%s not defined" % c)
@@ -1236,7 +1212,7 @@ class BBCooker:
                         parselog.error("BBFILE_PATTERN_%s \"%s\" is not a
 valid regular expression", c, regex)
                         errors = True
                         continue
-                self.bbfile_config_priorities.append((c, regex, cre,
 collection_priorities[c]))
+                self.bbfile_config_priorities.append((c, regex, cre, 0))
         if errors:

# We've already printed the actual error(s) raise CollectionError("Errors during parsing layer
configuration")

lib/bb/cooker.py +1 -2
@@ -1358,7 +1334,6 @@ class BBCooker:
         # Tweak some variables
         item = info_array[0].pn
         self.recipecaches[mc].ignored_dependencies = set()
-        self.recipecaches[mc].bbfile_priority[fn] = 1
         self.configuration.limited_deps = True
 
         # Remove external dependencies
@@ -1639,7 +1614,7 @@ class BBCooker:
             self.show_appends_with_no_recipes()
             self.handlePrefProviders()
             for mc in self.multiconfigs:
-                self.recipecaches[mc].bbfile_priority =
 self.collections[mc].collection_priorities(self.recipecaches[mc].pkg_fn,
 self.parser.mcfilelist[mc], self.data)
+
 self.collections[mc].collection_priorities(self.recipecaches[mc].pkg_fn,

self.parser.mcfilelist[mc], self.data)
self.state = state.running

# Send an event listing all stamps reachable after parsing

lib/bb/cooker.py +2 -2
@@ -1767,9 +1742,9 @@ class CookerCollectFiles(object):
         self.bbfile_config_priorities = sorted(priorities, key=lambda
 tup: tup[1], reverse=True)
 
     def calc_bbfile_priority(self, filename):
-        for layername, _, regex, pri in self.bbfile_config_priorities:
+        for layername, _, regex, _ in self.bbfile_config_priorities:
             if regex.match(filename):
-                return pri, regex, layername
+                return 0, regex, layername
         return 0, None, None
 

def get_bbfiles(self):

lib/bb/cooker.py +0 -6
@@ -1801,10 +1776,6 @@ class CookerCollectFiles(object):
 
         files = (config.getVar( "BBFILES") or "").split()
 
-        # Sort files by priority
-        files.sort( key=lambda fileitem:
 self.calc_bbfile_priority(fileitem)[0] )
-        config.setVar("BBFILES_PRIORITIZED", " ".join(files))
-
         if not files:
             files = self.get_bbfiles()
@@ -1926,12 +1897,10 @@ class CookerCollectFiles(object):
         return tuple(filelist)
 
     def collection_priorities(self, pkgfns, fns, d):
-        # Return the priorities of the entries in pkgfns
-        # Also check that all the regexes in

self.bbfile_config_priorities are used
+ # Check that all the regexes in self.bbfile_config_priorities are
used
# (but to do that we need to ensure skipped recipes aren't
counted, nor

         # collections in BBFILE_PATTERN_IGNORE_EMPTY)
lib/bb/cooker.py +1 -4
-        priorities = {}
         seen = set()
         matched = set()
@@ -1943,7 +1912,7 @@ class CookerCollectFiles(object):
         # Calculate priorities for each file
         for p in pkgfns:
             realfn, cls, mc = bb.cache.virtualfn2realfn(p)
-            priorities[p], regex, _ = self.calc_bbfile_priority(realfn)
+            _, regex, _ = self.calc_bbfile_priority(realfn)
             if regex in unmatched_regex:
                 matched_regex.add(regex)
                 unmatched_regex.remove(regex)
@@ -1985,8 +1954,6 @@ class CookerCollectFiles(object):
                     collectlog.warning("No bb files in %s matched
 BBFILE_PATTERN_%s '%s'" % (self.mc if self.mc else 'default',
 
                    collection, pattern))
 
-        return priorities
-
 class ParsingFailure(Exception):

def __init__(self, realexception, recipe):
self.realexception = realexception

lib/bb/providers.py +8 -14
index e11a4637d1..f527dc469f 100644
@@ -71,21 +71,15 @@ def sortPriorities(pn, dataCache, pkg_pn = None):
     files = pkg_pn[pn]
     priorities = {}
     for f in files:
-        priority = dataCache.bbfile_priority[f]
         preference = dataCache.pkg_dp[f]
-        if priority not in priorities:
-            priorities[priority] = {}
-        if preference not in priorities[priority]:
-            priorities[priority][preference] = []
-        priorities[priority][preference].append(f)
-    tmp_pn = []
-    for pri in sorted(priorities):
-        tmp_pref = []
-        for pref in sorted(priorities[pri]):
-            tmp_pref.extend(priorities[pri][pref])
-        tmp_pn = [tmp_pref] + tmp_pn
-
-    return tmp_pn
+        if preference not in priorities:
+            priorities[preference] = []
+        priorities[preference].append(f)
+    tmp_pref = []
+    for pref in sorted(priorities):
+        tmp_pref.extend(priorities[pref])
+
+    return tmp_pref
 
 def versionVariableMatch(cfgData, keyword, pn):
     """
@@ -115,7 +109,7 @@ def preferredVersionMatch(pe, pv, pr, preferred_e,

preferred_v, preferred_r):
return True
return False

-def findPreferredProvider(pn, cfgData, dataCache, pkg_pn = None, item = None):
+def findPreferredProvider(pn, cfgData, dataCache, pkg_pn, item):
"""
Find the first provider in pkg_pn with REQUIRED_VERSION or
PREFERRED_VERSION set.

     """
lib/bb/providers.py +0 -0
@@ -156,15 +150,12 @@ def findPreferredProvider(pn, cfgData, dataCache,

pkg_pn = None, item = None):
preferred_e = None
preferred_r = None

lib/bb/providers.py +0 -4
-        for file_set in pkg_pn:
-            for f in file_set:
-                pe, pv, pr = dataCache.pkg_pepvpr[f]
-                if preferredVersionMatch(pe, pv, pr, preferred_e,

preferred_v, preferred_r):

lib/bb/providers.py +3 -5
-                    preferred_file = f
-                    preferred_ver = (pe, pv, pr)
-                    break
-            if preferred_file:
-                break;
+        for f in pkg_pn:
+            pe, pv, pr = dataCache.pkg_pepvpr[f]
+            if preferredVersionMatch(pe, pv, pr, preferred_e,

preferred_v, preferred_r):

lib/bb/providers.py +3 -0
+                preferred_file = f
+                preferred_ver = (pe, pv, pr)
+                break
         if preferred_r:
             pv_str = '%s-%s' % (preferred_v, preferred_r)
         else:
@@ -175,14 +166,13 @@ def findPreferredProvider(pn, cfgData, dataCache,

pkg_pn = None, item = None):
if not required:
logger.warning("preferred version %s of %s not
available%s", pv_str, pn, itemstr)

             available_vers = []
lib/bb/providers.py +7 -8
-            for file_set in pkg_pn:
-                for f in file_set:
-                    pe, pv, pr = dataCache.pkg_pepvpr[f]
-                    ver_str = pv
-                    if pe:
-                        ver_str = "%s:%s" % (pe, ver_str)
-                    if not ver_str in available_vers:
-                        available_vers.append(ver_str)
+            for f in pkg_pn:
+                pe, pv, pr = dataCache.pkg_pepvpr[f]
+                ver_str = pv
+                if pe:
+                    ver_str = "%s:%s" % (pe, ver_str)
+                if not ver_str in available_vers:
+                    available_vers.append(ver_str)
             if available_vers:
                 available_vers.sort()
                 logger.warning("versions of %s available: %s", pn, '

'.join(available_vers))

lib/bb/providers.py +0 -0
@@ -226,7 +216,7 @@ def findBestProvider(pn, cfgData, dataCache, pkg_pn =

None, item = None):
# Find the highest priority provider with a REQUIRED_VERSION or
PREFERRED_VERSION set
(preferred_ver, preferred_file, required) = findPreferredProvider(pn,
cfgData, dataCache, sortpkg_pn, item)
# Find the latest version of the highest priority provider
- (latest, latest_f) = findLatestProvider(pn, cfgData, dataCache,
sortpkg_pn[0])
+ (latest, latest_f) = findLatestProvider(pn, cfgData, dataCache,
sortpkg_pn)

if not required and preferred_file is None:
preferred_file = latest_f

lib/bb/providers.py +0 -0
@@ -272,7 +262,7 @@ def _filterProviders(providers, item, cfgData,

dataCache):
for pn in sorted(sortpkg_pn):
if pn in preferred_versions and preferred_versions[pn][1]:
continue
- preferred_versions[pn] = findLatestProvider(pn, cfgData,
dataCache, sortpkg_pn[pn][0])
+ preferred_versions[pn] = findLatestProvider(pn, cfgData,
dataCache, sortpkg_pn[pn])
eligible.append(preferred_versions[pn][1])

if not eligible:

lib/bb/utils.py +1 -2
index 068b631c94..3ee3aa8875 100644
@@ -1563,7 +1563,7 @@ def get_file_layer(filename, d, collection_res={}):
         return match
 
     result = None
-    bbfiles = (d.getVar('BBFILES_PRIORITIZED') or '').split()
+    bbfiles = (d.getVar('BBFILES') or '').split()
     bbfilesmatch = False
     for bbfilesentry in bbfiles:
         if fnmatch.fnmatchcase(filename, bbfilesentry):
--

2.40.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#15828):
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_bitbake-2Ddevel_message_15828&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=-Bk9X9Hkhx7e8xkBu1GuKqAlibTmXrlpwi04sRozJiDG2hny7t3LoP4wS7J5-J1X&s=_a531uesDcSw3cAizdlUN2ELeqExHwsmX8gPYd9A4M8&e=
Mute This Topic:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_104196430_7048771&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=-Bk9X9Hkhx7e8xkBu1GuKqAlibTmXrlpwi04sRozJiDG2hny7t3LoP4wS7J5-J1X&s=I91ejppj2TYm8gaYh7rkXuF4MY5pjp0ygWa4N1-6_74&e=
Group Owner: [email protected] Unsubscribe:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_bitbake-2Ddevel_unsub&d=DwIFaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=-Bk9X9Hkhx7e8xkBu1GuKqAlibTmXrlpwi04sRozJiDG2hny7t3LoP4wS7J5-J1X&s=hlSuw-Ye47nxphecCrzUytKlMvZ1ObQ1WK5hRj_dgb4&e=
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

If we're going to nitpick on commit message, then there is also "corner caes" :).

Quoted 373 lines · Etienne Cordonnier via lists.openembedded.org

Hi Richard, there is a word missing in the commit message:
" The functionality had a and place" -> "the functionality had a time and place"
Also a typo: "comparibility" -> " compatibility "

What is the correct way to set layer priorities after this patch (I'm asking because the BSP I'm using makes use of BBFILE_PRIORITY)?

Etienne

Quoted 343 lines · Richard Purdie

These entries, usually in layer.conf are part of an old, pre-layers part of bitbake for overlay/collection support. This is not really used any more and was replaced by the idea of layers.

In a recent discussion, we asked the question "When do you need to use proprities?" and the answer was "almost never" given all the other tools and techniques now available in layers.

These layer priorities cause users huge amounts of confusion. It is unclear to people how the "magic values" work if it is unset and if they are set differently, users don't expect the way it actually works and the effects it has between layers.

In discussions I've had, there has been surprisingly strong support for removing them entirely, even if that does means we'd need to fix some corner caes.

I wholly agree and support that idea, so lets remove the support and take a simplification where we can. The functionality had a and place but it has passed and we've moved on.

Developers are about to need to change layer.conf to update the series comparibility for the next release so it is a good time to do it.

This patch removes the core support and replaces it with a warning. It does not chase down every last reference or function parmeter, that can follow as time allows.

---
 lib/bb/cache.py     |  1 -
 lib/bb/cooker.py    | 51 +++++++--------------------------------
 lib/bb/providers.py | 58 +++++++++++++++++++--------------------------
 lib/bb/utils.py     |  2 +-
 4 files changed, 34 insertions(+), 78 deletions(-)
lib/bb/cache.py +0 -1
index 18d5574a31..64dbffc0f6 100644
@@ -818,7 +818,6 @@ class CacheData(object):
         # Indirect Cache variables (set elsewhere)
         self.ignored_dependencies = []
         self.world_target = set()
-        self.bbfile_priority = {}
 
     def add_from_recipeinfo(self, fn, info_array):
         for info in info_array:
lib/bb/cooker.py +1 -12
index c5bfef55d6..381379086a 100644
@@ -1124,26 +1124,15 @@ class BBCooker:
         errors = False
         self.bbfile_config_priorities = []
         if collections:
-            collection_priorities = {}
             collection_depends = {}
             collection_list = collections.split()
             min_prio = 0
             for c in collection_list:
                 bb.debug(1,'Processing %s in collection list' % (c))
 
-                # Get collection priority if defined explicitly
                 priority = self.data.getVar("BBFILE_PRIORITY_%s" % c)
                 if priority:
-                    try:
-                        prio = int(priority)
-                    except ValueError:
-                        parselog.error("invalid value for
 BBFILE_PRIORITY_%s: \"%s\"", c, priority)
-                        errors = True
-                    if min_prio == 0 or prio < min_prio:
-                        min_prio = prio
-                    collection_priorities[c] = prio
-                else:
-                    collection_priorities[c] = None
+                    bb.warn("Ignoring obsolete BBFILE_PRIORITY_%s" % c)
 
                 # Check dependencies and store information for priority

calculation
deps = self.data.getVar("LAYERDEPENDS_%s" % c)

lib/bb/cooker.py +0 -1
@@ -1204,22 +1193,9 @@ class BBCooker:
                         else:
                             parselog.debug3("Layer '%s' recommends layer
 '%s', but this layer is not enabled in your configuration", c, rec)
 
-            # Recursively work out collection priorities based on

dependencies

lib/bb/cooker.py +0 -10
-            def calc_layer_priority(collection):
-                if not collection_priorities[collection]:
-                    max_depprio = min_prio
-                    for dep in collection_depends[collection]:
-                        calc_layer_priority(dep)
-                        depprio = collection_priorities[dep]
-                        if depprio > max_depprio:
-                            max_depprio = depprio
-                    max_depprio += 1
-                    parselog.debug("Calculated priority of layer %s as

%d", collection, max_depprio)

lib/bb/cooker.py +0 -3
-                    collection_priorities[collection] = max_depprio
-
-            # Calculate all layer priorities using calc_layer_priority

and store in bbfile_config_priorities

lib/bb/cooker.py +3 -2
+
+            # Store all layer priorities in bbfile_config_priorities
             for c in collection_list:
-                calc_layer_priority(c)
                 regex = self.data.getVar("BBFILE_PATTERN_%s" % c)
                 if regex is None:
                     parselog.error("BBFILE_PATTERN_%s not defined" % c)
@@ -1236,7 +1212,7 @@ class BBCooker:
                         parselog.error("BBFILE_PATTERN_%s \"%s\" is not
 a valid regular expression", c, regex)
                         errors = True
                         continue
-                self.bbfile_config_priorities.append((c, regex, cre,
 collection_priorities[c]))
+                self.bbfile_config_priorities.append((c, regex, cre, 0))
         if errors:

# We've already printed the actual error(s) raise CollectionError("Errors during parsing layer
configuration")

lib/bb/cooker.py +1 -2
@@ -1358,7 +1334,6 @@ class BBCooker:
         # Tweak some variables
         item = info_array[0].pn
         self.recipecaches[mc].ignored_dependencies = set()
-        self.recipecaches[mc].bbfile_priority[fn] = 1
         self.configuration.limited_deps = True
 
         # Remove external dependencies
@@ -1639,7 +1614,7 @@ class BBCooker:
             self.show_appends_with_no_recipes()
             self.handlePrefProviders()
             for mc in self.multiconfigs:
-                self.recipecaches[mc].bbfile_priority =
 self.collections[mc].collection_priorities(self.recipecaches[mc].pkg_fn,
 self.parser.mcfilelist[mc], self.data)
+
 self.collections[mc].collection_priorities(self.recipecaches[mc].pkg_fn,

self.parser.mcfilelist[mc], self.data)
self.state = state.running

# Send an event listing all stamps reachable after parsing

lib/bb/cooker.py +2 -2
@@ -1767,9 +1742,9 @@ class CookerCollectFiles(object):
         self.bbfile_config_priorities = sorted(priorities, key=lambda
 tup: tup[1], reverse=True)
 
     def calc_bbfile_priority(self, filename):
-        for layername, _, regex, pri in self.bbfile_config_priorities:
+        for layername, _, regex, _ in self.bbfile_config_priorities:
             if regex.match(filename):
-                return pri, regex, layername
+                return 0, regex, layername
         return 0, None, None
 

def get_bbfiles(self):

lib/bb/cooker.py +0 -6
@@ -1801,10 +1776,6 @@ class CookerCollectFiles(object):
 
         files = (config.getVar( "BBFILES") or "").split()
 
-        # Sort files by priority
-        files.sort( key=lambda fileitem:
 self.calc_bbfile_priority(fileitem)[0] )
-        config.setVar("BBFILES_PRIORITIZED", " ".join(files))
-
         if not files:
             files = self.get_bbfiles()
@@ -1926,12 +1897,10 @@ class CookerCollectFiles(object):
         return tuple(filelist)
 
     def collection_priorities(self, pkgfns, fns, d):
-        # Return the priorities of the entries in pkgfns
-        # Also check that all the regexes in

self.bbfile_config_priorities are used
+ # Check that all the regexes in self.bbfile_config_priorities
are used
# (but to do that we need to ensure skipped recipes aren't
counted, nor

         # collections in BBFILE_PATTERN_IGNORE_EMPTY)
lib/bb/cooker.py +1 -4
-        priorities = {}
         seen = set()
         matched = set()
@@ -1943,7 +1912,7 @@ class CookerCollectFiles(object):
         # Calculate priorities for each file
         for p in pkgfns:
             realfn, cls, mc = bb.cache.virtualfn2realfn(p)
-            priorities[p], regex, _ = self.calc_bbfile_priority(realfn)
+            _, regex, _ = self.calc_bbfile_priority(realfn)
             if regex in unmatched_regex:
                 matched_regex.add(regex)
                 unmatched_regex.remove(regex)
@@ -1985,8 +1954,6 @@ class CookerCollectFiles(object):
                     collectlog.warning("No bb files in %s matched
 BBFILE_PATTERN_%s '%s'" % (self.mc if self.mc else 'default',
 
                    collection, pattern))
 
-        return priorities
-
 class ParsingFailure(Exception):

def __init__(self, realexception, recipe):
self.realexception = realexception

lib/bb/providers.py +8 -14
index e11a4637d1..f527dc469f 100644
@@ -71,21 +71,15 @@ def sortPriorities(pn, dataCache, pkg_pn = None):
     files = pkg_pn[pn]
     priorities = {}
     for f in files:
-        priority = dataCache.bbfile_priority[f]
         preference = dataCache.pkg_dp[f]
-        if priority not in priorities:
-            priorities[priority] = {}
-        if preference not in priorities[priority]:
-            priorities[priority][preference] = []
-        priorities[priority][preference].append(f)
-    tmp_pn = []
-    for pri in sorted(priorities):
-        tmp_pref = []
-        for pref in sorted(priorities[pri]):
-            tmp_pref.extend(priorities[pri][pref])
-        tmp_pn = [tmp_pref] + tmp_pn
-
-    return tmp_pn
+        if preference not in priorities:
+            priorities[preference] = []
+        priorities[preference].append(f)
+    tmp_pref = []
+    for pref in sorted(priorities):
+        tmp_pref.extend(priorities[pref])
+
+    return tmp_pref
 
 def versionVariableMatch(cfgData, keyword, pn):
     """
@@ -115,7 +109,7 @@ def preferredVersionMatch(pe, pv, pr, preferred_e,

preferred_v, preferred_r):
return True
return False

-def findPreferredProvider(pn, cfgData, dataCache, pkg_pn = None, item = None):
+def findPreferredProvider(pn, cfgData, dataCache, pkg_pn, item):
"""
Find the first provider in pkg_pn with REQUIRED_VERSION or
PREFERRED_VERSION set.

     """
lib/bb/providers.py +0 -0
@@ -156,15 +150,12 @@ def findPreferredProvider(pn, cfgData, dataCache,

pkg_pn = None, item = None):
preferred_e = None
preferred_r = None

lib/bb/providers.py +0 -4
-        for file_set in pkg_pn:
-            for f in file_set:
-                pe, pv, pr = dataCache.pkg_pepvpr[f]
-                if preferredVersionMatch(pe, pv, pr, preferred_e,

preferred_v, preferred_r):

lib/bb/providers.py +3 -5
-                    preferred_file = f
-                    preferred_ver = (pe, pv, pr)
-                    break
-            if preferred_file:
-                break;
+        for f in pkg_pn:
+            pe, pv, pr = dataCache.pkg_pepvpr[f]
+            if preferredVersionMatch(pe, pv, pr, preferred_e,

preferred_v, preferred_r):

lib/bb/providers.py +3 -0
+                preferred_file = f
+                preferred_ver = (pe, pv, pr)
+                break
         if preferred_r:
             pv_str = '%s-%s' % (preferred_v, preferred_r)
         else:
@@ -175,14 +166,13 @@ def findPreferredProvider(pn, cfgData, dataCache,

pkg_pn = None, item = None):
if not required:
logger.warning("preferred version %s of %s not
available%s", pv_str, pn, itemstr)

             available_vers = []
lib/bb/providers.py +7 -8
-            for file_set in pkg_pn:
-                for f in file_set:
-                    pe, pv, pr = dataCache.pkg_pepvpr[f]
-                    ver_str = pv
-                    if pe:
-                        ver_str = "%s:%s" % (pe, ver_str)
-                    if not ver_str in available_vers:
-                        available_vers.append(ver_str)
+            for f in pkg_pn:
+                pe, pv, pr = dataCache.pkg_pepvpr[f]
+                ver_str = pv
+                if pe:
+                    ver_str = "%s:%s" % (pe, ver_str)
+                if not ver_str in available_vers:
+                    available_vers.append(ver_str)
             if available_vers:
                 available_vers.sort()
                 logger.warning("versions of %s available: %s", pn, '

'.join(available_vers))

lib/bb/providers.py +0 -0
@@ -226,7 +216,7 @@ def findBestProvider(pn, cfgData, dataCache, pkg_pn =

None, item = None):
# Find the highest priority provider with a REQUIRED_VERSION or
PREFERRED_VERSION set
(preferred_ver, preferred_file, required) =
findPreferredProvider(pn, cfgData, dataCache, sortpkg_pn, item)
# Find the latest version of the highest priority provider
- (latest, latest_f) = findLatestProvider(pn, cfgData, dataCache,
sortpkg_pn[0])
+ (latest, latest_f) = findLatestProvider(pn, cfgData, dataCache,
sortpkg_pn)

if not required and preferred_file is None:
preferred_file = latest_f

lib/bb/providers.py +0 -0
@@ -272,7 +262,7 @@ def _filterProviders(providers, item, cfgData,

dataCache):
for pn in sorted(sortpkg_pn):
if pn in preferred_versions and preferred_versions[pn][1]:
continue
- preferred_versions[pn] = findLatestProvider(pn, cfgData,
dataCache, sortpkg_pn[pn][0])
+ preferred_versions[pn] = findLatestProvider(pn, cfgData,
dataCache, sortpkg_pn[pn])
eligible.append(preferred_versions[pn][1])

if not eligible:

lib/bb/utils.py +1 -2
index 068b631c94..3ee3aa8875 100644
@@ -1563,7 +1563,7 @@ def get_file_layer(filename, d, collection_res={}):
         return match
 
     result = None
-    bbfiles = (d.getVar('BBFILES_PRIORITIZED') or '').split()
+    bbfiles = (d.getVar('BBFILES') or '').split()
     bbfilesmatch = False
     for bbfilesentry in bbfiles:
         if fnmatch.fnmatchcase(filename, bbfilesentry):
--
Quoted 6 lines

2.40.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#15829):
https://lists.openembedded.org/g/bitbake-devel/message/15829
Mute This Topic: https://lists.openembedded.org/mt/104196430/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
In reply to Etienne Cordonnier
Quoted 3 lines · Etienne Cordonnier

Hi Richard, there is a word missing in the commit message:
" The functionality had a and place" -> "the functionality had a time and place" Also a typo: "comparibility" -> " compatibility "

Thanks, I'll tweak those on the branch.

Quoted 2 lines

What is the correct way to set layer priorities after this patch (I'm asking because the BSP I'm using makes use of BBFILE_PRIORITY)?

It may set it, but what is it trying to achieve by setting it?

As far as I know, the potential issue is needing to set specific PREFERRED_VERSION entries where older recipes need to be used.

Cheers,

Richard

#4 lore raw

Is the BBFILE_PRIORITY not controlling the order in which bbappends from different layers gets applied? I thought it was important e.g. when applying kernel configuration files (the last one to be applied override the previous ones).

Quoted 20 lines · Richard Purdie
Quoted 2 lines · Etienne Cordonnier

Hi Richard, there is a word missing in the commit message:
" The functionality had a and place" -> "the functionality had a time

and place"

Quoted 1 line

Also a typo: "comparibility" -> " compatibility "

Thanks, I'll tweak those on the branch.

Quoted 2 lines

What is the correct way to set layer priorities after this patch (I'm asking because the BSP I'm using makes use of BBFILE_PRIORITY)?

It may set it, but what is it trying to achieve by setting it?

As far as I know, the potential issue is needing to set specific PREFERRED_VERSION entries where older recipes need to be used.

Cheers,

Richard

#5 lore raw
Quoted 4 lines · Etienne Cordonnier via lists.openembedded.org

Is the BBFILE_PRIORITY not controlling the order in which bbappends from different layers gets applied? I thought it was important e.g. when applying kernel configuration files (the last one to be applied override the previous ones).

I'd rather think this is in BBLAYERS list order

Quoted 34 lines
Quoted 11 lines · Richard Purdie
Quoted 2 lines · Etienne Cordonnier

Hi Richard, there is a word missing in the commit message:
" The functionality had a and place" -> "the functionality had a time

and place"

Quoted 1 line

Also a typo: "comparibility" -> " compatibility "

Thanks, I'll tweak those on the branch.

Quoted 2 lines

What is the correct way to set layer priorities after this patch (I'm asking because the BSP I'm using makes use of BBFILE_PRIORITY)?

Quoted 9 lines

It may set it, but what is it trying to achieve by setting it?

As far as I know, the potential issue is needing to set specific PREFERRED_VERSION entries where older recipes need to be used.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15832): https://lists.openembedded.org/g/bitbake-devel/message/15832
Mute This Topic: https://lists.openembedded.org/mt/104196430/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw
Quoted 6 lines
Quoted 4 lines

Is the BBFILE_PRIORITY not controlling the order in which bbappends from different layers gets applied? I thought it was important e.g. when applying kernel configuration files (the last one to be applied override the previous ones).

I'd rather think this is in BBLAYERS list order

Apologies for the late reply. I've finally got time to test this, and the BBFILE_PRIORITY value of the layer indeed overrides the BBLAYERS list order, so files added to SRC_URI layers with higher BBFILE_PRIORITY are last in the SRC_URI order (I can reproduce this playing around with two linux-yocto_%.bbappend). I guess in this case reordering the layers is the proper solution, rather than relying on BBFILE_PRIORITY.
I was not aware that the order of inclusion in BBLAYERS mattered when using the same priority, thus I guess BBFILE_PRIORITY could be removed (this would break my project unless I reorder the layers properly, though, so I would definitely include this in the migration guide for the release).

Quoted 55 lines · Alexandre Belloni
Quoted 4 lines · Etienne Cordonnier via lists.openembedded.org

Is the BBFILE_PRIORITY not controlling the order in which bbappends from different layers gets applied? I thought it was important e.g. when applying kernel configuration files (the last one to be applied override the previous ones).

I'd rather think this is in BBLAYERS list order

Quoted 22 lines
Quoted 18 lines · Richard Purdie
Quoted 2 lines · Etienne Cordonnier

Hi Richard, there is a word missing in the commit message:
" The functionality had a and place" -> "the functionality had a time

and place"

Quoted 1 line

Also a typo: "comparibility" -> " compatibility "

Thanks, I'll tweak those on the branch.

Quoted 2 lines

What is the correct way to set layer priorities after this patch (I'm asking because the BSP I'm using makes use of BBFILE_PRIORITY)?

It may set it, but what is it trying to achieve by setting it?

As far as I know, the potential issue is needing to set specific PREFERRED_VERSION entries where older recipes need to be used.

Cheers,

Quoted 7 lines
Quoted 2 lines

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#15832):

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_bitbake-2Ddevel_message_15832&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=PFdWZklNEsJp5d53FoO0qUONhBkFLS6kTFi3Ri0VIGCdtMAJlG4EMCZ0fk27vcD1&s=nkms8wmkpBFNLoD_tIhMX7gighjb9-vDCGbqx4EUHpY&e=

Quoted 1 line

Mute This Topic:

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_104196430_3617179&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=PFdWZklNEsJp5d53FoO0qUONhBkFLS6kTFi3Ri0VIGCdtMAJlG4EMCZ0fk27vcD1&s=O5kulu9daAQPZCy9pk2wkeWkXPB9ZFJjjyvIIRayD4o&e=

Quoted 2 lines

Group Owner: [email protected] Unsubscribe:

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_bitbake-2Ddevel_unsub&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=PFdWZklNEsJp5d53FoO0qUONhBkFLS6kTFi3Ri0VIGCdtMAJlG4EMCZ0fk27vcD1&s=qv5A5DpnymmLJoarby3NF1ZNC75oZXuo87auR8Y2FK8&e=
[[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering

https://urldefense.proofpoint.com/v2/url?u=https-3A__bootlin.com&d=DwIDaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=PFdWZklNEsJp5d53FoO0qUONhBkFLS6kTFi3Ri0VIGCdtMAJlG4EMCZ0fk27vcD1&s=_Eu0UvlfGlLxisJ57yP2XH8J30Q2PhmSO19R0djWdzM&e=