diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2018-01-02 16:50:25 +0800 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2018-02-05 10:58:37 +1300 |
commit | d27abc10baa91f274c47458ccb3dfcd8ff068a41 (patch) | |
tree | 1291febc1791b1b024b78aad3ed4e1900d160de5 /layerindex | |
parent | 6bf6794169e500d3cfb79f2862f344f576049501 (diff) | |
download | openembedded-core-contrib-d27abc10baa91f274c47458ccb3dfcd8ff068a41.tar.gz |
update_layer.py: only call init_parser when needed
tinfoil is not needed in cases like the layer is already up-to-date or the
layer is invalid, so only init it when needed.
This can save about 1min when run "update.py -b <branch>" (124 layers).
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex')
-rw-r--r-- | layerindex/update_layer.py | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py index 42e4da93fc..60a1f2e528 100644 --- a/layerindex/update_layer.py +++ b/layerindex/update_layer.py @@ -301,22 +301,8 @@ def main(): logger.info("Skipping update of layer %s - branch %s doesn't exist" % (layer.name, branchdesc)) sys.exit(1) - try: - (tinfoil, tempdir) = recipeparse.init_parser(settings, branch, bitbakepath, nocheckout=options.nocheckout, logger=logger) - except recipeparse.RecipeParseError as e: - logger.error(str(e)) - sys.exit(1) - logger.debug('Using temp directory %s' % tempdir) - # Clear the default value of SUMMARY so that we can use DESCRIPTION instead if it hasn't been set - tinfoil.config_data.setVar('SUMMARY', '') - # Clear the default value of DESCRIPTION so that we can see where it's not set - tinfoil.config_data.setVar('DESCRIPTION', '') - # Clear the default value of HOMEPAGE ('unknown') - tinfoil.config_data.setVar('HOMEPAGE', '') - # Set a blank value for LICENSE so that it doesn't cause the parser to die (e.g. with meta-ti - - # why won't they just fix that?!) - tinfoil.config_data.setVar('LICENSE', '') - + tinfoil = None + tempdir = None try: with transaction.atomic(): newbranch = False @@ -380,6 +366,21 @@ def main(): sys.exit(1) logger.info("Collecting data for layer %s on branch %s" % (layer.name, branchdesc)) + try: + (tinfoil, tempdir) = recipeparse.init_parser(settings, branch, bitbakepath, nocheckout=options.nocheckout, logger=logger) + except recipeparse.RecipeParseError as e: + logger.error(str(e)) + sys.exit(1) + logger.debug('Using temp directory %s' % tempdir) + # Clear the default value of SUMMARY so that we can use DESCRIPTION instead if it hasn't been set + tinfoil.config_data.setVar('SUMMARY', '') + # Clear the default value of DESCRIPTION so that we can see where it's not set + tinfoil.config_data.setVar('DESCRIPTION', '') + # Clear the default value of HOMEPAGE ('unknown') + tinfoil.config_data.setVar('HOMEPAGE', '') + # Set a blank value for LICENSE so that it doesn't cause the parser to die (e.g. with meta-ti - + # why won't they just fix that?!) + tinfoil.config_data.setVar('LICENSE', '') layerconfparser = layerconfparse.LayerConfParse(logger=logger, tinfoil=tinfoil) layer_config_data = layerconfparser.parse_layer(layerdir) @@ -748,14 +749,15 @@ def main(): import traceback traceback.print_exc() finally: - if LooseVersion(bb.__version__) > LooseVersion("1.27"): + if tinfoil and (LooseVersion(bb.__version__) > LooseVersion("1.27")): tinfoil.shutdown() - if options.keep_temp: - logger.debug('Preserving temp directory %s' % tempdir) - else: - logger.debug('Deleting temp directory') - shutil.rmtree(tempdir) + if tempdir: + if options.keep_temp: + logger.debug('Preserving temp directory %s' % tempdir) + else: + logger.debug('Deleting temp directory') + shutil.rmtree(tempdir) sys.exit(0) |