summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
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-21 16:51:06 +0100
commit9034b2c57b7e52f4437e4e6ab13e96bf26e7fa88 (patch)
tree401d38f44d2644cbd9fbc8c3be2187db35681b68 /bitbake/lib/bb
parent0704bbdaeb404561a8fbdd9c00730f2b016d5511 (diff)
downloadpoky-9034b2c57b7e52f4437e4e6ab13e96bf26e7fa88.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: 021e0eda63bd629af56b5e1c380c5f98868f7332) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-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 bdd9112510..d254bd2797 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1894,25 +1894,25 @@ class CookerCollectFiles(object):
1894 return origlistdir(d) 1894 return origlistdir(d)
1895 1895
1896 os.listdir = ourlistdir 1896 os.listdir = ourlistdir
1897 1897 try:
1898 # Can't use set here as order is important 1898 # Can't use set here as order is important
1899 newfiles = [] 1899 newfiles = []
1900 for f in files: 1900 for f in files:
1901 if os.path.isdir(f): 1901 if os.path.isdir(f):
1902 dirfiles = self.find_bbfiles(f) 1902 dirfiles = self.find_bbfiles(f)
1903 for g in dirfiles: 1903 for g in dirfiles:
1904 if g not in newfiles: 1904 if g not in newfiles:
1905 newfiles.append(g) 1905 newfiles.append(g)
1906 else: 1906 else:
1907 globbed = glob.glob(f) 1907 globbed = glob.glob(f)
1908 if not globbed and os.path.exists(f): 1908 if not globbed and os.path.exists(f):
1909 globbed = [f] 1909 globbed = [f]
1910 # glob gives files in order on disk. Sort to be deterministic. 1910 # glob gives files in order on disk. Sort to be deterministic.
1911 for g in sorted(globbed): 1911 for g in sorted(globbed):
1912 if g not in newfiles: 1912 if g not in newfiles:
1913 newfiles.append(g) 1913 newfiles.append(g)
1914 1914 finally:
1915 os.listdir = origlistdir 1915 os.listdir = origlistdir
1916 1916
1917 bbmask = config.getVar('BBMASK') 1917 bbmask = config.getVar('BBMASK')
1918 1918