> -----Original Message-----
> From: openembedded-core@lists.openembedded.org 
> <openembedded-core@lists.openembedded.org> On Behalf Of Julien Stephan
> Sent: den 10 april 2024 09:07
> To: openembedded-core@lists.openembedded.org
> Cc: Julien Stephan <jstep...@baylibre.com>
> Subject: [OE-core] [PATCH v2] devtool: standard: throws appropriate error if 
> source is in detached HEAD
> 
> If source is in detached HEAD, we get the following error when using
> detvool finish command:
> 
>     [...]
>     File "<...>/poky/scripts/lib/devtool/standard.py", line 1938, in 
> _update_recipe
>       bb.process.run('git checkout %s' % startbranch, cwd=srctree)
>     File "<...>/poky/bitbake/lib/bb/process.py", line 189, in run
>       raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
>   bb.process.ExecutionError: Execution of 'git checkout (HEAD detached at 
> 9bbf87e)' failed with exit code 2:
>   /bin/sh: -c: line 1: syntax error near unexpected token `('
>   /bin/sh: -c: line 1: `git checkout (HEAD detached at 9bbf87e)'
> 
> Check this and throws an appropriate error in this case
> 
> Signed-off-by: Julien Stephan <jstep...@baylibre.com>
> 
> ---
> 
> Changes in v2:
> 
> - update error message to avoid confusion with a potentially non
>   existing "main" branch

As you noted in an earlier mail, the same error message is used some 
lines later. Please change that one too.

> ---
>  scripts/lib/devtool/standard.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/scripts/lib/devtool/standard.py
> b/scripts/lib/devtool/standard.py
> index 2c174927ddb..51e5794a0a7 100644
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -1888,6 +1888,8 @@ def _update_recipe(recipename, workspace, rd, mode,
> appendlayerdir, wildcard_ver
>          for line in stdout.splitlines():
>              branchname = line[2:]
>              if line.startswith('* '):
> +                if 'HEAD' in line:
> +                    raise DevtoolError('Detached HEAD - please check out a 
> branch, e.g., "devtool"')
>                  startbranch = branchname
>              if branchname.startswith(override_branch_prefix):
>                  override_branches.append(branchname)
> --
> 2.44.0

//Peter

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#198089): 
https://lists.openembedded.org/g/openembedded-core/message/198089
Mute This Topic: https://lists.openembedded.org/mt/105437662/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to