upgrade_helper: scarthgap compatibility and stable updates
v3 cover upgrade_helper: scarthgap compatibility and stable updates
From: Daniel Turull <[email protected]>
This patch series allow to run upgrade-helper both in master and scarthgap.
This allows to be able to automatically generate patches for updating patched or minor versions, which can help on the security work fixing vulnerabilities.
When --stable is used, AUH restricts upgrades to patch-level by default. Per-recipe policy can be overridden via AUH_UPGRADE_POLICY, which can be set in a configuration file (e.g. local.conf) for testing across LTS branches without modifying recipes:
AUH_UPGRADE_POLICY:pn-curl = "minor"
or directly in the recipe file for upstream inclusion:
AUH_UPGRADE_POLICY = "minor"
Supported values: "patch" (default), "minor", "none"
Daniel Turull (4):
steps.py: resolve symlinks in recipe_dir upgrade-helper.py: Add compatibility with Yocto scarthgap upgrade-helper.py: Add stable option for patch-only upgrades upgrade-helper.py: Add resume option to skip already attempted recipes
Tested with on openembedded-core with latest scarthgap version (2026-04-07) ../auto-upgrade-helper/upgrade-helper.py all --stable
TOTAL: attempted=135 succeeded=81(60.00%) failed=54(40.00%)
[1] https://github.com/Nordix/meta-binaryaudit
[2] https://git.openembedded.org/openembedded-core-contrib/log/?h=dturull/scarthgap-auh
Changes in v2:
- Split scarthgap compat into two commits: compatibility and fetch error handling
- Split --stable into its own commit (was squashed into changelog)
- Reorder commits so each feature is independently functional
Changes in v3:
- Drop layer-dir, scan_workers, changelog, prebuild, and fetch-error patches as per Alex Kanavin feedback (changelog to be integrated into devtool; prebuild covered by buildhistory; fetch error to be fixed in oe-core's get_recipe_upgrade_status)
- Drop --minor as separate flag; replace with per-recipe AUH_UPGRADE_POLICY variable (patch/minor/none) read from tinfoil
- Add steps.py symlink fix (new patch, split from scarthgap compat)
- Rework scarthgap compat: use shutil.which for bitbake-config-build fallback with D() logging, add tuple length assertion, fix env string bug (MACHINE=foo None when TCLIBC unset)
- Rework --stable: use bb.fetch2.Fetch public API (not FetchData), fix is_patch_update off-by-one length guard, fix _get_git_versions break-on-blank-line dropping remaining tags, optimize quick-path to skip tinfoil for recipes already at patch version
- Rework --resume: use succeed/failed symlinks created immediately (not at end of run) as Alex suggested, use name-based comparison instead of object identity for symlink classification, add no-previous-run warning
- Series reduced from 9 to 4 patches
Daniel Turull (4):
steps.py: resolve symlinks in recipe_dir upgrade-helper.py: Add compatibility with Yocto scarthgap upgrade-helper.py: Add stable option for patch-only upgrades upgrade-helper.py: Add resume option to skip already attempted recipes
modules/steps.py | 2 +- modules/utils/bitbake.py | 11 ++- modules/utils/version.py | 185 +++++++++++++++++++++++++++++++++++++++ upgrade-helper.py | 162 ++++++++++++++++++++++++++++++++-- 4 files changed, 348 insertions(+), 12 deletions(-) create mode 100644 modules/utils/version.py
Signature · 1 line
2.34.1
PATCH v3 1/4 steps.py: resolve symlinks in recipe_dir
From: Daniel Turull <[email protected]>
Use os.path.realpath() on recipe_dir so that git operations work when bblayers.conf references layers through symlinks (e.g. meta -> openembedded-core/meta). Without this, git add fails because the symlinked path is outside the git repo.
--- modules/steps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
modules/steps.py +1 -1
@@ -36,7 +36,7 @@ def load_env(devtool, bb, git, opts, group): os.mkdir(group['workdir']) for pkg_ctx in group['pkgs']: pkg_ctx['env'] = bb.env(pkg_ctx['PN']) - 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'])) def buildhistory_init(devtool, bb, git, opts, group): if not opts['buildhistory']:
Signature · 1 line
2.34.1
Re: [AUH][PATCH v3 1/4] steps.py: resolve symlinks in recipe_dir
Thanks, this has been applied.
Alex
Quoted 30 lines · On Mon, 4 May 2026 at 08:36, <[email protected]> wrote:
From: Daniel Turull <[email protected]>
Use
os.path.realpath()onrecipe_dirso that git operations work when bblayers.conf references layers through symlinks (e.g. meta -> openembedded-core/meta). Without this, git add fails because the symlinked path is outside the git repo.Assisted-by kiro:claude-opus-4.6Signed-off-by Daniel Turull <[email protected]>--- modules/steps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)modules/steps.py +1
-2@@ -36,7 +36,7 @@ def load_env(devtool, bb, git, opts, group): os.mkdir(group['workdir']) for pkg_ctx in group['pkgs']: pkg_ctx['env'] = bb.env(pkg_ctx['PN']) - 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'])) def buildhistory_init(devtool, bb, git, opts, group): if not opts['buildhistory']: --2.34.1
PATCH v3 2/4 upgrade-helper.py: Add compatibility with Yocto scarthgap
In reply to [email protected]From: Daniel Turull <[email protected]>
- Handle flat tuple format from get_recipe_upgrade_status (scarthgap) in addition to the list-of-dicts format (master). Scarthgap's _get_recipe_upgrade_status returns a plain tuple of 7 elements per recipe; detect this with isinstance(group, tuple) and normalize. Add a length assertion to catch upstream schema changes early.
- Fallback to MACHINE env var when bitbake-config-build is not available (not present in scarthgap).
--- modules/utils/bitbake.py | 11 +++++++++-- upgrade-helper.py | 12 ++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-)
modules/utils/bitbake.py +9 -2
@@ -24,6 +24,7 @@ # import os +import shutil from logging import debug as D import sys import re
@@ -123,8 +124,14 @@ class Bitbake(object): env = "TCLIBC={}".format(libc) else: env = "" - bb.process.run("bitbake-config-build enable-fragment machine/{}".format(machine)) - return self._cmd(recipe, env_var=env) + if shutil.which("bitbake-config-build"): + bb.process.run("bitbake-config-build enable-fragment machine/{}".format(machine)) + env_var = env if env else None + else: + D("bitbake-config-build not found, using MACHINE env var") + env_var = "MACHINE={}{}".format(machine, + " " + env if env else "") + return self._cmd(recipe, env_var=env_var) def dependency_graph(self, package_list): return self._cmd(package_list, "-g")
upgrade-helper.py +12 -0
@@ -714,6 +714,18 @@ class UniverseUpdater(Updater): pkggroups = oe.recipeutils.get_recipe_upgrade_status(layer_recipes) for group in pkggroups: + + # Scarthgap returns flat tuples from _get_recipe_upgrade_status(); + # field order: (pn, status, cur_ver, next_ver, maintainer, + # revision, no_upgrade_reason) — see oe/recipeutils.py. + if isinstance(group, tuple): + assert len(group) == 7, \ + "unexpected tuple length %d from get_recipe_upgrade_status" % len(group) + 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}] + upgrade_group = [] for pkg in group: maintainer = pkg['maintainer']
Signature · 1 line
2.34.1
PATCH v3 3/4 upgrade-helper.py: Add stable option for patch-only upgrades
In reply to [email protected]From: Daniel Turull <[email protected]>
Add --stable flag to restrict upgrades to the next patch version within the current stable branch (e.g. 1.2.3 -> 1.2.4). When the latest upstream version is a major/minor bump, AUH queries all available versions and picks the best patch-level update.
Per-recipe policy can be overridden via AUH_UPGRADE_POLICY (read from tinfoil), supporting 'patch' (default), 'minor', and 'none' values.
Quick-path optimization: recipes where next_ver is already a patch update are accepted without opening tinfoil. Tinfoil is only opened for recipes that need policy lookup or version scanning.
--- modules/utils/version.py | 185 +++++++++++++++++++++++++++++++++++++++ upgrade-helper.py | 104 ++++++++++++++++++++++ 2 files changed, 289 insertions(+) create mode 100644 modules/utils/version.py
modules/utils/version.py new file +185 -0
@@ -0,0 +1,185 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Version utilities for --stable patch-only upgrades. +# +# get_all_upstream_versions() collects *all* available upstream versions so +# that we can pick the highest patch-level release within the current stable +# branch. The existing bitbake/oe-core APIs (latest_versionstring, +# get_recipe_upstream_version) only return the single highest version, so we +# must re-implement the inner loops here. +# +# The HTTP path mirrors bb.fetch2.wget.Wget._check_latest_version() and the +# git path mirrors bb.fetch2.git.Git.latest_versionstring(), both from +# bitbake scarthgap. We cannot modify oe-core on a stable release, hence +# the duplication. +# +# Requires: beautifulsoup4 (python3-beautifulsoup4 in oe-core) + +import functools +import re +from logging import warning as W + +import bb.utils +import bb.fetch2 +from bs4 import BeautifulSoup, SoupStrainer + + +def _split_version(ver): + # Split on '.', '-', '_' and letter-digit boundaries (e.g. 10.0p2 -> [10, 0, p, 2]) + parts = re.split(r'[\.\-_]', ver) + result = [] + for p in parts: + result.extend(re.split(r'(?<=[a-zA-Z])(?=\d)|(?<=\d)(?=[a-zA-Z])', p)) + return result + + +def is_patch_update(current_ver, candidate_ver): + """Check if candidate is a patch-level update. + + A patch update changes only the last version component while keeping + all preceding components identical. Also accepts sub-patch extensions + (e.g. 1.2.3 -> 1.2.3.1). + """ + cur = _split_version(current_ver) + cand = _split_version(candidate_ver) + if len(cur) < 2 or len(cand) < 2: + return False + if bb.utils.vercmp_string(candidate_ver, current_ver) <= 0: + return False + # All but the last component of the current version must match + # the corresponding prefix of the candidate + if len(cand) < len(cur): + return False + return cur[:-1] == cand[:len(cur) - 1] + + +def is_minor_update(current_ver, candidate_ver): + """Check if candidate is a newer release within the same major version.""" + cur = _split_version(current_ver) + cand = _split_version(candidate_ver) + if len(cur) < 2 or len(cand) < 2: + return False + if cur[0] != cand[0]: + return False + return bb.utils.vercmp_string(candidate_ver, current_ver) > 0 + + +def _find_best_version(current_ver, all_versions, filter_fn): + candidates = [v for v in all_versions if filter_fn(current_ver, v)] + if not candidates: + return None + candidates.sort( + key=functools.cmp_to_key(bb.utils.vercmp_string), reverse=True + ) + return candidates[0] + + +def find_patch_version(current_ver, all_versions): + return _find_best_version(current_ver, all_versions, is_patch_update) + + +def find_minor_version(current_ver, all_versions): + return _find_best_version(current_ver, all_versions, is_minor_update) + + +def get_all_upstream_versions(rd): + """Get all upstream versions using the fetcher infrastructure. + + Unlike ud.method.latest_versionstring() which returns only the highest + version, this collects every version so the caller can filter for + patch-only updates. + """ + src_uris = rd.getVar('SRC_URI') + if not src_uris: + return [] + + src_uri = src_uris.split()[0] + fetch = bb.fetch2.Fetch([src_uri], rd) + ud = fetch.ud[fetch.urls[0]] + + if ud.type == 'git': + return _get_git_versions(ud, rd) + return _get_http_versions(ud, rd) + + +def _get_http_versions(ud, rd): + """Collect all upstream versions from an HTTP index page. + + Adapted from bb.fetch2.wget.Wget._check_latest_version() and + ._init_regexes(). The upstream code only keeps the highest version; + we collect them all. Uses BeautifulSoup to parse <a> tags, matching + the upstream behaviour. + """ + try: + package = ud.path.split("/")[-1] + + regex_uri = rd.getVar('UPSTREAM_CHECK_URI') + if not regex_uri: + path = ud.path.split(package)[0] + regex_uri = bb.fetch2.encodeurl([ud.type, ud.host, path, + ud.user, ud.pswd, {}]) + + page = ud.method._fetch_index(regex_uri, ud, rd) + if not page: + return [] + + regex = rd.getVar('UPSTREAM_CHECK_REGEX') + if regex: + regex = re.compile(regex) + else: + regex = ud.method._init_regexes(package, ud, rd) + if not regex: + return [] + + # Parse HTML links, same as Wget._check_latest_version() + soup = BeautifulSoup(page, "html.parser", + parse_only=SoupStrainer("a")) + if not soup: + return [] + + versions = set() + for link in soup.find_all('a', href=True): + for text in (link['href'], str(link)): + m = regex.search(text) + if m and 'pver' in m.groupdict() and m.group('pver'): + versions.add(re.sub('_', '.', m.group('pver'))) + break + return list(versions) + except Exception as e: + W(" Failed to get HTTP versions: %s" % e) + return [] + + +def _get_git_versions(ud, rd): + """Collect all tagged versions from a git remote. + + Adapted from bb.fetch2.git.Git.latest_versionstring(). The upstream + code only keeps the highest version; we collect them all. + """ + try: + output = ud.method._lsremote(ud, rd, "refs/tags/*") + except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess, OSError) as e: + W(" Failed to list remote tags: %s" % e) + return [] + + rev_tag_re = re.compile(r"([0-9a-f]{40})\s+refs/tags/(.*)") + pver_re = re.compile( + rd.getVar('UPSTREAM_CHECK_GITTAGREGEX') + or r"(?P<pver>([0-9][\.|_]?)+)" + ) + nonrel_re = re.compile(r"(alpha|beta|rc|final)+") + + versions = set() + for line in output.split("\n"): + if not line: + continue + m = rev_tag_re.match(line) + if not m: + continue + tag = m.group(2) + if nonrel_re.search(tag): + continue + m = pver_re.search(tag) + if m: + versions.add(m.group('pver').replace("_", ".")) + return list(versions)
upgrade-helper.py +104 -0
134 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [AUH][PATCH v3 3/4] upgrade-helper.py: Add stable option for patch-only upgrades
This was already discussed, I'm not taking the patch in its current form. The functionality needs to go to oe-core.
Note also the recent discussion in bitbake-devel list around how to determine stable versions properly ("add optional major_version parameter to latest_versionstring").
Alex
Quoted 360 lines · On Mon, 4 May 2026 at 08:36, <[email protected]> wrote:
From: Daniel Turull <[email protected]>
Add --stable flag to restrict upgrades to the next patch version within the current stable branch (e.g. 1.2.3 -> 1.2.4). When the latest upstream version is a major/minor bump, AUH queries all available versions and picks the best patch-level update.
Per-recipe policy can be overridden via
AUH_UPGRADE_POLICY(read from tinfoil), supporting 'patch' (default), 'minor', and 'none' values.Quick-path optimization: recipes where
next_veris already a patch update are accepted without opening tinfoil. Tinfoil is only opened for recipes that need policy lookup or version scanning.Assisted-by kiro:claude-opus-4.6Signed-off-by Daniel Turull <[email protected]>--- modules/utils/version.py | 185 +++++++++++++++++++++++++++++++++++++++ upgrade-helper.py | 104 ++++++++++++++++++++++ 2 files changed, 289 insertions(+) create mode 100644 modules/utils/version.pymodules/utils/version.py new file +185
-0@@ -0,0 +1,185 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Version utilities for --stable patch-only upgrades. +# +# get_all_upstream_versions() collects *all* available upstream versions so +# that we can pick the highest patch-level release within the current stable +# branch. The existing bitbake/oe-core APIs (latest_versionstring, +# get_recipe_upstream_version) only return the single highest version, so we +# must re-implement the inner loops here. +# +# The HTTP path mirrors bb.fetch2.wget.Wget._check_latest_version() and the +# git path mirrors bb.fetch2.git.Git.latest_versionstring(), both from +# bitbake scarthgap. We cannot modify oe-core on a stable release, hence +# the duplication. +# +# Requires: beautifulsoup4 (python3-beautifulsoup4 in oe-core) + +import functools +import re +from logging import warning as W + +import bb.utils +import bb.fetch2 +from bs4 import BeautifulSoup, SoupStrainer + + +def _split_version(ver): + # Split on '.', '-', '_' and letter-digit boundaries (e.g. 10.0p2 -> [10, 0, p, 2]) + parts = re.split(r'[\.\-_]', ver) + result = [] + for p in parts: + result.extend(re.split(r'(?<=[a-zA-Z])(?=\d)|(?<=\d)(?=[a-zA-Z])', p)) + return result + + +def is_patch_update(current_ver, candidate_ver): + """Check if candidate is a patch-level update. + + A patch update changes only the last version component while keeping + all preceding components identical. Also accepts sub-patch extensions + (e.g. 1.2.3 -> 1.2.3.1). + """ + cur = _split_version(current_ver) + cand = _split_version(candidate_ver) + if len(cur) < 2 or len(cand) < 2: + return False + if bb.utils.vercmp_string(candidate_ver, current_ver) <= 0: + return False + # All but the last component of the current version must match + # the corresponding prefix of the candidate + if len(cand) < len(cur): + return False + return cur[:-1] == cand[:len(cur) - 1] + + +def is_minor_update(current_ver, candidate_ver): + """Check if candidate is a newer release within the same major version.""" + cur = _split_version(current_ver) + cand = _split_version(candidate_ver) + if len(cur) < 2 or len(cand) < 2: + return False + if cur[0] != cand[0]: + return False + return bb.utils.vercmp_string(candidate_ver, current_ver) > 0 + + +def _find_best_version(current_ver, all_versions, filter_fn): + candidates = [v for v in all_versions if filter_fn(current_ver, v)] + if not candidates: + return None + candidates.sort( + key=functools.cmp_to_key(bb.utils.vercmp_string), reverse=True + ) + return candidates[0] + + +def find_patch_version(current_ver, all_versions): + return _find_best_version(current_ver, all_versions, is_patch_update) + + +def find_minor_version(current_ver, all_versions): + return _find_best_version(current_ver, all_versions, is_minor_update) + + +def get_all_upstream_versions(rd): + """Get all upstream versions using the fetcher infrastructure. + + Unlike ud.method.latest_versionstring() which returns only the highest + version, this collects every version so the caller can filter for + patch-only updates. + """ + src_uris = rd.getVar('SRC_URI') + if not src_uris: + return [] + + src_uri = src_uris.split()[0] + fetch = bb.fetch2.Fetch([src_uri], rd) + ud = fetch.ud[fetch.urls[0]] + + if ud.type == 'git': + return _get_git_versions(ud, rd) + return _get_http_versions(ud, rd) + + +def _get_http_versions(ud, rd): + """Collect all upstream versions from an HTTP index page. + + Adapted from bb.fetch2.wget.Wget._check_latest_version() and + ._init_regexes(). The upstream code only keeps the highest version; + we collect them all. Uses BeautifulSoup to parse <a> tags, matching + the upstream behaviour. + """ + try: + package = ud.path.split("/")[-1] + + regex_uri = rd.getVar('UPSTREAM_CHECK_URI') + if not regex_uri: + path = ud.path.split(package)[0] + regex_uri = bb.fetch2.encodeurl([ud.type, ud.host, path, + ud.user, ud.pswd, {}]) + + page = ud.method._fetch_index(regex_uri, ud, rd) + if not page: + return [] + + regex = rd.getVar('UPSTREAM_CHECK_REGEX') + if regex: + regex = re.compile(regex) + else: + regex = ud.method._init_regexes(package, ud, rd) + if not regex: + return [] + + # Parse HTML links, same as Wget._check_latest_version() + soup = BeautifulSoup(page, "html.parser", + parse_only=SoupStrainer("a")) + if not soup: + return [] + + versions = set() + for link in soup.find_all('a', href=True): + for text in (link['href'], str(link)): + m = regex.search(text) + if m and 'pver' in m.groupdict() and m.group('pver'): + versions.add(re.sub('_', '.', m.group('pver'))) + break + return list(versions) + except Exception as e: + W(" Failed to get HTTP versions: %s" % e) + return [] + + +def _get_git_versions(ud, rd): + """Collect all tagged versions from a git remote. + + Adapted from bb.fetch2.git.Git.latest_versionstring(). The upstream + code only keeps the highest version; we collect them all. + """ + try: + output = ud.method._lsremote(ud, rd, "refs/tags/*") + except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess, OSError) as e: + W(" Failed to list remote tags: %s" % e) + return [] + + rev_tag_re = re.compile(r"([0-9a-f]{40})\s+refs/tags/(.*)") + pver_re = re.compile( + rd.getVar('UPSTREAM_CHECK_GITTAGREGEX') + or r"(?P<pver>([0-9][\.|_]?)+)" + ) + nonrel_re = re.compile(r"(alpha|beta|rc|final)+") + + versions = set() + for line in output.split("\n"): + if not line: + continue + m = rev_tag_re.match(line) + if not m: + continue + tag = m.group(2) + if nonrel_re.search(tag): + continue + m = pver_re.search(tag) + if m: + versions.add(m.group('pver').replace("_", ".")) + return list(versions)upgrade-helper.py +104
-1@@ -59,6 +59,9 @@ from utils.emailhandler import Email from statistics import Statistics from steps import upgrade_steps from testimage import TestImage +from utils.version import (is_patch_update, find_patch_version, + is_minor_update, find_minor_version, + get_all_upstream_versions) if not os.getenv('BUILDDIR', False): E(" You must source oe-init-build-env before running this script!\n")@@ -74,6 +77,7 @@ scriptpath.add_bitbake_lib_path() scriptpath.add_oe_lib_path() import oe.recipeutils +import bb.tinfoil help_text = """Usage examples: * To upgrade xmodmap recipe to the latest available version:@@ -96,6 +100,9 @@ def parse_cmdline(): parser.add_argument("-t", "--to_version", help="version to upgrade the recipe to") + parser.add_argument("--stable", action="store_true", default=False, + help="only upgrade to the next patch version within the stable branch (e.g. 1.2.3 -> 1.2.4)") + 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,@@ -679,6 +686,67 @@ class UniverseUpdater(Updater): def _get_packagegroups_to_upgrade(self, packages=None): + def _resolve_stable_version(pn, cur_ver, next_ver, tinfoil): + """Find the best version within the policy allowed by AUH_UPGRADE_POLICY. + + Only called when --stable is active. --stable enables version + filtering globally; AUH_UPGRADE_POLICY overrides the policy + per-recipe within that filtering. + + AUH_UPGRADE_POLICY can be set per-recipe in local.conf or in the + recipe itself: + "patch" (default) - only patch-level updates (e.g. 1.2.3 -> 1.2.4) + "minor" - same-major updates (e.g. 1.2.3 -> 1.3.0) + "none" - skip this recipe entirely + """ + # Quick path: if next_ver is already a patch update, accept it + # without parsing the recipe (covers the common case). + if is_patch_update(cur_ver, next_ver): + return next_ver, None + + try: + rd = tinfoil.parse_recipe(pn) + except Exception: + rd = None + if not rd: + I(" %s: could not parse recipe, skipping" % pn) + return None, None + + policy = (rd.getVar('AUH_UPGRADE_POLICY') or 'patch').strip().lower() + if policy not in ('patch', 'minor', 'none'): + W(" %s: unrecognized AUH_UPGRADE_POLICY '%s'," + " defaulting to 'patch'" % (pn, policy)) + policy = 'patch' + if policy == 'none': + I(" %s: AUH_UPGRADE_POLICY=none, skipping" % pn) + return None, None + + if policy == 'minor': + check_fn = is_minor_update + find_fn = find_minor_version + else: + check_fn = is_patch_update + find_fn = find_patch_version + + if check_fn(cur_ver, next_ver): + return next_ver, None + + I(" %s: latest version %s is not a %s update from %s," + " searching for versions..." % + (pn, next_ver, policy, cur_ver)) + try: + all_versions = get_all_upstream_versions(rd) + ver = find_fn(cur_ver, all_versions) + if ver: + I(" %s: found version %s" % (pn, ver)) + return ver, "N/A" + else: + I(" %s: no suitable version available, skipping" % pn) + return None, None + except Exception as e: + I(" %s: failed to search for versions: %s" % (pn, e)) + return None, None + # Prepare a single pkg dict data (or None is not upgradable) from recipeutils.get_recipe_upgrade_status data. def _get_pkg_to_upgrade(self, layer_name, pn, status, cur_ver, next_ver, maintainer, revision, no_upgrade_reason): pkg_to_upgrade = None@@ -736,6 +804,42 @@ class UniverseUpdater(Updater): upgrade_group.append(pkg_to_upgrade) if upgrade_group: upgrade_pkggroups.append(upgrade_group) + + if self.args.stable and upgrade_pkggroups: + # Quick-path: accept packages where next_ver is already a patch + # update without opening tinfoil. For the rest, tinfoil must + # remain open because bb.fetch2.Fetch needs a live rd object. + needs_tinfoil = [] + for group in upgrade_pkggroups: + quick_group = [] + slow_pkgs = [] + for pkg in group: + if is_patch_update(pkg['cur_ver'], pkg['next_ver']): + quick_group.append(pkg) + else: + slow_pkgs.append(pkg) + if quick_group or slow_pkgs: + needs_tinfoil.append((quick_group, slow_pkgs)) + + if any(slow for _, slow in needs_tinfoil): + stable_tinfoil = bb.tinfoil.Tinfoil() + stable_tinfoil.prepare(config_only=False) + try: + for quick_group, slow_pkgs in needs_tinfoil: + for pkg in slow_pkgs: + ver, rev = _resolve_stable_version( + pkg['pn'], pkg['cur_ver'], + pkg['next_ver'], stable_tinfoil) + if ver is not None: + pkg['next_ver'] = ver + if rev is not None: + pkg['revision'] = rev + quick_group.append(pkg) + finally: + stable_tinfoil.shutdown() + + upgrade_pkggroups = [g for g, _ in needs_tinfoil if g] + return upgrade_pkggroups def pkg_upgrade_handler(self, pkg_ctx): --2.34.1
RE: [AUH][PATCH v3 3/4] upgrade-helper.py: Add stable option for patch-only upgrades
Sorry, I misunderstood you. I though it was only the changelog going into devtool.
I'll check the bitbake-level. I missed it.
So we keep patch 1, 2 and 4? Probably the most important is 2 [PATCH v3 2/4] upgrade-helper.py: Add compatibility with Yocto scarthgap, the other two can be optional.
Best regards,
Daniel
Quoted 390 lines
-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Monday, 4 May 2026 09:28
To: Daniel Turull <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [AUH][PATCH v3 3/4]upgrade-helper.py: Add stable option for patch-only upgradesThis was already discussed, I'm not taking the patch in its current form. The functionality needs to go to oe-core.
Note also the recent discussion in bitbake-devel list around how to determine stable versions properly ("add optional
major_versionparameter tolatest_versionstring").Alex
Quoted 11 lines · On Mon, 4 May 2026 at 08:36, <[email protected]> wrote:
From: Daniel Turull <[email protected]>
Add --stable flag to restrict upgrades to the next patch version within the current stable branch (e.g. 1.2.3 -> 1.2.4). When the latest upstream version is a major/minor bump, AUH queries all available versions and picks the best patch-level update.
Per-recipe policy can be overridden via
AUH_UPGRADE_POLICY(read from tinfoil), supporting 'patch' (default), 'minor', and 'none' values.Quoted 8 lines
Quick-path optimization: recipes where
next_veris already a patch update are accepted without opening tinfoil. Tinfoil is only opened for recipes that need policy lookup or version scanning.Assisted-by kiro:claude-opus-4.6Signed-off-by Daniel Turull <[email protected]>--- modules/utils/version.py | 185+++++++++++++++++++++++++++++++++++++++
Quoted 26 lines
upgrade-helper.py | 104 ++++++++++++++++++++++ 2 files changed, 289 insertions(+) create mode 100644 modules/utils/version.pymodules/utils/version.py new renamed from modules/utils/version.py +0
-0file mode 100644 index 0000000..4417bd5
modules/utils/version.py new file +17
-0@@ -0,0 +1,185 @@ +# SPDX-License-Identifier: GPL-2.0-or-later # # Version utilities for +--stable patch-only upgrades. +# +# get_all_upstream_versions() collects *all* available upstream +versions so # that we can pick the highest patch-level release within +the current stable # branch. The existing bitbake/oe-core APIs +(latest_versionstring, # get_recipe_upstream_version) only return the +single highest version, so we # must re-implement the inner loops here. +# +# The HTTP path mirrors bb.fetch2.wget.Wget._check_latest_version() +and the # git path mirrors bb.fetch2.git.Git.latest_versionstring(), +both from # bitbake scarthgap. We cannot modify oe-core on a stable +release, hence # the duplication. +# +# Requires: beautifulsoup4 (python3-beautifulsoup4 in oe-core) + +import functoolsmodules/utils/version.py line 27
Quoted 10 lines
modules/utils/version.py new file +10
-0+import re +from logging import warning as W + +import bb.utils +import bb.fetch2 +from bs4 import BeautifulSoup, SoupStrainer + + +def _split_version(ver): + # Split on '.', '-', '_' and letter-digit boundaries (e.g. 10.0p2 -> [10, 0, p,2])
Quoted 19 lines
modules/utils/version.py new file +19
-0+ parts = re.split(r'[\.\-_]', ver) + result = [] + for p in parts: + result.extend(re.split(r'(?<=[a-zA-Z])(?=\d)|(?<=\d)(?=[a-zA-Z])', p)) + return result + + +def is_patch_update(current_ver, candidate_ver): + """Check if candidate is a patch-level update. + + A patch update changes only the last version component while keeping + all preceding components identical. Also accepts sub-patch extensions + (e.g. 1.2.3 -> 1.2.3.1). + """ + cur = _split_version(current_ver) + cand = _split_version(candidate_ver) + if len(cur) < 2 or len(cand) < 2: + return False + if bb.utils.vercmp_string(candidate_ver, current_ver) <= 0:modules/utils/version.py
Quoted 10 lines
modules/utils/version.py new file +10
-0+ return False + # All but the last component of the current version must match + # the corresponding prefix of the candidate + if len(cand) < len(cur): + return False + return cur[:-1] == cand[:len(cur) - 1] + + +def is_minor_update(current_ver, candidate_ver): + """Check if candidate is a newer release within the same majorversion."""
Quoted 152 lines
modules/utils/version.py new file +130
-0+ cur = _split_version(current_ver) + cand = _split_version(candidate_ver) + if len(cur) < 2 or len(cand) < 2: + return False + if cur[0] != cand[0]: + return False + return bb.utils.vercmp_string(candidate_ver, current_ver) > 0 + + +def _find_best_version(current_ver, all_versions, filter_fn): + candidates = [v for v in all_versions if filter_fn(current_ver, v)] + if not candidates: + return None + candidates.sort( + key=functools.cmp_to_key(bb.utils.vercmp_string), reverse=True + ) + return candidates[0] + + +def find_patch_version(current_ver, all_versions): + return _find_best_version(current_ver, all_versions, +is_patch_update) + + +def find_minor_version(current_ver, all_versions): + return _find_best_version(current_ver, all_versions, +is_minor_update) + + +def get_all_upstream_versions(rd): + """Get all upstream versions using the fetcher infrastructure. + + Unlike ud.method.latest_versionstring() which returns only the highest + version, this collects every version so the caller can filter for + patch-only updates. + """ + src_uris = rd.getVar('SRC_URI') + if not src_uris: + return [] + + src_uri = src_uris.split()[0] + fetch = bb.fetch2.Fetch([src_uri], rd) + ud = fetch.ud[fetch.urls[0]] + + if ud.type == 'git': + return _get_git_versions(ud, rd) + return _get_http_versions(ud, rd) + + +def _get_http_versions(ud, rd): + """Collect all upstream versions from an HTTP index page. + + Adapted from bb.fetch2.wget.Wget._check_latest_version() and + ._init_regexes(). The upstream code only keeps the highest version; + we collect them all. Uses BeautifulSoup to parse <a> tags, matching + the upstream behaviour. + """ + try: + package = ud.path.split("/")[-1] + + regex_uri = rd.getVar('UPSTREAM_CHECK_URI') + if not regex_uri: + path = ud.path.split(package)[0] + regex_uri = bb.fetch2.encodeurl([ud.type, ud.host, path, + ud.user, ud.pswd, {}]) + + page = ud.method._fetch_index(regex_uri, ud, rd) + if not page: + return [] + + regex = rd.getVar('UPSTREAM_CHECK_REGEX') + if regex: + regex = re.compile(regex) + else: + regex = ud.method._init_regexes(package, ud, rd) + if not regex: + return [] + + # Parse HTML links, same as Wget._check_latest_version() + soup = BeautifulSoup(page, "html.parser", + parse_only=SoupStrainer("a")) + if not soup: + return [] + + versions = set() + for link in soup.find_all('a', href=True): + for text in (link['href'], str(link)): + m = regex.search(text) + if m and 'pver' in m.groupdict() and m.group('pver'): + versions.add(re.sub('_', '.', m.group('pver'))) + break + return list(versions) + except Exception as e: + W(" Failed to get HTTP versions: %s" % e) + return [] + + +def _get_git_versions(ud, rd): + """Collect all tagged versions from a git remote. + + Adapted from bb.fetch2.git.Git.latest_versionstring(). The upstream + code only keeps the highest version; we collect them all. + """ + try: + output = ud.method._lsremote(ud, rd, "refs/tags/*") + except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess, OSError) as e: + W(" Failed to list remote tags: %s" % e) + return [] + + rev_tag_re = re.compile(r"([0-9a-f]{40})\s+refs/tags/(.*)") + pver_re = re.compile( + rd.getVar('UPSTREAM_CHECK_GITTAGREGEX') + or r"(?P<pver>([0-9][\.|_]?)+)" + ) + nonrel_re = re.compile(r"(alpha|beta|rc|final)+") + + versions = set() + for line in output.split("\n"): + if not line: + continue + m = rev_tag_re.match(line) + if not m: + continue + tag = m.group(2) + if nonrel_re.search(tag): + continue + m = pver_re.search(tag) + if m: + versions.add(m.group('pver').replace("_", ".")) + return list(versions)upgrade-helper.py index renamed from upgrade-helper.py +0
-09954a66..aecb207 100755
upgrade-helper.py +0
-0@@ -59,6 +59,9 @@ from utils.emailhandler import Email fromstatistics import Statistics from steps import
upgrade_stepsfrom testimage import TestImageupgrade-helper.py +3
-0+from utils.version import (is_patch_update, find_patch_version, + is_minor_update, find_minor_version, + get_all_upstream_versions) if not os.getenv('BUILDDIR', False): E(" You must source oe-init-build-env before running thisscript!\n") @@ -74,6 +77,7 @@
scriptpath.add_bitbake_lib_path()
scriptpath.add_oe_lib_path()import oe.recipeutils
upgrade-helper.py +1
-0+import bb.tinfoil help_text = """Usage examples: * To upgrade xmodmap recipe to the latest available version:upgrade-helper.py def parse_cmdline(): · line 107
Quoted 8 lines
upgrade-helper.py +4
-0@@ -96,6 +100,9 @@ def parse_cmdline(): parser.add_argument("-t", "--to_version", help="version to upgrade the recipe to") + parser.add_argument("--stable", action="store_true", default=False, + help="only upgrade to the next patch version + within the stable branch (e.g. 1.2.3 -> 1.2.4)") + parser.add_argument("-d", "--debug-level", type=int, default=4,choices=range(1, 6),
upgrade-helper.py def parse_cmdline(): · line 108
Quoted 1 line
upgrade-helper.py +0
-0help="set the debug level: CRITICAL=1, ERROR=2,WARNING=3, INFO=4, DEBUG=5")
upgrade-helper.py
Quoted 7 lines
parser.add_argument("-e", "--send-emails", action="store_true",default=False, @@ -679,6 +686,67 @@ class UniverseUpdater(Updater):
def
_get_packagegroups_to_upgrade(self, packages=None):upgrade-helper.py +2
-0+ def _resolve_stable_version(pn, cur_ver, next_ver, tinfoil): + """Find the best version within the policy allowed by
AUH_UPGRADE_POLICY.Quoted 15 lines
upgrade-helper.py +15
-0+ + Only called when --stable is active. --stable enables version + filtering globally; AUH_UPGRADE_POLICY overrides the policy + per-recipe within that filtering. + + AUH_UPGRADE_POLICY can be set per-recipe in local.conf or in the + recipe itself: + "patch" (default) - only patch-level updates (e.g. 1.2.3 -> 1.2.4) + "minor" - same-major updates (e.g. 1.2.3 -> 1.3.0) + "none" - skip this recipe entirely + """ + # Quick path: if next_ver is already a patch update, accept it + # without parsing the recipe (covers the common case). + if is_patch_update(cur_ver, next_ver): + return next_ver, Noneupgrade-helper.py class UniverseUpdater(Updater):
Quoted 10 lines
upgrade-helper.py +10
-0+ + try: + rd = tinfoil.parse_recipe(pn) + except Exception: + rd = None + if not rd: + I(" %s: could not parse recipe, skipping" % pn) + return None, None + + policy = (rd.getVar('AUH_UPGRADE_POLICY') or'patch').strip().lower()
Quoted 25 lines
upgrade-helper.py +25
-0+ if policy not in ('patch', 'minor', 'none'): + W(" %s: unrecognized AUH_UPGRADE_POLICY '%s'," + " defaulting to 'patch'" % (pn, policy)) + policy = 'patch' + if policy == 'none': + I(" %s: AUH_UPGRADE_POLICY=none, skipping" % pn) + return None, None + + if policy == 'minor': + check_fn = is_minor_update + find_fn = find_minor_version + else: + check_fn = is_patch_update + find_fn = find_patch_version + + if check_fn(cur_ver, next_ver): + return next_ver, None + + I(" %s: latest version %s is not a %s update from %s," + " searching for versions..." % + (pn, next_ver, policy, cur_ver)) + try: + all_versions = get_all_upstream_versions(rd) + ver = find_fn(cur_ver, all_versions) + if ver:upgrade-helper.py class UniverseUpdater(Updater):
Quoted 10 lines
upgrade-helper.py +9
-0+ I(" %s: found version %s" % (pn, ver)) + return ver, "N/A" + else: + I(" %s: no suitable version available, skipping" % pn) + return None, None + except Exception as e: + I(" %s: failed to search for versions: %s" % (pn, e)) + return None, None + # Prepare a single pkg dict data (or None is not upgradable) fromrecipeutils.get_recipe_upgrade_status data.
Quoted 1 line
def _get_pkg_to_upgrade(self,
layer_name, pn, status,cur_ver,
next_ver, maintainer, revision,no_upgrade_reason):Quoted 47 lines
pkg_to_upgrade= Noneupgrade-helper.py +36
-1@@ -736,6 +804,42 @@ class UniverseUpdater(Updater): upgrade_group.append(pkg_to_upgrade) if upgrade_group: upgrade_pkggroups.append(upgrade_group) + + if self.args.stable and upgrade_pkggroups: + # Quick-path: accept packages where next_ver is already a patch + # update without opening tinfoil. For the rest, tinfoil must + # remain open because bb.fetch2.Fetch needs a live rd object. + needs_tinfoil = [] + for group in upgrade_pkggroups: + quick_group = [] + slow_pkgs = [] + for pkg in group: + if is_patch_update(pkg['cur_ver'], pkg['next_ver']): + quick_group.append(pkg) + else: + slow_pkgs.append(pkg) + if quick_group or slow_pkgs: + needs_tinfoil.append((quick_group, slow_pkgs)) + + if any(slow for _, slow in needs_tinfoil): + stable_tinfoil = bb.tinfoil.Tinfoil() + stable_tinfoil.prepare(config_only=False) + try: + for quick_group, slow_pkgs in needs_tinfoil: + for pkg in slow_pkgs: + ver, rev = _resolve_stable_version( + pkg['pn'], pkg['cur_ver'], + pkg['next_ver'], stable_tinfoil) + if ver is not None: + pkg['next_ver'] = ver + if rev is not None: + pkg['revision'] = rev + quick_group.append(pkg) + finally: + stable_tinfoil.shutdown() + + upgrade_pkggroups = [g for g, _ in needs_tinfoil if g] + return upgrade_pkggroups def pkg_upgrade_handler(self, pkg_ctx): --2.34.1
Re: [AUH][PATCH v3 3/4] upgrade-helper.py: Add stable option for patch-only upgrades
Quoted 4 lines · Daniel Turull
Sorry, I misunderstood you. I though it was only the changelog going into devtool.
I'll check the bitbake-level. I missed it.
I meant particular this response to a patch from elsewhere that aims for a similar function:
https://lists.openembedded.org/g/bitbake-devel/message/19414
Quoted 1 line
So we keep patch 1, 2 and 4? Probably the most important is 2 [PATCH v3 2/4]
upgrade-helper.py: Add compatibility with Yocto scarthgap, the other two can be optional.
I have to ask, if 2 is applied, would that be useful without the ability to pick only stable bugfix-only updates? You'll probably have to maintain both 2 and 3 privately while the 'stable updates' issue is resolved properly in oe-core/bitbake master.
1/4 seems fine, the function of 4/4 is fine but I need to review the code.
Alex
Re: [AUH][PATCH v3 3/4] upgrade-helper.py: Add stable option for patch-only upgrades
Yes, I can keep the rest locally and wait for the oe/bitbake to get resolved and backported to scarthgap. I believe patch 2 will be needed at some point by the other series, so they can build on top.
In the meantime to avoid duplication of efforts I'll focus on the changelog to be integrated with oe-core.
Thanks
Daniel
________________________________
From: Alexander Kanavin <[email protected]>
Sent: Monday, May 4, 2026 9:52 AM
To: Daniel Turull <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [AUH][PATCH v3 3/4] upgrade-helper.py: Add stable option for patch-only upgrades
Quoted 4 lines · Daniel Turull
Sorry, I misunderstood you. I though it was only the changelog going into devtool.
I'll check the bitbake-level. I missed it.
I meant particular this response to a patch from elsewhere that aims for a similar function:
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.openembedded.org%2Fg%2Fbitbake-devel%2Fmessage%2F19414&data=05%7C02%7Cdaniel.turull%40ericsson.com%7Ce3d0c1c80f124f1c639d08dea9b21238%7C92e84cebfbfd47abbe52080c6b87953f%7C0%7C0%7C639134779439726477%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=h0JNlQNZUVuuoe1IReAyBWXaWPNSbtscOLuJCA1w20Y%3D&reserved=0<https://lists.openembedded.org/g/bitbake-devel/message/19414>
Quoted 1 line
So we keep patch 1, 2 and 4? Probably the most important is 2 [PATCH v3 2/4]
upgrade-helper.py: Add compatibility with Yocto scarthgap, the other two can be optional.
I have to ask, if 2 is applied, would that be useful without the ability to pick only stable bugfix-only updates? You'll probably have to maintain both 2 and 3 privately while the 'stable updates' issue is resolved properly in oe-core/bitbake master.
1/4 seems fine, the function of 4/4 is fine but I need to review the code.
Alex
PATCH v3 4/4 upgrade-helper.py: Add resume option to skip already attempted recipes
In reply to [email protected]From: Daniel Turull <[email protected]>
Add --resume option that checks the most recent run's succeed/ and failed/ directories to determine which recipes were already attempted.
Symlinks in these directories are now created immediately after each recipe is processed (rather than at the end of the run), so an interrupted run still leaves behind the right state for --resume.
This allows restarting an interrupted run without re-processing recipes that have already been handled, saving significant time on large runs (e.g. 12h for 135 recipes).
--- upgrade-helper.py | 48 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-)
upgrade-helper.py +38 -10
@@ -42,6 +42,7 @@ import re import signal import sys import configparser +import glob from datetime import datetime from datetime import date import shutil
@@ -99,10 +100,12 @@ def parse_cmdline(): parser.add_argument("-t", "--to_version", help="version to upgrade the recipe to") - parser.add_argument("--stable", action="store_true", default=False, help="only upgrade to the next patch version within the stable branch (e.g. 1.2.3 -> 1.2.4)") + parser.add_argument("--resume", action="store_true", default=False, + help="skip recipes already attempted in the last run") + 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,
@@ -493,10 +496,34 @@ class Updater(object): succeeded_pkggroups_ctx = [] failed_pkggroups_ctx = [] attempted_pkggroups = 0 + + # --resume: skip recipes already attempted in the most recent run + resume_skip = set() + if self.args.resume: + prev_runs = sorted(glob.glob(os.path.join(self.uh_dir, "20*"))) + prev_runs = [r for r in prev_runs if r != self.uh_work_dir] + if prev_runs: + prev_dir = prev_runs[-1] + for d in ("succeed", "failed"): + result_dir = os.path.join(prev_dir, d) + if os.path.isdir(result_dir): + resume_skip.update(os.listdir(result_dir)) + if resume_skip: + I(" --resume: skipping %d recipes from %s" % + (len(resume_skip), prev_dir)) + else: + W(" --resume: no previous run found, nothing to skip") for g in pkggroups_ctx: attempted_pkggroups += 1 pkggroup_name = g["name"] + + if g['name'] in resume_skip: + I(" SKIP PACKAGE GROUP %d/%d (already attempted): %s" % + (attempted_pkggroups, total_pkggroups, pkggroup_name)) + continue + I(" ATTEMPT PACKAGE GROUP %d/%d" % (attempted_pkggroups, total_pkggroups)) + try: for pkg_ctx in g['pkgs']: I(" %s: Upgrading to %s" % (pkg_ctx['PN'], pkg_ctx['NPV']))
@@ -541,6 +568,15 @@ class Updater(object): succeeded_pkggroups_ctx.remove(g) failed_pkggroups_ctx.append(g) + # Create symlink immediately so --resume can find it + if 'workdir' in g: + if any(g['name'] == s['name'] for s in succeeded_pkggroups_ctx): + link = os.path.join(self.uh_recipes_succeed_dir, g['name']) + else: + link = os.path.join(self.uh_recipes_failed_dir, g['name']) + if not os.path.exists(link): + os.symlink(g['workdir'], link) + if self.opts['testimage']: ctxs = {} ctxs['succeeded'] = succeeded_pkggroups_ctx
@@ -551,15 +587,7 @@ class Updater(object): tim.run() - for g in pkggroups_ctx: - - if g in succeeded_pkggroups_ctx: - os.symlink(g['workdir'], os.path.join( \ - self.uh_recipes_succeed_dir, g['name'])) - else: - os.symlink(g['workdir'], os.path.join( \ - self.uh_recipes_failed_dir, g['name'])) - + for g in succeeded_pkggroups_ctx + failed_pkggroups_ctx: self.statistics.update(g) self.pkg_upgrade_handler(g)
Signature · 1 line
2.34.1
Re: [AUH][PATCH v3 4/4] upgrade-helper.py: Add resume option to skip already attempted recipes
upgrade-helper.py class Updater(object): · line 506
Quoted 4 lines · On Mon, 4 May 2026 at 08:36, <[email protected]> wrote:
upgrade-helper.py +4
-0+ prev_runs = sorted(glob.glob(os.path.join(self.uh_dir, "20*"))) + prev_runs = [r for r in prev_runs if r != self.uh_work_dir] + if prev_runs: + prev_dir = prev_runs[-1]
This makes me wonder, if AUH was interrupted in its second run, and we need to resume for the second time, then AUH should combine everything from all previous runs into the skip set, not just recipes from the latest one, right?
upgrade-helper.py class Updater(object): · line 573
Quoted 2 lines
upgrade-helper.py +2
-0+ if 'workdir' in g: + if any(g['name'] == s['name'] for s in succeeded_pkggroups_ctx):
This is more complex than the condition in the removed block below, why not use that:
if g in succeeded_pkggroups_ctx:
upgrade-helper.py class Updater(object): · line 578
Quoted 2 lines
upgrade-helper.py +2
-0+ if not os.path.exists(link): + os.symlink(g['workdir'], link)
Why is the existence guard needed? The removed code block doesn't have it.
Alex
RE: [AUH][PATCH v3 4/4] upgrade-helper.py: Add resume option to skip already attempted recipes
Quoted 17 lines
-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Monday, 4 May 2026 10:12
To: Daniel Turull <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [AUH][PATCH v3 4/4]upgrade-helper.py: Add resume option to skip already attempted recipesupgrade-helper.py class Updater(object): · line 506
Quoted 4 lines · On Mon, 4 May 2026 at 08:36, <[email protected]> wrote:
upgrade-helper.py +4
-0+ prev_runs = sorted(glob.glob(os.path.join(self.uh_dir, "20*"))) + prev_runs = [r for r in prev_runs if r != self.uh_work_dir] + if prev_runs: + prev_dir = prev_runs[-1]
Quoted 5 lines
This makes me wonder, if AUH was interrupted in its second run, and we need to resume for the second time, then AUH should combine everything from all previous runs into the skip set, not just recipes from the latest one, right?
Yes, you are right. I'll fix it in a new version.
Quoted 7 lines
upgrade-helper.py class Updater(object): · line 573
Quoted 2 lines
upgrade-helper.py +2
-0+ if 'workdir' in g: + if any(g['name'] == s['name'] for s in succeeded_pkggroups_ctx):This is more complex than the condition in the removed block below, why not use that:
if g insucceeded_pkggroups_ctx:
I'll add your suggestion.
Quoted 5 lines
upgrade-helper.py class Updater(object): · line 578
Quoted 2 lines
upgrade-helper.py +2
-0+ if not os.path.exists(link): + os.symlink(g['workdir'], link)Why is the existence guard needed? The removed code block doesn't have it.
It's not. It was some transient error that I had but now I cannot reproduce it. Each run creates a fresh timestamped directory so symlinks can't already exist. Removed
Thanks
Daniel
Re: [AUH][PATCH v3 4/4] upgrade-helper.py: Add resume option to skip already attempted recipes
Quoted 8 lines · Daniel Turull
Quoted 7 lines
upgrade-helper.py class Updater(object): · line 573
Quoted 2 lines
upgrade-helper.py +2
-0+ if 'workdir' in g: + if any(g['name'] == s['name'] for s in succeeded_pkggroups_ctx):This is more complex than the condition in the removed block below, why not use that:
if g insucceeded_pkggroups_ctx:I'll add your suggestion.
Please be honest. Did AI introduce this inconsistency? Catching and correcting such things is on AI operators, not on reviewers.
Alex
RE: [AUH][PATCH v3 4/4] upgrade-helper.py: Add resume option to skip already attempted recipes
Yes, it was introduced by AI and I missed to catch it.
I did review it manually but clearly I need to be more focused to catch these types of issues. The last thing I want is to waste maintainers time. You are very important for the project. I apologize for that.
Best regards,
Daniel
Quoted 25 lines
-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Tuesday, 5 May 2026 10:06
To: Daniel Turull <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [AUH][PATCH v3 4/4]upgrade-helper.py: Add resume option to skip already attempted recipesQuoted 2 lines · Daniel Turull
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if 'workdir' in g: + if any(g['name'] == s['name'] for s in
succeeded_pkggroups_ctx):Quoted 6 lines
Quoted 5 lines
This is more complex than the condition in the removed block below, why not use that:
if g insucceeded_pkggroups_ctx:I'll add your suggestion.
Please be honest. Did AI introduce this inconsistency? Catching and correcting such things is on AI operators, not on reviewers.
Alex
Re: [AUH][PATCH v3 4/4] upgrade-helper.py: Add resume option to skip already attempted recipes
Quoted 3 lines · Daniel Turull
Yes, it was introduced by AI and I missed to catch it.
I did review it manually but clearly I need to be more focused to catch these types of issues.
What I've seen here, and in other patches is that AI makes code that functions, but has baffling, unexplained logic oddities and maintainability shortcomings that a human wouldn't make. It also doesn't write good commit messages.
I don't object to usage of AI per se (that ship has sailed), but you should treat it as a bumbling, confused summer intern that needs to be carefully watched and corrected. Whether you actually end up saving time that way is up to you, just do your utmost to not end up using more of maintainers time.
Alex