Bug 12538

Summary: Using += with SDKIMAGE_FEATURES overrides the value of variable
Product: [Yocto Project Subprojects] eSDK Reporter: Anuj Mittal <anuj.mittal>
Component: eSDKAssignee: Paul Eggleton <bluelightning>
Status: RESOLVED NOTABUG QA Contact: Francisco Pedraza <francisco.j.pedraza.gonzalez>
Severity: normal    
Priority: Undecided CC: ross.burton
Version: 2.5   
Target Milestone: ---   
Hardware: x86   
OS: x86   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Anuj Mittal 2018-02-08 02:09:34 UTC
Added this to local.conf:

SDKIMAGE_FEATURES += "staticdev-pkgs"

After that:

$ bitbake -c populate_sdk core-image-minimal -e | grep SDKIMAGE
# $SDKIMAGE_FEATURES [3 operations]
SDKIMAGE_FEATURES=" staticdev-pkgs"
# $SDKIMAGE_INSTALL_COMPLEMENTARY
#     "${@complementary_globs("SDKIMAGE_FEATURES", d)}"
SDKIMAGE_INSTALL_COMPLEMENTARY="*-staticdev"
    variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT',

Using _append works fine. Is this expected?
Comment 1 Ross Burton 2018-02-08 16:10:15 UTC
Don't use grep and you'll see the full context:

# $SDKIMAGE_FEATURES [3 operations]
#   append /home/ross/Yocto/poky/build/conf/local.conf:439
#     "staticdev-pkgs"
#   set /home/ross/Yocto/poky/meta/conf/documentation.conf:372
#     [doc] "Equivalent to IMAGE_FEATURES. However, this variable applies to the SDK generated from an image using the command 'bitbake -c populate_sdk imagename'."
#   set /home/ross/Yocto/poky/meta/classes/populate_sdk_base.bbclass:20
#     [_defaultval] "dev-pkgs dbg-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}"

The defaultval from populate_sdk_base is only used if there isn't a value set as it uses ??=.

So yes, it's by design that in local.conf you'll need to use _append.

(the same reasoning applies to DISTRO_FEATURES, IMAGE_FEATURES, and more)