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

Alexander Kanavin <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <CANNYZj9GSyEOPhJW7vV9kXo5atKDquFE-zXdiKNQAEDMa686fA@mail.gmail.com>
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.

> -        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).

>              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.

Alex
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.