aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/update.py
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2018-04-03 16:19:53 +0800
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-04-24 10:12:35 +1200
commitf7e63f1814234dd6f9b92bbabafb8a42319bf82c (patch)
tree535d294d4f690b4ecf10a4a73700e52f4aa75ee5 /layerindex/update.py
parentf4f2146370992fecf668ecce749b9a6c98794402 (diff)
downloadopenembedded-core-contrib-f7e63f1814234dd6f9b92bbabafb8a42319bf82c.tar.gz
openembedded-core-contrib-f7e63f1814234dd6f9b92bbabafb8a42319bf82c.tar.bz2
openembedded-core-contrib-f7e63f1814234dd6f9b92bbabafb8a42319bf82c.zip
update.py: add an option --timeout for lockfile
We have an update.py running periodically in background, but we also need to run it manually, for example, run it to update actual_branch, the manually run usually failed because can't get lockfile, we have to run it again and again. A timeout option helps a lot in such a case. Now the following command can make sure we can run the command successfully: $ update.py -b master -a actual_branch -t 2000 Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex/update.py')
-rwxr-xr-xlayerindex/update.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/layerindex/update.py b/layerindex/update.py
index 07240abfb8..e4ca7b6fd4 100755
--- a/layerindex/update.py
+++ b/layerindex/update.py
@@ -156,6 +156,9 @@ def main():
parser.add_option("-l", "--layer",
help = "Specify layers to update (use commas to separate multiple). Default is all published layers.",
action="store", dest="layers")
+ parser.add_option("-t", "--timeout",
+ help = "Specify timeout in seconds to get layerindex.lock. Default is 30 seconds.",
+ type="int", action="store", dest="timeout", default=30)
parser.add_option("-r", "--reload",
help = "Reload recipe data instead of updating since last update",
action="store_true", dest="reload")
@@ -265,7 +268,7 @@ def main():
update.save()
try:
lockfn = os.path.join(fetchdir, "layerindex.lock")
- lockfile = utils.lock_file(lockfn)
+ lockfile = utils.lock_file(lockfn, options.timeout, logger)
if not lockfile:
logger.error("Layer index lock timeout expired")
sys.exit(1)