]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: monitordisk: fire event DISKFULL when terminate build
authorKang Kai <kai.kang@windriver.com>
Fri, 27 Jul 2012 08:38:02 +0000 (16:38 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 2 Aug 2012 14:28:39 +0000 (15:28 +0100)
Part of [Yocto #2168]

Add a event DiskFull to descript the termination by disk monitor.

Update check() to fire the event DiskFull when terminates the build.
This could help UIs to deal this scenario and show more information to
end user.

(Bitbake rev: 0a0fca3d94a1db6458ae21501a66461a334410ed)

Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/event.py
bitbake/lib/bb/monitordisk.py

index 1116c0a7bf623b5fe88b81113efd4738c1b4f904..20923b5f082962e620e3dcf76af417e3360ef5ba 100644 (file)
@@ -312,6 +312,14 @@ class BuildCompleted(BuildBase, OperationCompleted):
             OperationCompleted.__init__(self, total, "Building Failed")
         BuildBase.__init__(self, n, p, failures)
 
+class DiskFull(Event):
+    """Disk full case build aborted"""
+    def __init__(self, dev, type, freespace, mountpoint):
+        Event.__init__(self)
+        self._dev = dev
+        self._type = type
+        self._free = freespace
+        self._mountpoint = mountpoint
 
 class NoProvider(Event):
     """No Provider for an Event"""
index 946919396b57545fef3fcea3a58257dc9c3ac4ce..2bd488123e9275a24dccf0a0b5b822eae87fcd47 100644 (file)
@@ -176,6 +176,7 @@ class diskMonitor:
     def __init__(self, configuration):
 
         self.enableMonitor = False
+        self.configuration = configuration
 
         BBDirs = configuration.getVar("BB_DISKMON_DIRS", True) or None
         if BBDirs:
@@ -219,10 +220,12 @@ class diskMonitor:
                         logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(False)
+                        bb.event.fire(bb.event.DiskFull(dev, 'disk', freeSpace, self.devDict[dev][1]), self.configuration)
                     elif self.devDict[dev][0] == "ABORT" and not self.checked[dev]:
                         logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(True)
+                        bb.event.fire(bb.event.DiskFull(dev, 'disk', freeSpace, self.devDict[dev][1]), self.configuration)
 
                 # The free inodes, float point number
                 freeInode = st.f_favail
@@ -237,8 +240,10 @@ class diskMonitor:
                         logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(False)
+                        bb.event.fire(bb.event.DiskFull(dev, 'inode', freeSpace, self.devDict[dev][1]), self.configuration)
                     elif self.devDict[dev][0]  == "ABORT" and not self.checked[dev]:
                         logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(True)
+                        bb.event.fire(bb.event.DiskFull(dev, 'inode', freeSpace, self.devDict[dev][1]), self.configuration)
         return