Skip to content

Conversation

@noahp
Copy link
Contributor

@noahp noahp commented Nov 14, 2025

Enable filtering the blobs selected by west blobs list and west blobs clean with a regex pattern, just like west blobs fetch.

Support this when checking for blob existence in drivers/wifi for esp32, so now it's possible to build for a selected esp32 family SOC (for example esp32c6) with only the blobs for that chip downloaded:

west blobs clean hal_espressif  # delete all hal_espressif blobs
west blobs fetch hal_espressif --allow-regex '.*esp32c6.*'
west build -b esp32c6_devkitc/esp32c6/hpcore zephyr/samples/net/wifi/shell

Enable filtering the blobs selected by `west blobs list` and `west blobs
clean` with a regex pattern, just like `west blobs fetch`.

Support this when checking for blob existence in `drivers/wifi` for esp32,
so now it's possible to build for a selected esp32 family SOC (for example
`esp32c6`) with only the blobs for that chip downloaded:

west blobs clean hal_espressif  # delete all hal_espressif blobs
west blobs fetch hal_espressif --allow-regex '.*esp32c6.*'
west build -b esp32c6_devkitc/esp32c6/hpcore zephyr/samples/net/wifi/shell

Signed-off-by: Noah Pendleton <[email protected]>
@noahp noahp marked this pull request as ready for review November 17, 2025 15:53
Copilot AI review requested due to automatic review settings November 17, 2025 15:53
Copilot finished reviewing on behalf of noahp November 17, 2025 15:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the --allow-regex filter option to west blobs list and west blobs clean commands, extending functionality that previously only existed for west blobs fetch. The changes enable users to selectively work with binary blobs based on regex patterns, particularly useful for Espressif ESP32 chips where users can download and verify only the blobs needed for their specific SOC variant.

Key changes:

  • Moved --allow-regex argument from fetch-specific to a global option available for all blob subcommands
  • Added regex filtering to the list() function to filter displayed blobs by path pattern
  • Extended zephyr_blobs_verify() CMake function to accept a REGEX parameter for filtered blob verification

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
scripts/west_commands/blobs.py Moved --allow-regex from fetch-specific option to global option; implemented regex filtering in list() function
cmake/modules/extensions.cmake Added REGEX parameter to zephyr_blobs_verify() function to pass regex filter to west blobs list command
drivers/wifi/CMakeLists.txt Applied SOC-specific regex filtering when verifying Espressif ESP32 WiFi blobs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +78 to +80
help='''Regex pattern to apply to the blob local path.
Only local paths matching this regex will be listed/fetched.
Note that local paths are relative to the module directory''',
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

The help text states "Only local paths matching this regex will be listed/fetched" but according to the PR title and description, the --allow-regex filter should also work with west blobs clean. Update the help text to include "cleaned":

help='''Regex pattern to apply to the blob local path.
        Only local paths matching this regex will be listed/fetched/cleaned.
        Note that local paths are relative to the module directory''',

Additionally, the clean() function (lines 218-225) needs to be updated to actually apply this filter, similar to how list() and fetch() functions do (see lines 120-125 and 176-181 in the full file).

Copilot uses AI. Check for mistakes.

if(CONFIG_DT_HAS_ESPRESSIF_ESP32_WIFI_ENABLED)
zephyr_blobs_verify(MODULE hal_espressif REQUIRED)
message(WARNING "Verifying presence of Espressif ESP32 Wi-Fi binary blobs.")
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

[nitpick] This warning message appears to be informational rather than indicating a problem. Consider using message(STATUS ...) instead of message(WARNING ...) for informational messages, or remove this message entirely since the verification errors/warnings will be displayed by zephyr_blobs_verify() if there are actual issues.

Suggested change
message(WARNING "Verifying presence of Espressif ESP32 Wi-Fi binary blobs.")
message(STATUS "Verifying presence of Espressif ESP32 Wi-Fi binary blobs.")

Copilot uses AI. Check for mistakes.
Comment on lines +1841 to +1844
# if REGEX is specified, add --allow-regex to the west command
if(BLOBS_VERIFY_REGEX)
list(APPEND west_args --allow-regex ${BLOBS_VERIFY_REGEX})
endif()
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The REGEX parameter only makes sense when MODULE is specified, not when FILES is used. When FILES is specified, the function verifies specific file paths, so a regex filter on blob paths doesn't add value. Consider adding validation:

if(BLOBS_VERIFY_REGEX AND DEFINED BLOBS_VERIFY_FILES)
  message(WARNING "REGEX parameter is ignored when FILES is specified in ${CMAKE_CURRENT_FUNCTION}")
endif()

Copilot uses AI. Check for mistakes.
@noahp noahp marked this pull request as draft November 17, 2025 17:30
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants