Re: [AUH][PATCH v2 7/9] upgrade-helper.py: Add prebuild option

Alexander Kanavin <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <CANNYZj_e0Ms7DhyaxUT2Jx_ijkarVGSzuHW+NPpf1Q2ikPCOoQ@mail.gmail.com>
There's already a buildhistory option which does such a pre-build and
size comparison? Perhaps you can extend buildhistory with hooks into
additional external checks?

Alex

On Fri, 24 Apr 2026 at 13:46, <[email protected]> wrote:
>
> From: Daniel Turull <[email protected]>
>
> Add --prebuild option to build each recipe at its current version before
> attempting the upgrade. This allows verifying that recipes build before
> applying the upgrade and enables comparing binaries produced before and
> after, for example for build size or ABI compatibility checks.
>
> Recipes that fail the pre-build are skipped and recorded as failures.
>
> Assisted-by: Claude, Anthropic
> Signed-off-by: Daniel Turull <[email protected]>
> ---
>  upgrade-helper.py | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/upgrade-helper.py b/upgrade-helper.py
> index ffa7449..11a97d2 100755
> --- a/upgrade-helper.py
> +++ b/upgrade-helper.py
> @@ -105,6 +105,9 @@ def parse_cmdline():
>      parser.add_argument("--minor", action="store_true", default=False,
>                          help="allow upgrades within the same major version (e.g. 3.5.2 -> 3.6.0, 3.99.0)")
>
> +    parser.add_argument("--prebuild", action="store_true", default=False,
> +                        help="build each recipe at its current version before attempting upgrade")
> +
>      parser.add_argument("-d", "--debug-level", type=int, default=4, choices=range(1, 6),
>                          help="set the debug level: CRITICAL=1, ERROR=2, WARNING=3, INFO=4, DEBUG=5")
>      parser.add_argument("-e", "--send-emails", action="store_true", default=False,
> @@ -516,6 +519,21 @@ class Updater(object):
>              attempted_pkggroups += 1
>              pkggroup_name = g["name"]
>              I(" ATTEMPT PACKAGE GROUP %d/%d" % (attempted_pkggroups, total_pkggroups))
> +
> +            # Build current version first to verify it builds and seed ABI reference
> +            if self.args.prebuild and not self.args.skip_compilation:
> +                I(" %s: Pre-building current version ..." % pkggroup_name)
> +                try:
> +                    for machine in self.opts['machines']:
> +                        self.bb.complete(" ".join([p['PN'] for p in g['pkgs']]), machine)
> +                except Exception as e:
> +                    E(" %s: Pre-build FAILED, skipping upgrade" % pkggroup_name)
> +                    if isinstance(e, Error):
> +                        E(e.stdout + e.stderr)
> +                    g['error'] = e if isinstance(e, Error) else Error(message=str(e))
> +                    failed_pkggroups_ctx.append(g)
> +                    continue
> +
>              try:
>                  for pkg_ctx in g['pkgs']:
>                      I(" %s: Upgrading to %s" % (pkg_ctx['PN'], pkg_ctx['NPV']))
> @@ -571,6 +589,8 @@ class Updater(object):
>              tim.run()
>
>          for g in pkggroups_ctx:
> +            if 'workdir' not in g:
> +                continue
>
>              if g in succeeded_pkggroups_ctx:
>                  os.symlink(g['workdir'], os.path.join( \
> --
> 2.34.1
>
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.