summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-11-29 17:47:44 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 10:42:22 +0000
commit091ebb8665c2e7be784cacf363b687e0af70000f (patch)
treec2c07ca7eab5de280d41563863152384de88ae54 /bitbake
parentad20ee9febb6bb9beca084b72e21aaddda24bcb9 (diff)
downloadpoky-091ebb8665c2e7be784cacf363b687e0af70000f.tar.gz
bitbake: monitordisk.py: minor code and comment cleanup
There's no need to encode and decode the hash key as a single string, a tuple works just fine. Iterating over entries can be written more concisely. Entries in the stat results are integers, not floating point values. (Bitbake rev: 3c943e989964382c0b819d92de26a0c914ebed33) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/monitordisk.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/bitbake/lib/bb/monitordisk.py b/bitbake/lib/bb/monitordisk.py
index dff57ad878..d3d2106841 100644
--- a/bitbake/lib/bb/monitordisk.py
+++ b/bitbake/lib/bb/monitordisk.py
@@ -129,7 +129,7 @@ def getDiskData(BBDirs, configuration):
129 bb.utils.mkdirhier(path) 129 bb.utils.mkdirhier(path)
130 dev = getMountedDev(path) 130 dev = getMountedDev(path)
131 # Use path/action as the key 131 # Use path/action as the key
132 devDict[os.path.join(path, action)] = [dev, minSpace, minInode] 132 devDict[(path, action)] = [dev, minSpace, minInode]
133 133
134 return devDict 134 return devDict
135 135
@@ -205,16 +205,13 @@ class diskMonitor:
205 """ Take action for the monitor """ 205 """ Take action for the monitor """
206 206
207 if self.enableMonitor: 207 if self.enableMonitor:
208 for k in self.devDict: 208 for k, attributes in self.devDict.items():
209 path = os.path.dirname(k) 209 path, action = k
210 action = os.path.basename(k) 210 dev, minSpace, minInode = attributes
211 dev = self.devDict[k][0]
212 minSpace = self.devDict[k][1]
213 minInode = self.devDict[k][2]
214 211
215 st = os.statvfs(path) 212 st = os.statvfs(path)
216 213
217 # The free space, float point number 214 # The available free space, integer number
218 freeSpace = st.f_bavail * st.f_frsize 215 freeSpace = st.f_bavail * st.f_frsize
219 216
220 if minSpace and freeSpace < minSpace: 217 if minSpace and freeSpace < minSpace:
@@ -235,7 +232,7 @@ class diskMonitor:
235 rq.finish_runqueue(True) 232 rq.finish_runqueue(True)
236 bb.event.fire(bb.event.DiskFull(dev, 'disk', freeSpace, path), self.configuration) 233 bb.event.fire(bb.event.DiskFull(dev, 'disk', freeSpace, path), self.configuration)
237 234
238 # The free inodes, float point number 235 # The free inodes, integer number
239 freeInode = st.f_favail 236 freeInode = st.f_favail
240 237
241 if minInode and freeInode < minInode: 238 if minInode and freeInode < minInode: