aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/update.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-11-07 11:21:48 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2016-11-07 16:39:38 +1300
commit6ff4ed77b4f6642c96f7b2ed60207948dc017345 (patch)
treeffd7e5dbdc4fd2663d5e78fdb0e1e5830019e15c /layerindex/update.py
parent05f3bccbc600a4b5a22ae356cd9b74537eda143d (diff)
downloadopenembedded-core-contrib-6ff4ed77b4f6642c96f7b2ed60207948dc017345.tar.gz
openembedded-core-contrib-6ff4ed77b4f6642c96f7b2ed60207948dc017345.tar.bz2
openembedded-core-contrib-6ff4ed77b4f6642c96f7b2ed60207948dc017345.zip
update.py: fix last_rev handling
update_layer may create the layerbranch record (e.g. for a new branch) so we should be looking for it after that has been run. Also, we cannot assume that last_rev will get set because a layer might fail to fetch, so take that into account as well. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex/update.py')
-rwxr-xr-xlayerindex/update.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/layerindex/update.py b/layerindex/update.py
index 060810de63..0ac174fe9d 100755
--- a/layerindex/update.py
+++ b/layerindex/update.py
@@ -181,9 +181,6 @@ def main():
repodir = os.path.join(fetchdir, urldir)
branchobj = utils.get_branch(branch)
- layerbranch = layer.get_layerbranch(branch)
- if layerbranch:
- last_rev[layerbranch] = layerbranch.vcs_last_rev
if branchobj.update_environment:
cmdprefix = branchobj.update_environment.get_command()
@@ -204,6 +201,14 @@ def main():
cmd += ' -q'
logger.debug('Running layer update command: %s' % cmd)
ret = run_command_interruptible(cmd)
+
+ # We need to get layerbranch here because it might not have existed until
+ # layer_update.py created it, but it still may not create one (e.g. if subdir
+ # didn't exist) so we still need to check
+ layerbranch = layer.get_layerbranch(branch)
+ if layerbranch:
+ last_rev[layerbranch] = layerbranch.vcs_last_rev
+
if ret == 254:
# Interrupted by user, break out of loop
break
@@ -220,7 +225,10 @@ def main():
layerbranch = layer.get_layerbranch(branch)
# Skip layers that did not change.
- if layerbranch and last_rev[layerbranch] == layerbranch.vcs_last_rev:
+ layer_last_rev = None
+ if layerbranch:
+ layer_last_rev = last_rev.get(layerbranch, None)
+ if layer_last_rev is None or layer_last_rev == layerbranch.vcs_last_rev:
continue
urldir = layer.get_fetch_dir()