utils/docker-run: Support BR2_EXTERNAL with relative paths
PATCH 1/1 utils/docker-run: Support BR2_EXTERNAL with relative paths
The docker-run script did not handle the BR2_EXTERNAL environment variable, preventing use of external trees in Docker builds.
Add support by converting relative paths to absolute, mounting the directory into the container, and passing the variable to the Docker environment.
--- utils/docker-run | 6 ++++++ 1 file changed, 6 insertions(+)
utils/docker-run +6 -0
@@ -97,6 +97,12 @@ if [ "${BR2_DL_DIR}" ]; then docker_opts+=( --env BR2_DL_DIR ) fi +if [ "${BR2_EXTERNAL}" ]; then + BR2_EXTERNAL_DIR="$(cd "${MAIN_DIR}"; readlink -e "${BR2_EXTERNAL}")" + mountpoints+=( "${BR2_EXTERNAL_DIR}" ) + docker_opts+=( --env BR2_EXTERNAL ) +fi + # shellcheck disable=SC2013 # can't use while-read because of the assignment for dir in $(printf '%s\n' "${mountpoints[@]}" |LC_ALL=C sort -u); do docker_opts+=( --mount "type=bind,src=${dir},dst=${dir}" )
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Am 15.06.26 um 14:39 schrieb Kory Maincent via buildroot:
Quoted 5 lines
The docker-run script did not handle the
BR2_EXTERNALenvironment variable, preventing use of external trees in Docker builds.Add support by converting relative paths to absolute, mounting the directory into the container, and passing the variable to the Docker environment.
I've sent a patch a while ago that does pretty much the same thing, and handles the possibilities of multiple external trees (space separated list, or legacy colon separated) and empty BR2_EXTERNAL (to disable any configured external trees):
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Could you test that one?
Best regards,
Fiona
Quoted 12 lines
Signed-off-by Kory Maincent <[email protected]>--- utils/docker-run | 6 ++++++ 1 file changed, 6 insertions(+)utils/docker-run +0
-0@@ -97,6 +97,12 @@ if [ "${BR2_DL_DIR}" ]; then docker_opts+=( --env BR2_DL_DIR ) fi
utils/docker-run if [ "${BR2_DL_DIR}" ]; then · line 108
Quoted 10 lines
utils/docker-run +6
-0+if [ "${BR2_EXTERNAL}" ]; then + BR2_EXTERNAL_DIR="$(cd "${MAIN_DIR}"; readlink -e "${BR2_EXTERNAL}")" + mountpoints+=( "${BR2_EXTERNAL_DIR}" ) + docker_opts+=( --env BR2_EXTERNAL ) +fi + # shellcheck disable=SC2013 # can't use while-read because of the assignment for dir in $(printf '%s\n' "${mountpoints[@]}" |LC_ALL=C sort -u); do docker_opts+=( --mount "type=bind,src=${dir},dst=${dir}" )
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 7 lines · On Mon, 15 Jun 2026 20:07:09 +0200 Fiona Klute <[email protected]> wrote:
Am 15.06.26 um 14:39 schrieb Kory Maincent via buildroot:
Quoted 5 lines
The docker-run script did not handle the
BR2_EXTERNALenvironment variable, preventing use of external trees in Docker builds.Add support by converting relative paths to absolute, mounting the directory into the container, and passing the variable to the Docker environment.
Quoted 7 lines
I've sent a patch a while ago that does pretty much the same thing, and handles the possibilities of multiple external trees (space separated list, or legacy colon separated) and empty
BR2_EXTERNAL(to disable any configured external trees):
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/Could you test that one?
Oh I have missed your patch.
It works well on my side.
You can add my Reviewed-by.
Small question, why would you want to disable configured external trees?
Regards,
Signature · 7 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 17 lines · On Thu, 18 Jun 2026 18:14:52 +0200 Kory Maincent <[email protected]>…
Quoted 14 lines · On Mon, 15 Jun 2026 20:07:09 +0200 Fiona Klute <[email protected]> wrote:
Am 15.06.26 um 14:39 schrieb Kory Maincent via buildroot:
Quoted 6 lines
The docker-run script did not handle the
BR2_EXTERNALenvironment variable, preventing use of external trees in Docker builds.Add support by converting relative paths to absolute, mounting the directory into the container, and passing the variable to the Docker environment.
I've sent a patch a while ago that does pretty much the same thing, and handles the possibilities of multiple external trees (space separated list, or legacy colon separated) and empty
BR2_EXTERNAL(to disable any configured external trees):
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Quoted 5 lines
Quoted 1 line
Could you test that one?
Oh I have missed your patch.
It works well on my side.
You can add my Reviewed-by.
I meant Tested-by tag.
Quoted 4 lines
Small question, why would you want to disable configured external trees?
Regards,
Signature · 7 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Am 18.06.26 um 18:35 schrieb Kory Maincent:
Quoted 20 lines
Quoted 17 lines · On Thu, 18 Jun 2026 18:14:52 +0200 Kory Maincent <[email protected]>…
Quoted 14 lines · On Mon, 15 Jun 2026 20:07:09 +0200 Fiona Klute <[email protected]> wrote:
Am 15.06.26 um 14:39 schrieb Kory Maincent via buildroot:
Quoted 6 lines
The docker-run script did not handle the
BR2_EXTERNALenvironment variable, preventing use of external trees in Docker builds.Add support by converting relative paths to absolute, mounting the directory into the container, and passing the variable to the Docker environment.
I've sent a patch a while ago that does pretty much the same thing, and handles the possibilities of multiple external trees (space separated list, or legacy colon separated) and empty
BR2_EXTERNAL(to disable any configured external trees):
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Could you test that one?
Oh I have missed your patch.
It works well on my side.
You can add my Reviewed-by.I meant Tested-by tag.
Nice, thank you! :-)
Quoted 1 line
Quoted 1 line
Small question, why would you want to disable configured external trees?
I'm not really sure, I haven't needed it myself. But "set BR2_EXTERNAL to empty to disable any external trees" is a documented option [1], so when I wrote that patch I figured it should work with utils/docker-run, too. ;-)
Best regards,
Fiona
[1] https://nightly.buildroot.org/#outside-br-custom
_______________________________________________
buildroot mailing list [email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot