summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-09-14 16:09:42 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-17 23:23:21 +0100
commit56005ab7c12545ce23f6c3b3ab4315fc7b5e2697 (patch)
tree87025f5ba07bdc132d017421a07b63ef6385536e /bitbake
parenta9b1aaced19bdafe5e3fb33cf455555d30b1a3ab (diff)
downloadpoky-56005ab7c12545ce23f6c3b3ab4315fc7b5e2697.tar.gz
bitbake: cooker: ensure monkey-patching in collect_bbfiles() gets undone on error
In collect_bbfiles() we're monkey-patching os.listdir in order to find which directories to watch, and then undoing that when we're finished - however if an exception occurred for any reason there was nothing to ensure the latter occurred. This may not have caused any issues, but as this kind of thing really ought to be secured using try...finally just in case, so do that. (Bitbake rev: 013047484a03185c0ce281c53c1db4949cdc4e69) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 6de04fcba6..73a2fef287 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1695,25 +1695,25 @@ class CookerCollectFiles(object):
1695 return origlistdir(d) 1695 return origlistdir(d)
1696 1696
1697 os.listdir = ourlistdir 1697 os.listdir = ourlistdir
1698 1698 try:
1699 # Can't use set here as order is important 1699 # Can't use set here as order is important
1700 newfiles = [] 1700 newfiles = []
1701 for f in files: 1701 for f in files:
1702 if os.path.isdir(f): 1702 if os.path.isdir(f):
1703 dirfiles = self.find_bbfiles(f) 1703 dirfiles = self.find_bbfiles(f)
1704 for g in dirfiles: 1704 for g in dirfiles:
1705 if g not in newfiles: 1705 if g not in newfiles:
1706 newfiles.append(g) 1706 newfiles.append(g)
1707 else: 1707 else:
1708 globbed = glob.glob(f) 1708 globbed = glob.glob(f)
1709 if not globbed and os.path.exists(f): 1709 if not globbed and os.path.exists(f):
1710 globbed = [f] 1710 globbed = [f]
1711 # glob gives files in order on disk. Sort to be deterministic. 1711 # glob gives files in order on disk. Sort to be deterministic.
1712 for g in sorted(globbed): 1712 for g in sorted(globbed):
1713 if g not in newfiles: 1713 if g not in newfiles:
1714 newfiles.append(g) 1714 newfiles.append(g)
1715 1715 finally:
1716 os.listdir = origlistdir 1716 os.listdir = origlistdir
1717 1717
1718 bbmask = config.getVar('BBMASK') 1718 bbmask = config.getVar('BBMASK')
1719 1719