aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/update_layer.py
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2017-06-01 00:54:29 -0700
committerPaul Eggleton <paul.eggleton@linux.intel.com>2017-07-21 08:15:53 +0200
commite93eef34bd778fed1c756eb81530d5c4d3581ecd (patch)
treed645de2c2f9441db846d1c6259b6887076b86ae5 /layerindex/update_layer.py
parentf6cb14678bbcdc17161c46ac951cab9d891754e7 (diff)
downloadopenembedded-core-contrib-e93eef34bd778fed1c756eb81530d5c4d3581ecd.tar.gz
update_layer.py: delete layerbranch for non-existent branch
The branch is not needed any more when it has been removed from the repo, so we also need remove its layerbranch, otherwise it still can be got from the web, which causes confusions. Note, we have to move the location of tinfoil's code to avoid creating tinfoil when not needed, otherewise, if tinfoil is created (but not needed), and the program exists earlier before "try ... finally" block, then tinfoil.shutdown() doesn't run so that it is not shutdown. Move the code back, right before where it is needed can fix the problem. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex/update_layer.py')
-rw-r--r--layerindex/update_layer.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index b6c2f4acdb..7f0c08f83f 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -223,21 +223,6 @@ def main():
bitbakepath = os.path.join(fetchdir, 'bitbake')
- 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)
- # 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', '')
-
layer = utils.get_layer(options.layer)
urldir = layer.get_fetch_dir()
repodir = os.path.join(fetchdir, urldir)
@@ -261,12 +246,29 @@ def main():
topcommit = repo.commit('origin/%s' % branchname)
except:
if layerbranch:
- logger.error("Failed update of layer %s - branch %s no longer exists" % (layer.name, branchdesc))
+ logger.info("layer %s - branch %s no longer exists, removing it from database" % (layer.name, branchdesc))
+ if not options.dryrun:
+ layerbranch.delete()
else:
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)
+ # 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', '')
+
+ try:
with transaction.atomic():
newbranch = False
if not layerbranch: