summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-14 17:45:27 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-15 11:48:07 +0000
commit13940a81dae451b8efa9b94f2b7f5a37fbb6c9af (patch)
tree9dba6ecfd8b1f159da87502535150dde50eff63c /meta/lib
parent88c41f3d8bc0107d7e416b69b2ac248c2e57c9fc (diff)
downloadpoky-13940a81dae451b8efa9b94f2b7f5a37fbb6c9af.tar.gz
lib/oe/recipeutils: Add a new function to mimic do_checkpkg
The code in distrodata.bbclass related to the do_checkpkg task is rather dated, has holes in it (ignoring some recipes) and has horrible locking and csv related issues. We should use modern APIs such as tinfoil to make the calls we need directly against bitbake, cutting out the middleman and clarifing the code. This change imports the bits of distrodata.bbclass that are needed by the automated upgrade helper (AUH) into a standalone function which uses the tinfoil API. This can then be used by AUH and by the tests in oeqa/selftest/distrodata as well as by any other standalone script that needs this functionality. Its likely it can be further improved from here but this is a good start and appears to function as before, with slightly wider recipe coverage as some things skipped by distrodata are not skipped here (images, pieces of gcc, nativesdk only recipes). (From OE-Core rev: 92e33277b1b7892bae9cc0801ab379bd1c57c0f0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/recipeutils.py53
1 files changed, 52 insertions, 1 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 9c99164d24..39d3de4bb1 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -16,8 +16,10 @@ import shutil
16import re 16import re
17import fnmatch 17import fnmatch
18import glob 18import glob
19from collections import OrderedDict, defaultdict 19import bb.tinfoil
20 20
21from collections import OrderedDict, defaultdict
22from bb.utils import vercmp_string
21 23
22# Help us to find places to insert values 24# Help us to find places to insert values
23recipe_progression = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION', 'LICENSE', 'LICENSE_FLAGS', 'LIC_FILES_CHKSUM', 'PROVIDES', 'DEPENDS', 'PR', 'PV', 'SRCREV', 'SRCPV', 'SRC_URI', 'S', 'do_fetch()', 'do_unpack()', 'do_patch()', 'EXTRA_OECONF', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'do_configure()', 'EXTRA_OEMAKE', 'do_compile()', 'do_install()', 'do_populate_sysroot()', 'INITSCRIPT', 'USERADD', 'GROUPADD', 'PACKAGES', 'FILES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RPROVIDES', 'RREPLACES', 'RCONFLICTS', 'ALLOW_EMPTY', 'populate_packages()', 'do_package()', 'do_deploy()'] 25recipe_progression = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION', 'LICENSE', 'LICENSE_FLAGS', 'LIC_FILES_CHKSUM', 'PROVIDES', 'DEPENDS', 'PR', 'PV', 'SRCREV', 'SRCPV', 'SRC_URI', 'S', 'do_fetch()', 'do_unpack()', 'do_patch()', 'EXTRA_OECONF', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'do_configure()', 'EXTRA_OEMAKE', 'do_compile()', 'do_install()', 'do_populate_sysroot()', 'INITSCRIPT', 'USERADD', 'GROUPADD', 'PACKAGES', 'FILES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RPROVIDES', 'RREPLACES', 'RCONFLICTS', 'ALLOW_EMPTY', 'populate_packages()', 'do_package()', 'do_deploy()']
@@ -1017,3 +1019,52 @@ def get_recipe_upstream_version(rd):
1017 ru['datetime'] = datetime.now() 1019 ru['datetime'] = datetime.now()
1018 1020
1019 return ru 1021 return ru
1022
1023def get_recipe_upgrade_status(recipes=None):
1024 pkgs_list = []
1025 with bb.tinfoil.Tinfoil() as tinfoil:
1026 tinfoil.prepare(config_only=False)
1027
1028 if not recipes:
1029 recipes = tinfoil.all_recipe_files(variants=False)
1030
1031 for fn in recipes:
1032 try:
1033 if fn.startswith("/"):
1034 data = tinfoil.parse_recipe_file(fn)
1035 else:
1036 data = tinfoil.parse_recipe(fn)
1037 except bb.providers.NoProvider:
1038 bb.note(" No provider for %s" % fn)
1039 continue
1040
1041 unreliable = data.getVar('UPSTREAM_CHECK_UNRELIABLE')
1042 if unreliable == "1":
1043 bb.note(" Skip package %s as upstream check unreliable" % pn)
1044 continue
1045
1046 uv = get_recipe_upstream_version(data)
1047
1048 pn = data.getVar('PN')
1049 cur_ver = uv['current_version']
1050
1051 upstream_version_unknown = data.getVar('UPSTREAM_VERSION_UNKNOWN')
1052 if not uv['version']:
1053 status = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN"
1054 else:
1055 cmp = vercmp_string(uv['current_version'], uv['version'])
1056 if cmp == -1:
1057 status = "UPDATE" if not upstream_version_unknown else "KNOWN_BROKEN"
1058 elif cmp == 0:
1059 status = "MATCH" if not upstream_version_unknown else "KNOWN_BROKEN"
1060 else:
1061 status = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN"
1062
1063 next_ver = uv['version'] if uv['version'] else "N/A"
1064 revision = uv['revision'] if uv['revision'] else "N/A"
1065 maintainer = data.getVar('RECIPE_MAINTAINER')
1066 no_upgrade_reason = data.getVar('RECIPE_NO_UPDATE_REASON')
1067
1068 pkgs_list.append((pn, status, cur_ver, next_ver, maintainer, revision, no_upgrade_reason))
1069
1070 return pkgs_list