aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/bulkchange.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-07-27 21:55:50 +0100
committerPaul Eggleton <paul.eggleton@linux.intel.com>2013-09-05 00:31:23 +0100
commit1eebd6e5252401578b638d3ac541547a9471c0eb (patch)
treeb51a97d283014b822a0db139f3278e4c5b2804c3 /layerindex/bulkchange.py
parent1643aef67d828ff7ca47f63409f23852f8e75e83 (diff)
downloadopenembedded-core-contrib-1eebd6e5252401578b638d3ac541547a9471c0eb.tar.gz
Implement locking for update/bulkchange process
Avoid the possibility of these two clashing especially when multiple branches are being used. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex/bulkchange.py')
-rw-r--r--layerindex/bulkchange.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/layerindex/bulkchange.py b/layerindex/bulkchange.py
index 561f49c00e..ed36859c30 100644
--- a/layerindex/bulkchange.py
+++ b/layerindex/bulkchange.py
@@ -215,14 +215,23 @@ def main():
fetchdir = settings.LAYER_FETCH_DIR
bitbakepath = os.path.join(fetchdir, 'bitbake')
- (tinfoil, tempdir) = recipeparse.init_parser(settings, branch, bitbakepath, True)
-
- changeset = get_changeset(sys.argv[1])
- if not changeset:
- sys.stderr.write("Unable to find changeset with id %s\n" % sys.argv[1])
+ lockfn = os.path.join(fetchdir, "layerindex.lock")
+ lockfile = utils.lock_file(lockfn)
+ if not lockfile:
+ sys.stderr.write("Layer index lock timeout expired\n")
sys.exit(1)
+ try:
+ (tinfoil, tempdir) = recipeparse.init_parser(settings, branch, bitbakepath, True)
+
+ changeset = get_changeset(sys.argv[1])
+ if not changeset:
+ sys.stderr.write("Unable to find changeset with id %s\n" % sys.argv[1])
+ sys.exit(1)
+
+ outp = generate_patches(tinfoil, fetchdir, changeset, sys.argv[2])
+ finally:
+ utils.unlock_file(lockfile)
- outp = generate_patches(tinfoil, fetchdir, changeset, sys.argv[2])
if outp:
print outp
else: