* [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs
@ 2026-04-05 18:56 Fiona Klute via buildroot
2026-04-24 18:27 ` Fiona Klute via buildroot
2026-10-11 13:38 ` Arnout Vandecappelle via buildroot
0 siblings, 2 replies; 6+ messages in thread
From: Fiona Klute via buildroot @ 2026-04-05 18:56 UTC (permalink / raw)
To: buildroot; +Cc: Yann E . MORIN, Brandon Maier, Ricardo Martincoski, Fiona Klute
The BR2_EXTERNAL environment variable is passed into the container,
and each path listed in it mounted. This allows using external trees
when running a build using utils/docker-run. Testing the existence of
the variable instead of a non-empty value allows passing an empty
BR2_EXTERNAL variable to disable currently set external trees.
Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
---
Changes v4 -> v5:
* Avoid Bashism in "does BR2_EXTERNAL variable exist" check, suggested
by Yann E. Morin.
* Make relative paths in BR2_EXTERNAL absolute for container bind
mounts.
Changes v3 -> v4:
* Split BR2_EXTERNAL on spaces OR colons
* Revert changes to mountpoints processing loop
Changes v2 -> v3:
* Use read to make the loop that creates mount options more robust,
removing pre-exisiting shellcheck override. Suggested by Brandon
Maier.
Changes v1 -> v2:
* Correctly handle spaces in external tree paths
utils/docker-run | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/utils/docker-run b/utils/docker-run
index 27c169db72..37f6c12c0d 100755
--- a/utils/docker-run
+++ b/utils/docker-run
@@ -97,6 +97,17 @@ if [ "${BR2_DL_DIR}" ]; then
docker_opts+=( --env BR2_DL_DIR )
fi
+# Testing the existence of the variable instead of a non-empty value
+# allows passing an empty BR2_EXTERNAL variable to disable currently
+# set external trees.
+if [ "${BR2_EXTERNAL+set}" ]; then
+ docker_opts+=( --env BR2_EXTERNAL )
+ for br2_ext in ${BR2_EXTERNAL//:/ }; do
+ # bind volume source paths must be absolute
+ mountpoints+=( "$(realpath "$br2_ext")" )
+ done
+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}" )
--
2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs
2026-04-05 18:56 [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs Fiona Klute via buildroot
@ 2026-04-24 18:27 ` Fiona Klute via buildroot
2026-10-11 13:38 ` Arnout Vandecappelle via buildroot
1 sibling, 0 replies; 6+ messages in thread
From: Fiona Klute via buildroot @ 2026-04-24 18:27 UTC (permalink / raw)
To: buildroot; +Cc: Yann E . MORIN, Brandon Maier, Ricardo Martincoski
Am 05.04.26 um 20:56 schrieb Fiona Klute:
> The BR2_EXTERNAL environment variable is passed into the container,
> and each path listed in it mounted. This allows using external trees
> when running a build using utils/docker-run. Testing the existence of
> the variable instead of a non-empty value allows passing an empty
> BR2_EXTERNAL variable to disable currently set external trees.
>
> Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Gentle ping about this. Would be nice if it could be merged before
reaching 2 years since v1. ;-)
Best regards,
Fiona
> ---
> Changes v4 -> v5:
> * Avoid Bashism in "does BR2_EXTERNAL variable exist" check, suggested
> by Yann E. Morin.
> * Make relative paths in BR2_EXTERNAL absolute for container bind
> mounts.
>
> Changes v3 -> v4:
> * Split BR2_EXTERNAL on spaces OR colons
> * Revert changes to mountpoints processing loop
>
> Changes v2 -> v3:
> * Use read to make the loop that creates mount options more robust,
> removing pre-exisiting shellcheck override. Suggested by Brandon
> Maier.
>
> Changes v1 -> v2:
> * Correctly handle spaces in external tree paths
>
> utils/docker-run | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/utils/docker-run b/utils/docker-run
> index 27c169db72..37f6c12c0d 100755
> --- a/utils/docker-run
> +++ b/utils/docker-run
> @@ -97,6 +97,17 @@ if [ "${BR2_DL_DIR}" ]; then
> docker_opts+=( --env BR2_DL_DIR )
> fi
>
> +# Testing the existence of the variable instead of a non-empty value
> +# allows passing an empty BR2_EXTERNAL variable to disable currently
> +# set external trees.
> +if [ "${BR2_EXTERNAL+set}" ]; then
> + docker_opts+=( --env BR2_EXTERNAL )
> + for br2_ext in ${BR2_EXTERNAL//:/ }; do
> + # bind volume source paths must be absolute
> + mountpoints+=( "$(realpath "$br2_ext")" )
> + done
> +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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs
2026-04-05 18:56 [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs Fiona Klute via buildroot
2026-04-24 18:27 ` Fiona Klute via buildroot
@ 2026-10-11 13:38 ` Arnout Vandecappelle via buildroot
2026-10-11 15:52 ` Peter Korsgaard
1 sibling, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2026-10-11 13:38 UTC (permalink / raw)
To: buildroot, Fiona Klute
Cc: Arnout Vandecappelle, Yann E . MORIN, Brandon Maier,
Ricardo Martincoski
On Sun, 05 Apr 2026 20:56:08 +0200, Fiona Klute via buildroot wrote:
> The BR2_EXTERNAL environment variable is passed into the container,
> and each path listed in it mounted. This allows using external trees
> when running a build using utils/docker-run. Testing the existence of
> the variable instead of a non-empty value allows passing an empty
> BR2_EXTERNAL variable to disable currently set external trees.
>
> Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Applied to master, thanks!
We didn't quite reach the "within two years since v1" deadline :-)
> ---
> Changes v4 -> v5:
> * Avoid Bashism in "does BR2_EXTERNAL variable exist" check, suggested
> by Yann E. Morin.
> * Make relative paths in BR2_EXTERNAL absolute for container bind
> mounts.
>
> Changes v3 -> v4:
> * Split BR2_EXTERNAL on spaces OR colons
> * Revert changes to mountpoints processing loop
>
> Changes v2 -> v3:
> * Use read to make the loop that creates mount options more robust,
> removing pre-exisiting shellcheck override. Suggested by Brandon
> Maier.
>
> Changes v1 -> v2:
> * Correctly handle spaces in external tree paths
>
> utils/docker-run | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/utils/docker-run b/utils/docker-run
> index 27c169db72..37f6c12c0d 100755
> --- a/utils/docker-run
> +++ b/utils/docker-run
> @@ -97,6 +97,17 @@ if [ "${BR2_DL_DIR}" ]; then
> docker_opts+=( --env BR2_DL_DIR )
> fi
>
> +# Testing the existence of the variable instead of a non-empty value
> +# allows passing an empty BR2_EXTERNAL variable to disable currently
> +# set external trees.
> +if [ "${BR2_EXTERNAL+set}" ]; then
> + docker_opts+=( --env BR2_EXTERNAL )
> + for br2_ext in ${BR2_EXTERNAL//:/ }; do
> + # bind volume source paths must be absolute
> + mountpoints+=( "$(realpath "$br2_ext")" )
realpath also resolves symlinks, which we _don't_ want.
ln -s $PWD /tmp/brx
BR2_EXTERNAL=/tmp/brx utils/docker-run ls -l /tmp/brx
ls: cannot access '/tmp/brx': No such file or directory
We should use the same as br2-external itself: $(cd $br2_ext; pwd)
Regards,
Arnout
> + done
> +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}" )
> --
> 2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs
2026-10-11 13:38 ` Arnout Vandecappelle via buildroot
@ 2026-10-11 15:52 ` Peter Korsgaard
2026-10-11 17:15 ` Yann E. MORIN via buildroot
0 siblings, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2026-10-11 15:52 UTC (permalink / raw)
To: Arnout Vandecappelle via buildroot
Cc: Fiona Klute, Arnout Vandecappelle, Yann E . MORIN, Brandon Maier,
Ricardo Martincoski
>>>>> "Arnout" == Arnout Vandecappelle via buildroot <buildroot@buildroot.org> writes:
Hi,
> Applied to master, thanks!
> We didn't quite reach the "within two years since v1" deadline :-)
;)
>> + for br2_ext in ${BR2_EXTERNAL//:/ }; do
NIT: ${var//} is also a bashism. I guess we could use tr:
for br2_ext in $(echo "${BR2_EXTERNAL} | tr ':' ' '); do
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs
2026-10-11 15:52 ` Peter Korsgaard
@ 2026-10-11 17:15 ` Yann E. MORIN via buildroot
2026-10-11 19:40 ` Peter Korsgaard
0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN via buildroot @ 2026-10-11 17:15 UTC (permalink / raw)
To: Peter Korsgaard
Cc: Arnout Vandecappelle via buildroot, Fiona Klute,
Arnout Vandecappelle, Brandon Maier, Ricardo Martincoski
Peter, All,
On 2026-10-11 17:52 +0200, Peter Korsgaard spake thusly:
> >>>>> "Arnout" == Arnout Vandecappelle via buildroot <buildroot@buildroot.org> writes:
> >> + for br2_ext in ${BR2_EXTERNAL//:/ }; do
> NIT: ${var//} is also a bashism.
This script is a bash script: #!/usr/bin/env bash
It also already uses bashims, like indexed arrays for the 'docker_opts'
and 'mountpoints' variables.
So, it is fine to use ${foo//} too, I believe...
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs
2026-10-11 17:15 ` Yann E. MORIN via buildroot
@ 2026-10-11 19:40 ` Peter Korsgaard
0 siblings, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2026-10-11 19:40 UTC (permalink / raw)
To: Yann E. MORIN
Cc: Arnout Vandecappelle via buildroot, Fiona Klute,
Arnout Vandecappelle, Brandon Maier, Ricardo Martincoski
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> Peter, All,
> On 2026-10-11 17:52 +0200, Peter Korsgaard spake thusly:
>> >>>>> "Arnout" == Arnout Vandecappelle via buildroot <buildroot@buildroot.org> writes:
>> >> + for br2_ext in ${BR2_EXTERNAL//:/ }; do
>> NIT: ${var//} is also a bashism.
> This script is a bash script: #!/usr/bin/env bash
Ups yes, I just saw a mention in the changelog about cleaning up
bashisms - Just ignore it then.
> It also already uses bashims, like indexed arrays for the 'docker_opts'
> and 'mountpoints' variables.
> So, it is fine to use ${foo//} too, I believe...
Indeed.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-11 19:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-05 18:56 [Buildroot] [PATCH v5 1/1] utils/docker-run: mount and pass BR2_EXTERNAL dirs Fiona Klute via buildroot
2026-04-24 18:27 ` Fiona Klute via buildroot
2026-10-11 13:38 ` Arnout Vandecappelle via buildroot
2026-10-11 15:52 ` Peter Korsgaard
2026-10-11 17:15 ` Yann E. MORIN via buildroot
2026-10-11 19:40 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox