Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions conf/include/package_revisions_oss.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ LAYER_EXTENSION ?= ""
OSS_LAYER_ARCH = "${@get_oss_arch(d)}${LAYER_EXTENSION}"
PACKAGE_EXTRA_ARCHS:append = " ${OSS_LAYER_ARCH}"

TOOLCHAIN_LAYER_ARCH = "${@get_oss_arch(d)}-toolchain"
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TOOLCHAIN_LAYER_ARCH does not include LAYER_EXTENSION, unlike OSS_LAYER_ARCH which does include it (line 25). This means toolchain libraries will be shared across all layer extensions. Verify this is intentional - if different LAYER_EXTENSION values represent incompatible build configurations, toolchain libraries from different extensions might have ABI incompatibilities. If this sharing is intentional to optimize storage/bandwidth, consider adding a comment explaining this design decision.

Suggested change
TOOLCHAIN_LAYER_ARCH = "${@get_oss_arch(d)}-toolchain"
TOOLCHAIN_LAYER_ARCH = "${@get_oss_arch(d)}${LAYER_EXTENSION}-toolchain"

Copilot uses AI. Check for mistakes.
PACKAGE_EXTRA_ARCHS:append = " ${TOOLCHAIN_LAYER_ARCH}"
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables ENABLE_DOCKER_TARGET_TOOLCHAIN_FEED and PREBUILT_TOOLCHAIN_TARGET_LIBS are used in the conditional logic but are not defined or documented in this file. Consider adding comments to document:

  1. What ENABLE_DOCKER_TARGET_TOOLCHAIN_FEED controls (expected values and behavior)
  2. What PREBUILT_TOOLCHAIN_TARGET_LIBS should contain (expected to be a directory path)
  3. The relationship between these variables and TOOLCHAIN_TARGET_LIBS_URI

This would help users understand how to configure the toolchain feed mechanism and when each approach is used.

Suggested change
PACKAGE_EXTRA_ARCHS:append = " ${TOOLCHAIN_LAYER_ARCH}"
PACKAGE_EXTRA_ARCHS:append = " ${TOOLCHAIN_LAYER_ARCH}"
# Toolchain feed configuration:
# - TOOLCHAIN_TARGET_LIBS_URI:
# URI of the remote IPK feed that provides target toolchain libraries
# for ${TOOLCHAIN_LAYER_ARCH}. When non-empty, this URI is appended
# to IPK_FEED_URIS, unless one of the local/alternative mechanisms
# below is in use.
#
# - ENABLE_DOCKER_TARGET_TOOLCHAIN_FEED:
# When set to "1", a Docker image is expected to provide the target
# toolchain libraries, so no remote TOOLCHAIN_TARGET_LIBS_URI feed
# is added for ${TOOLCHAIN_LAYER_ARCH}.
#
# - PREBUILT_TOOLCHAIN_TARGET_LIBS:
# Absolute path to a directory on the build host that contains
# prebuilt target toolchain libraries. If this variable is set and
# points to an existing directory (os.path.isdir(...)), the local
# directory is used instead of the remote TOOLCHAIN_TARGET_LIBS_URI
# feed.
#
# The IPK_FEED_URIS:append expression below adds TOOLCHAIN_TARGET_LIBS_URI
# only when a remote feed is configured (TOOLCHAIN_TARGET_LIBS_URI != "")
# and neither a Docker-provided feed nor a valid PREBUILT_TOOLCHAIN_TARGET_LIBS
# directory is in use.

Copilot uses AI. Check for mistakes.
TOOLCHAIN_TARGET_LIBS_URI ?= ""
IPK_FEED_URIS:append = " ${@(' %s##%s' % (d.getVar('TOOLCHAIN_LAYER_ARCH'), d.getVar('TOOLCHAIN_TARGET_LIBS_URI')) if d.getVar('TOOLCHAIN_TARGET_LIBS_URI') and (not d.getVar('ENABLE_DOCKER_TARGET_TOOLCHAIN_FEED') == '1' or not os.path.isdir(d.getVar('PREBUILT_TOOLCHAIN_TARGET_LIBS') or '')) else '')}"
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional logic in this line is complex and could be difficult to maintain. Consider refactoring this into a helper function that clearly expresses the intent. For example:

