Skip to content

Use $(python) built-in in Kconfig#153

Merged
jserv merged 1 commit intomainfrom
portable-kconfig
Mar 1, 2026
Merged

Use $(python) built-in in Kconfig#153
jserv merged 1 commit intomainfrom
portable-kconfig

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Mar 1, 2026

This replaces 'tools/kconfig' git submodule with shallow on-demand clone triggered by 'make defconfig' or 'make config'. Add 'make distclean' to remove the cloned Kconfiglib along with build artifacts.

It converts all boolean $(shell,...) checks in configs/Kconfig to the portable $(python,...) preprocessor function, which evaluates Python code in-process without spawning a shell. This eliminates shell-specific idioms (2>/dev/null, && echo y || echo n, test -n) and the shell injection vector from environment variables.

COMPILER_TYPE retains $(shell,...) since $(python,...) only returns y/n and cannot produce string output.


Summary by cubic

Switch Kconfig to the built-in $(python) function for boolean checks and fetch Kconfiglib via an on-demand shallow clone. This removes shell-specific logic, improves portability, and reduces risk from env-based shell injection; adds distclean for cleanup.

  • Refactors

    • Replace boolean $(shell,...) in configs/Kconfig with $(python,...) that runs Python in-process and returns y/n.
    • Keep COMPILER_TYPE on $(shell,...) since it requires string output.
  • Dependencies

    • Remove tools/kconfig submodule; clone Kconfiglib on demand during make config/defconfig (depth=1). Add make distclean to delete the clone.
    • Update CI to stop checking out submodules and ignore tools/kconfig in .gitignore.

Written for commit 0a06e45. Summary will update on new commits.

This replaces 'tools/kconfig' git submodule with shallow on-demand clone
triggered by 'make defconfig' or 'make config'. Add 'make distclean' to
remove the cloned Kconfiglib along with build artifacts.

It converts all boolean $(shell,...) checks in configs/Kconfig to the
portable $(python,...) preprocessor function, which evaluates Python
code in-process without spawning a shell. This eliminates shell-specific
idioms (2>/dev/null, && echo y || echo n, test -n) and the shell
injection vector from environment variables.

COMPILER_TYPE retains $(shell,...) since $(python,...) only returns y/n
and cannot produce string output.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

@jserv jserv merged commit ec31787 into main Mar 1, 2026
9 checks passed
@jserv jserv deleted the portable-kconfig branch March 1, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant