diff mbox series

[AUH,v2,3/9] upgrade-helper.py: allow to set the git directory from layer-dir

Message ID 20260424114603.2444938-4-daniel.turull@ericsson.com
State New
Headers show
Series upgrade_helper: scarthgap compatibility, stable updates and changelog extraction | expand

Commit Message

Daniel Turull April 24, 2026, 11:45 a.m. UTC
From: Daniel Turull <daniel.turull@ericsson.com>

Replace the assumption that the poky directory is the first PATH entry
and reuse --layer-dir to setup directory for git repo.

This is useful when not using poky and each meta-layer is its own git.
Without this fix, commit_changes fails in non-poky layouts:

  git add .../openembedded-core/meta/recipes-support/gnupg
  fatal: '.../openembedded-core/meta/recipes-support/gnupg'
  is outside repository at '.../yocto-scarthgap'

Assisted-by: Claude, Anthropic
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
---
 upgrade-helper.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Alexander Kanavin April 27, 2026, 9:51 a.m. UTC | #1
On Fri, 24 Apr 2026 at 13:46, <daniel.turull@ericsson.com> wrote:

>              self.git = Git(self.opts['layer_dir'])
> +        elif settings.get('layer_dir'):
> +            # allow to set the git repo directory without enabling layer_mode
> +            self.git = Git(settings.get('layer_dir'))
>          else:
>              # use scripts_path to get oe-core directory
>              self.git = Git(os.path.dirname(scripts_path))

I don't understand. scripts_path is set thusly:

scripts_path = os.path.realpath(os.path.abspath(os.path.dirname(shutil.which("devtool"))))

What is the layer layout that causes the 'wrong' path to be picked by
this? Either you use integrated poky repo without oe-core, or you use
oe-core without integrated poky, but you shouldn't be using both.

Alex

On Fri, 24 Apr 2026 at 13:46, <daniel.turull@ericsson.com> wrote:
>
> From: Daniel Turull <daniel.turull@ericsson.com>
>
> Replace the assumption that the poky directory is the first PATH entry
> and reuse --layer-dir to setup directory for git repo.
>
> This is useful when not using poky and each meta-layer is its own git.
> Without this fix, commit_changes fails in non-poky layouts:
>
>   git add .../openembedded-core/meta/recipes-support/gnupg
>   fatal: '.../openembedded-core/meta/recipes-support/gnupg'
>   is outside repository at '.../yocto-scarthgap'
>
> Assisted-by: Claude, Anthropic
> Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
> ---
>  upgrade-helper.py | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/upgrade-helper.py b/upgrade-helper.py
> index 98391f3..df927d1 100755
> --- a/upgrade-helper.py
> +++ b/upgrade-helper.py
> @@ -184,6 +184,9 @@ class Updater(object):
>                      _layer_settings_error(s)
>
>              self.git = Git(self.opts['layer_dir'])
> +        elif settings.get('layer_dir'):
> +            # allow to set the git repo directory without enabling layer_mode
> +            self.git = Git(settings.get('layer_dir'))
>          else:
>              # use scripts_path to get oe-core directory
>              self.git = Git(os.path.dirname(scripts_path))
> --
> 2.34.1
>
Daniel Turull April 27, 2026, 12:30 p.m. UTC | #2
Hi Alex,

I went back and checked. scripts_path already uses os.path.realpath, which resolves symlinks correctly. I reverted the patch and I cannot reproduce it.

My layout uses standalone oe-core with symlinks:

  yocto-scarthgap/
-  scripts -> openembedded-core/scripts/
-  oe-init-build-env -> openembedded-core/oe-init-build-env
- openembedded-core/          (git repo)
- meta-openembedded/        (git repo)

The error I described in the commit message must have been caused by something else in my environment at the time. I'll drop this patch in v3.

Thanks,
Daniel

> -----Original Message-----
> From: Alexander Kanavin <alex.kanavin@gmail.com>
> Sent: Monday, 27 April 2026 11:52
> To: Daniel Turull <daniel.turull@ericsson.com>
> Cc: yocto-patches@lists.yoctoproject.org; paul@pbarker.dev;
> ross.burton@arm.com; yoann.congal@smile.fr
> Subject: Re: [AUH][PATCH v2 3/9] upgrade-helper.py: allow to set the git
> directory from layer-dir
> 
> On Fri, 24 Apr 2026 at 13:46, <daniel.turull@ericsson.com> wrote:
> 
> >              self.git = Git(self.opts['layer_dir'])
> > +        elif settings.get('layer_dir'):
> > +            # allow to set the git repo directory without enabling layer_mode
> > +            self.git = Git(settings.get('layer_dir'))
> >          else:
> >              # use scripts_path to get oe-core directory
> >              self.git = Git(os.path.dirname(scripts_path))
> 
> I don't understand. scripts_path is set thusly:
> 
> scripts_path =
> os.path.realpath(os.path.abspath(os.path.dirname(shutil.which("devtool"))))
> 
> What is the layer layout that causes the 'wrong' path to be picked by this?
> Either you use integrated poky repo without oe-core, or you use oe-core
> without integrated poky, but you shouldn't be using both.
> 
> Alex
> 
> On Fri, 24 Apr 2026 at 13:46, <daniel.turull@ericsson.com> wrote:
> >
> > From: Daniel Turull <daniel.turull@ericsson.com>
> >
> > Replace the assumption that the poky directory is the first PATH entry
> > and reuse --layer-dir to setup directory for git repo.
> >
> > This is useful when not using poky and each meta-layer is its own git.
> > Without this fix, commit_changes fails in non-poky layouts:
> >
> >   git add .../openembedded-core/meta/recipes-support/gnupg
> >   fatal: '.../openembedded-core/meta/recipes-support/gnupg'
> >   is outside repository at '.../yocto-scarthgap'
> >
> > Assisted-by: Claude, Anthropic
> > Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
> > ---
> >  upgrade-helper.py | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/upgrade-helper.py b/upgrade-helper.py index
> > 98391f3..df927d1 100755
> > --- a/upgrade-helper.py
> > +++ b/upgrade-helper.py
> > @@ -184,6 +184,9 @@ class Updater(object):
> >                      _layer_settings_error(s)
> >
> >              self.git = Git(self.opts['layer_dir'])
> > +        elif settings.get('layer_dir'):
> > +            # allow to set the git repo directory without enabling layer_mode
> > +            self.git = Git(settings.get('layer_dir'))
> >          else:
> >              # use scripts_path to get oe-core directory
> >              self.git = Git(os.path.dirname(scripts_path))
> > --
> > 2.34.1
> >
diff mbox series

Patch

diff --git a/upgrade-helper.py b/upgrade-helper.py
index 98391f3..df927d1 100755
--- a/upgrade-helper.py
+++ b/upgrade-helper.py
@@ -184,6 +184,9 @@  class Updater(object):
                     _layer_settings_error(s)
 
             self.git = Git(self.opts['layer_dir'])
+        elif settings.get('layer_dir'):
+            # allow to set the git repo directory without enabling layer_mode
+            self.git = Git(settings.get('layer_dir'))
         else:
             # use scripts_path to get oe-core directory
             self.git = Git(os.path.dirname(scripts_path))