mirror of
https://git.yoctoproject.org/poky-contrib
synced 2025-05-08 23:52:25 +08:00
lib/prservice: Improve lock handling robustness
It is possible we could crash holding a lock whilst parsing in this code. Switch to use utils.fileslocked() in the with expression to avoid this. This may be causing some of our strange intermittent failures in PRServ tests. (From OE-Core rev: 4e59db15e5df2cc3d0ae042454812a2d54cef77b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
cd125f1703
commit
52f41ff243
@ -78,8 +78,7 @@ def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False):
|
||||
bb.utils.mkdirhier(d.getVar('PRSERV_DUMPDIR'))
|
||||
df = d.getVar('PRSERV_DUMPFILE')
|
||||
#write data
|
||||
lf = bb.utils.lockfile("%s.lock" % df)
|
||||
with open(df, "a") as f:
|
||||
with open(df, "a") as f, bb.utils.fileslocked(["%s.lock" % df]) as locks:
|
||||
if metainfo:
|
||||
#dump column info
|
||||
f.write("#PR_core_ver = \"%s\"\n\n" % metainfo['core_ver']);
|
||||
@ -113,7 +112,6 @@ def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False):
|
||||
if not nomax:
|
||||
for i in idx:
|
||||
f.write("PRAUTO_%s_%s = \"%s\"\n" % (str(datainfo[idx[i]]['version']),str(datainfo[idx[i]]['pkgarch']),str(datainfo[idx[i]]['value'])))
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
def prserv_check_avail(d):
|
||||
host_params = list([_f for _f in (d.getVar("PRSERV_HOST") or '').split(':') if _f])
|
||||
|
Loading…
x
Reference in New Issue
Block a user