@@ -26,6 +26,12 @@ WORKSPACE_LAYERDEPENDS = 'oe-core'
# to match that pattern.
WORKSPACE_APPENDS_DIR = 'recipes-appends'
+# Written to the bbappend for recipes which live in the workspace (from
+# 'devtool add' and 'devtool upgrade'). Layers no longer have priorities so
+# without this a recipe elsewhere with the same name and an equal or higher
+# version would be used instead.
+WORKSPACE_PREFERENCE_LINES = 'DEFAULT_PREFERENCE = "99"\n'
+
def get_workspace_appends_dir(workspace_path):
"""Return the directory within the workspace layer holding bbappends"""
return os.path.join(workspace_path, WORKSPACE_APPENDS_DIR)
@@ -21,7 +21,7 @@ import glob
from collections import OrderedDict
from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, update_unlockedsigs, check_prerelease_version, check_git_repo_dirty, check_git_repo_op, DevtoolError
-from devtool import parse_recipe, get_workspace_appends_dir
+from devtool import parse_recipe, get_workspace_appends_dir, WORKSPACE_PREFERENCE_LINES
import bb.utils
@@ -255,6 +255,7 @@ def add(args, config, basepath, workspace):
with open(appendfile, 'w') as f:
f.write('inherit externalsrc\n')
f.write('EXTERNALSRC = "%s"\n' % srctree)
+ f.write(WORKSPACE_PREFERENCE_LINES)
b_is_s = use_external_build(args.same_dir, args.no_same_dir, rd)
if b_is_s:
@@ -26,7 +26,7 @@ sys.path = sys.path + [devtool_path]
import oe.recipeutils
from devtool import standard
-from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build, update_unlockedsigs, check_prerelease_version, get_workspace_appends_dir
+from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build, update_unlockedsigs, check_prerelease_version, get_workspace_appends_dir, WORKSPACE_PREFERENCE_LINES
logger = logging.getLogger('devtool')
@@ -158,6 +158,7 @@ def _write_append(rc, srctreebase, srctree, same_dir, no_same_dir, revs, copied,
f.write(('# NOTE: We use pn- overrides here to avoid affecting'
'multiple variants in the case where the recipe uses BBCLASSEXTEND\n'))
f.write('EXTERNALSRC:pn-%s = "%s"\n' % (pn, srctree))
+ f.write(WORKSPACE_PREFERENCE_LINES)
b_is_s = use_external_build(same_dir, no_same_dir, d)
if b_is_s:
f.write('EXTERNALSRC_BUILD:pn-%s = "%s"\n' % (pn, srctree))
The workspace layer's priority of 99 used to ensure recipes from devtool add and devtool upgrade were used over any other recipe with the same name. Without priorities an equal or higher version elsewhere now wins, for example devtool add of i2c-tools 3.1.2 picked up OE-Core's 4.4 in test_devtool_rename. Set DEFAULT_PREFERENCE in the bbappend devtool writes for these recipes, which only applies to the workspace's version of the recipe and is removed by devtool finish/reset. Tested that a lower version workspace recipe is now selected. AI-Generated: Uses Claude Opus 5.5 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- scripts/lib/devtool/__init__.py | 6 ++++++ scripts/lib/devtool/standard.py | 3 ++- scripts/lib/devtool/upgrade.py | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-)