* [Buildroot] [PATCH] utils/docker-run: make it work in workdirs/woktrees
@ 2023-05-06 21:46 Yann E. MORIN
2023-05-13 10:10 ` Yann E. MORIN
2023-06-13 12:37 ` Peter Korsgaard
0 siblings, 2 replies; 5+ messages in thread
From: Yann E. MORIN @ 2023-05-06 21:46 UTC (permalink / raw)
To: buildroot; +Cc: Yann E. MORIN, Ricardo Martincoski
It is quite customary to use a single repository with multiple workdirs,
one for each active branch, with either the aging 'git new-workdir' or
the more recent 'git worktree'.
However, in a workdir/worktree, most entries in .git/ are only symlinks
to the actual files in the main repository.
Currently, utils/docker-run only bind-mounts the current working copy.
If that is a workdir/worktree, then it is going to be missing the actual
git data, resulting in errors like:
$ ./utils/docker-run make check-package
fatal: not a git repository (or any parent up to mount point [....]/buildroot)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
No files to check style
make: *** [Makefile:1257: check-package] Error 1
So, we also bind-mount the actual git directory. If that is a subdir
of the current working copy, then it is already mounted and thus the
bind-mount is superfluous but harmless; for simplicity, we mount it
unconditionally.
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>
---
utils/docker-run | 3 +++
1 file changed, 3 insertions(+)
diff --git a/utils/docker-run b/utils/docker-run
index 135a1451b6..17c587a484 100755
--- a/utils/docker-run
+++ b/utils/docker-run
@@ -2,6 +2,8 @@
set -o errexit -o pipefail
DIR=$(dirname "${0}")
MAIN_DIR=$(readlink -f "${DIR}/..")
+# GIT_DIR to support workdirs/worktrees
+GIT_DIR="$(dirname "$(realpath "${MAIN_DIR}/.git/config")")"
# shellcheck disable=SC2016
IMAGE=$(grep ^image: "${MAIN_DIR}/.gitlab-ci.yml" | \
sed -e 's,^image: ,,g' | sed -e 's,\$CI_REGISTRY,registry.gitlab.com,g')
@@ -11,6 +13,7 @@ declare -a docker_opts=(
--rm
--user "$(id -u):$(id -g)"
--mount "type=bind,src=${MAIN_DIR},dst=${MAIN_DIR}"
+ --mount "type=bind,src=${GIT_DIR},dst=${GIT_DIR}"
--workdir "${MAIN_DIR}"
)
if tty -s; then
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] utils/docker-run: make it work in workdirs/woktrees
2023-05-06 21:46 [Buildroot] [PATCH] utils/docker-run: make it work in workdirs/woktrees Yann E. MORIN
@ 2023-05-13 10:10 ` Yann E. MORIN
2023-06-13 12:37 ` Peter Korsgaard
1 sibling, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2023-05-13 10:10 UTC (permalink / raw)
To: buildroot; +Cc: Ricardo Martincoski
All,
On 2023-05-06 23:46 +0200, Yann E. MORIN spake thusly:
> It is quite customary to use a single repository with multiple workdirs,
> one for each active branch, with either the aging 'git new-workdir' or
> the more recent 'git worktree'.
>
> However, in a workdir/worktree, most entries in .git/ are only symlinks
> to the actual files in the main repository.
>
> Currently, utils/docker-run only bind-mounts the current working copy.
> If that is a workdir/worktree, then it is going to be missing the actual
> git data, resulting in errors like:
>
> $ ./utils/docker-run make check-package
> fatal: not a git repository (or any parent up to mount point [....]/buildroot)
> Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
> No files to check style
> make: *** [Makefile:1257: check-package] Error 1
>
> So, we also bind-mount the actual git directory. If that is a subdir
> of the current working copy, then it is already mounted and thus the
> bind-mount is superfluous but harmless; for simplicity, we mount it
> unconditionally.
>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> utils/docker-run | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/utils/docker-run b/utils/docker-run
> index 135a1451b6..17c587a484 100755
> --- a/utils/docker-run
> +++ b/utils/docker-run
> @@ -2,6 +2,8 @@
> set -o errexit -o pipefail
> DIR=$(dirname "${0}")
> MAIN_DIR=$(readlink -f "${DIR}/..")
> +# GIT_DIR to support workdirs/worktrees
> +GIT_DIR="$(dirname "$(realpath "${MAIN_DIR}/.git/config")")"
> # shellcheck disable=SC2016
> IMAGE=$(grep ^image: "${MAIN_DIR}/.gitlab-ci.yml" | \
> sed -e 's,^image: ,,g' | sed -e 's,\$CI_REGISTRY,registry.gitlab.com,g')
> @@ -11,6 +13,7 @@ declare -a docker_opts=(
> --rm
> --user "$(id -u):$(id -g)"
> --mount "type=bind,src=${MAIN_DIR},dst=${MAIN_DIR}"
> + --mount "type=bind,src=${GIT_DIR},dst=${GIT_DIR}"
> --workdir "${MAIN_DIR}"
> )
> if tty -s; then
> --
> 2.25.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| 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] 5+ messages in thread
* Re: [Buildroot] [PATCH] utils/docker-run: make it work in workdirs/woktrees
2023-05-06 21:46 [Buildroot] [PATCH] utils/docker-run: make it work in workdirs/woktrees Yann E. MORIN
2023-05-13 10:10 ` Yann E. MORIN
@ 2023-06-13 12:37 ` Peter Korsgaard
2023-06-13 13:33 ` Baruch Siach via buildroot
1 sibling, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2023-06-13 12:37 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: Ricardo Martincoski, buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> It is quite customary to use a single repository with multiple workdirs,
> one for each active branch, with either the aging 'git new-workdir' or
> the more recent 'git worktree'.
> However, in a workdir/worktree, most entries in .git/ are only symlinks
> to the actual files in the main repository.
> Currently, utils/docker-run only bind-mounts the current working copy.
> If that is a workdir/worktree, then it is going to be missing the actual
> git data, resulting in errors like:
> $ ./utils/docker-run make check-package
> fatal: not a git repository (or any parent up to mount point [....]/buildroot)
> Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
> No files to check style
> make: *** [Makefile:1257: check-package] Error 1
> So, we also bind-mount the actual git directory. If that is a subdir
> of the current working copy, then it is already mounted and thus the
> bind-mount is superfluous but harmless; for simplicity, we mount it
> unconditionally.
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>
Committed to 2023.02.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] utils/docker-run: make it work in workdirs/woktrees
2023-06-13 12:37 ` Peter Korsgaard
@ 2023-06-13 13:33 ` Baruch Siach via buildroot
2023-06-13 16:46 ` Peter Korsgaard
0 siblings, 1 reply; 5+ messages in thread
From: Baruch Siach via buildroot @ 2023-06-13 13:33 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: Yann E. MORIN, Ricardo Martincoski, buildroot
Hi Peter,
On Tue, Jun 13 2023, Peter Korsgaard wrote:
>>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>
> > It is quite customary to use a single repository with multiple workdirs,
> > one for each active branch, with either the aging 'git new-workdir' or
> > the more recent 'git worktree'.
>
> > However, in a workdir/worktree, most entries in .git/ are only symlinks
> > to the actual files in the main repository.
>
> > Currently, utils/docker-run only bind-mounts the current working copy.
> > If that is a workdir/worktree, then it is going to be missing the actual
> > git data, resulting in errors like:
>
> > $ ./utils/docker-run make check-package
> > fatal: not a git repository (or any parent up to mount point [....]/buildroot)
> > Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
> > No files to check style
> > make: *** [Makefile:1257: check-package] Error 1
>
> > So, we also bind-mount the actual git directory. If that is a subdir
> > of the current working copy, then it is already mounted and thus the
> > bind-mount is superfluous but harmless; for simplicity, we mount it
> > unconditionally.
>
> > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> > Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>
>
> Committed to 2023.02.x, thanks.
Not in 2023.02.x branch as of commit bcddc639d.
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] utils/docker-run: make it work in workdirs/woktrees
2023-06-13 13:33 ` Baruch Siach via buildroot
@ 2023-06-13 16:46 ` Peter Korsgaard
0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2023-06-13 16:46 UTC (permalink / raw)
To: Baruch Siach; +Cc: Yann E. MORIN, Ricardo Martincoski, buildroot
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
> Hi Peter,
> On Tue, Jun 13 2023, Peter Korsgaard wrote:
>>>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>>
>> > It is quite customary to use a single repository with multiple workdirs,
>> > one for each active branch, with either the aging 'git new-workdir' or
>> > the more recent 'git worktree'.
>>
>> > However, in a workdir/worktree, most entries in .git/ are only symlinks
>> > to the actual files in the main repository.
>>
>> > Currently, utils/docker-run only bind-mounts the current working copy.
>> > If that is a workdir/worktree, then it is going to be missing the actual
>> > git data, resulting in errors like:
>>
>> > $ ./utils/docker-run make check-package
>> > fatal: not a git repository (or any parent up to mount point [....]/buildroot)
>> > Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
>> > No files to check style
>> > make: *** [Makefile:1257: check-package] Error 1
>>
>> > So, we also bind-mount the actual git directory. If that is a subdir
>> > of the current working copy, then it is already mounted and thus the
>> > bind-mount is superfluous but harmless; for simplicity, we mount it
>> > unconditionally.
>>
>> > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
>> > Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>
>>
>> Committed to 2023.02.x, thanks.
> Not in 2023.02.x branch as of commit bcddc639d.
Ups, fixed now - Thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-13 16:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-06 21:46 [Buildroot] [PATCH] utils/docker-run: make it work in workdirs/woktrees Yann E. MORIN
2023-05-13 10:10 ` Yann E. MORIN
2023-06-13 12:37 ` Peter Korsgaard
2023-06-13 13:33 ` Baruch Siach via buildroot
2023-06-13 16:46 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox