[yocto] [PATCH][auh] upgradehelper: Replace do_checkpkg usage with direct tinfoil calls

Alexander Kanavin alex.kanavin at gmail.com
Fri Dec 14 08:56:51 PST 2018


On Fri, 14 Dec 2018 at 17:07, Richard Purdie
<richard.purdie at linuxfoundation.org> wrote:
> +        with bb.tinfoil.Tinfoil() as tinfoil:
> +            tinfoil.prepare(config_only=False)
> +            recipes = self.recipes
> +            if not recipes:
> +                recipes = tinfoil.all_recipe_files(variants=False)
> +
> +            for fn in recipes:
> +                try:
> +                    if fn.startswith("/"):
> +                        data = tinfoil.parse_recipe_file(fn)
> +                    else:
> +                        data = tinfoil.parse_recipe(fn)
> +                except bb.providers.NoProvider:
> +                    I(" No provider for %s" % fn)
> +                    continue
> +
> +                unreliable = data.getVar('UPSTREAM_CHECK_UNRELIABLE')
> +                if unreliable == "1":
> +                    I(" Skip package %s as upstream check unreliable" % pn)
> +                    continue
> +
> +                uv = oe.recipeutils.get_recipe_upstream_version(data)
> +
> +                pn = data.getVar('PN')
> +                cur_ver = uv['current_version']
> +
> +
> +                upstream_version_unknown = data.getVar('UPSTREAM_VERSION_UNKNOWN')
> +                if not uv['version']:
> +                    status = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN"
> +                else:
> +                    cmp = vercmp_string(uv['current_version'], uv['version'])
> +                    if cmp == -1:
> +                        status = "UPDATE" if not upstream_version_unknown else "KNOWN_BROKEN"
> +                    elif cmp == 0:
> +                        status = "MATCH" if not upstream_version_unknown else "KNOWN_BROKEN"
> +                    else:
> +                        status = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN"
> +

This part is generally useful, and should be placed somewhere in
lib/oe/recipeutils.py perhaps? I can imagine having a script (AUH
itself perhaps) that can use the data to print statistics or detect
broken upstream checks. Agree about issues with do_checkpkg  and
general awfulness of distrodata class :)

Alex


More information about the yocto mailing list