From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 09/10] lib/oe/reciputils.py: parallelize upstream version checks
Date: Wed, 23 Jan 2019 17:17:43 +0100 [thread overview]
Message-ID: <20190123161744.45763-9-alex.kanavin@gmail.com> (raw)
In-Reply-To: <20190123161744.45763-1-alex.kanavin@gmail.com>
Previously this was done via bitbake tasks, and when this
was rewritten to a for loop, performance sufered significantly:
from 90 seconds to about 12 minutes for oe-core. This change
restores the previous run time, and makes it possible
to perform such checks with command line utilities in an
interactive way.
Implementation note: we have to create a copy of the recipe
data, as Tinfoil API can't be used from multiple threads
and only allows one process to access the data at a time.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
meta/lib/oe/recipeutils.py | 77 +++++++++++++++++++++++++++-----------
1 file changed, 56 insertions(+), 21 deletions(-)
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 39d3de4bb1f..92c0f65257f 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -1020,8 +1020,54 @@ def get_recipe_upstream_version(rd):
return ru
+def _get_recipe_upgrade_status(data):
+ uv = 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"
+
+ next_ver = uv['version'] if uv['version'] else "N/A"
+ revision = uv['revision'] if uv['revision'] else "N/A"
+ maintainer = data.getVar('RECIPE_MAINTAINER')
+ no_upgrade_reason = data.getVar('RECIPE_NO_UPDATE_REASON')
+
+ return (pn, status, cur_ver, next_ver, maintainer, revision, no_upgrade_reason)
+
def get_recipe_upgrade_status(recipes=None):
pkgs_list = []
+ data_copy_list = []
+ copy_vars = ('SRC_URI',
+ 'PV',
+ 'GITDIR',
+ 'DL_DIR',
+ 'PN',
+ 'CACHE',
+ 'PERSISTENT_DIR',
+ 'BB_URI_HEADREVS',
+ 'UPSTREAM_CHECK_COMMITS',
+ 'UPSTREAM_CHECK_GITTAGREGEX',
+ 'UPSTREAM_CHECK_REGEX',
+ 'UPSTREAM_CHECK_URI',
+ 'UPSTREAM_VERSION_UNKNOWN',
+ 'RECIPE_MAINTAINER',
+ 'RECIPE_NO_UPDATE_REASON',
+ 'RECIPE_UPSTREAM_VERSION',
+ 'RECIPE_UPSTREAM_DATE',
+ 'CHECK_DATE',
+ )
+
with bb.tinfoil.Tinfoil() as tinfoil:
tinfoil.prepare(config_only=False)
@@ -1043,28 +1089,17 @@ def get_recipe_upgrade_status(recipes=None):
bb.note(" Skip package %s as upstream check unreliable" % pn)
continue
- uv = 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"
+ data_copy = bb.data.init()
+ for var in copy_vars:
+ data_copy.setVar(var, data.getVar(var))
+ for k in data:
+ if k.startswith('SRCREV'):
+ data_copy.setVar(k, data.getVar(k))
- next_ver = uv['version'] if uv['version'] else "N/A"
- revision = uv['revision'] if uv['revision'] else "N/A"
- maintainer = data.getVar('RECIPE_MAINTAINER')
- no_upgrade_reason = data.getVar('RECIPE_NO_UPDATE_REASON')
+ data_copy_list.append(data_copy)
- pkgs_list.append((pn, status, cur_ver, next_ver, maintainer, revision, no_upgrade_reason))
+ from concurrent.futures import ProcessPoolExecutor
+ with ProcessPoolExecutor(max_workers=utils.cpu_count()) as executor:
+ pkgs_list = executor.map(_get_recipe_upgrade_status, data_copy_list)
return pkgs_list
--
2.17.1
next prev parent reply other threads:[~2019-01-23 16:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 16:17 [PATCH 01/10] sstate.bbclass: make sure changes to SSTATE_SCAN_FILES are not ignored Alexander Kanavin
2019-01-23 16:17 ` [PATCH 02/10] fontcache: fix postinst for nativesdk case Alexander Kanavin
2019-01-23 16:17 ` [PATCH 03/10] qemuwrapper-cross: check qemu usermode only when building a target package Alexander Kanavin
2019-01-23 16:17 ` [PATCH 04/10] lib/oe/package_manager: turn postinst_intercept warnings into failures for nativesdk Alexander Kanavin
2019-01-24 22:43 ` Richard Purdie
2019-01-24 23:18 ` Joshua Watt
2019-01-25 12:13 ` Alexander Kanavin
2019-01-25 15:37 ` Joshua Watt
2019-01-25 15:38 ` Richard Purdie
2019-01-25 16:10 ` Alexander Kanavin
2019-01-25 16:33 ` Joshua Watt
2019-01-25 17:21 ` Alexander Kanavin
2019-01-23 16:17 ` [PATCH 05/10] cmake: do not look into native sysroot in the nativesdk environment Alexander Kanavin
2019-01-23 16:17 ` [PATCH 06/10] testimage.bbclass: add support for passing runqemu params Alexander Kanavin
2019-01-23 16:17 ` [PATCH 07/10] kmscube: update to latest commit, switch over to meson Alexander Kanavin
2019-01-23 16:17 ` [PATCH 08/10] kmscube: make gstreamer dependency optional Alexander Kanavin
2019-01-23 16:17 ` Alexander Kanavin [this message]
2019-01-23 16:17 ` [PATCH 10/10] devtool: add a command to print an overall list of recipes that can be updated Alexander Kanavin
2019-01-23 23:31 ` akuster808
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190123161744.45763-9-alex.kanavin@gmail.com \
--to=alex.kanavin@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox