RE: [AUH][PATCH v2 1/9] upgrade-helper.py: Add compatibility with Yocto scarthgap

Daniel Turull <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <PA3PR07MB1072177B916F8ECCD039083448A362@PA3PR07MB10721.eurprd07.prod.outlook.com>
> -----Original Message-----
> From: Alexander Kanavin <[email protected]>
> Sent: Monday, 27 April 2026 13:02
> To: Daniel Turull <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [AUH][PATCH v2 1/9] upgrade-helper.py: Add compatibility with
> Yocto scarthgap
> 
> On Fri, 24 Apr 2026 at 13:46, <[email protected]> wrote:
> > -        pkg_ctx['recipe_dir'] = os.path.dirname(pkg_ctx['env']['FILE'])
> > +        pkg_ctx['recipe_dir'] =
> > + os.path.realpath(os.path.dirname(pkg_ctx['env']['FILE']))
> 
> This needs to be further explained.

In our layout, meta is a symlink (meta -> openembedded-core/meta), so pkg_ctx['env']['FILE'] returns a path through the symlink. Later, git add on that path fails because the git repo is at the resolved openembedded-core/ path. I'll expand the commit message to explain this.
> 
> > -        bb.process.run("bitbake-config-build enable-fragment
> machine/{}".format(machine))
> > -        return self._cmd(recipe, env_var=env)
> > +        try:
> > +            bb.process.run("bitbake-config-build enable-fragment
> machine/{}".format(machine))
> > +        except bb.process.ExecutionError:
> > +            # bitbake-config-build not available (e.g. scarthgap), use MACHINE
> env var
> > +            env = "MACHINE={} {}".format(machine, env).strip()
> > +        return self._cmd(recipe, env_var=env if env else None)
> 
> The condition needs to be 'bitbake-config-build doesn't exist', not that it
> failed to execute (e.g. returned a non-zero).

I'll change it to check shutil.which('bitbake-config-build') instead of catching ExecutionError.

> 
> >              for group in pkggroups:
> > +
> > +                # Scarthgap returns flat tuples; normalize to list-of-dicts
> > +                # so the existing loop handles both formats.
> > +                if not isinstance(group, (list, tuple)) or not group or not
> isinstance(group[0], dict):
> > +                    pn, status, cur_ver, next_ver, maintainer, revision,
> no_upgrade_reason = group
> > +                    group = [{'pn': pn, 'status': status, 'cur_ver': cur_ver,
> > +                              'next_ver': next_ver, 'maintainer': maintainer,
> > +                              'revision': revision,
> > + 'no_upgrade_reason': no_upgrade_reason}]
> 
> Can the condition be inverted, e.g. be checked for the 'old' format?
> I'm not sure I understand why 'old' format is determined by any of three
> different conditions being true, especially 'not group' looks incorrect.

Sure, Scarthgap's _get_recipe_upgrade_status returns a flat tuple of 7 elements, while master returns a list of dicts. I'll simplify it.
> 
> Alex

Thanks for the feedback. I'll updated in v3

Daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.