def should_add_toolchain_feed_uri(d):
    """
    Add toolchain feed URI if:
    - TOOLCHAIN_TARGET_LIBS_URI is defined AND
    - (Docker feed is not enabled OR prebuilt directory doesn't exist)
    """
    if not d.getVar('TOOLCHAIN_TARGET_LIBS_URI'):
        return False
    
    docker_feed_enabled = d.getVar('ENABLE_DOCKER_TARGET_TOOLCHAIN_FEED') == '1'
    prebuilt_dir = d.getVar('PREBUILT_TOOLCHAIN_TARGET_LIBS') or ''
    prebuilt_exists = os.path.isdir(prebuilt_dir)
    
    return not docker_feed_enabled or not prebuilt_exists

This would make the code more readable and easier to test. The inline expression could then be simplified to use this helper function.

Copilot uses AI. Check for mistakes.

TARGET_VENDOR ?= "-rdk"

# PREFERRED VERSION settings
Expand Down Expand Up @@ -253,10 +258,10 @@ PR:pn-gawk ?= "r3"
PACKAGE_ARCH:pn-gawk ?= "${OSS_LAYER_ARCH}"

PR:pn-gcc-runtime ?= "r0"
PACKAGE_ARCH:pn-gcc-runtime ?= "${OSS_LAYER_ARCH}"
PACKAGE_ARCH:pn-gcc-runtime ?= "${TOOLCHAIN_LAYER_ARCH}"

PR:pn-gcc-sanitizers ?= "r0"
PACKAGE_ARCH:pn-gcc-sanitizers ?= "${OSS_LAYER_ARCH}"
PACKAGE_ARCH:pn-gcc-sanitizers ?= "${TOOLCHAIN_LAYER_ARCH}"

PR:pn-sed ?= "r0"
PACKAGE_ARCH:pn-sed ?= "${OSS_LAYER_ARCH}"
Expand All @@ -277,13 +282,13 @@ PR:pn-glib-2.0 ?= "r1"
PACKAGE_ARCH:pn-glib-2.0 ?= "${OSS_LAYER_ARCH}"

PR:pn-glibc ?= "r1"
PACKAGE_ARCH:pn-glibc ?= "${OSS_LAYER_ARCH}"
PACKAGE_ARCH:pn-glibc ?= "${TOOLCHAIN_LAYER_ARCH}"

PR:pn-glibc-locale ?= "r0"
PACKAGE_ARCH:pn-glibc-locale ?= "${OSS_LAYER_ARCH}"
PACKAGE_ARCH:pn-glibc-locale ?= "${TOOLCHAIN_LAYER_ARCH}"

PR:pn-glibc-mtrace ?= "r0"
PACKAGE_ARCH:pn-glibc-mtrace ?= "${OSS_LAYER_ARCH}"
PACKAGE_ARCH:pn-glibc-mtrace ?= "${TOOLCHAIN_LAYER_ARCH}"

PR:pn-glib-networking ?= "r2"
PACKAGE_ARCH:pn-glib-networking ?= "${OSS_LAYER_ARCH}"
Expand Down Expand Up @@ -427,10 +432,10 @@ PR:pn-libffi ?= "r0"
PACKAGE_ARCH:pn-libffi ?= "${OSS_LAYER_ARCH}"

PR:pn-libgcc ?= "r0"
PACKAGE_ARCH:pn-libgcc ?= "${OSS_LAYER_ARCH}"
PACKAGE_ARCH:pn-libgcc ?= "${TOOLCHAIN_LAYER_ARCH}"

PR:pn-libgcc-initial ?= "r0"
PACKAGE_ARCH:pn-libgcc-initial ?= "${OSS_LAYER_ARCH}"
PACKAGE_ARCH:pn-libgcc-initial ?= "${TOOLCHAIN_LAYER_ARCH}"

PR:pn-libgcrypt ?= "r1"
PACKAGE_ARCH:pn-libgcrypt ?= "${OSS_LAYER_ARCH}"
Expand Down