summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/pyinotify.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/pyinotify.py')
-rw-r--r--bitbake/lib/pyinotify.py44
1 files changed, 12 insertions, 32 deletions
diff --git a/bitbake/lib/pyinotify.py b/bitbake/lib/pyinotify.py
index 6ae40a2d76..3c5dab0312 100644
--- a/bitbake/lib/pyinotify.py
+++ b/bitbake/lib/pyinotify.py
@@ -52,7 +52,6 @@ from collections import deque
from datetime import datetime, timedelta
import time
import re
-import asyncore
import glob
import locale
import subprocess
@@ -596,14 +595,24 @@ class _ProcessEvent:
@type event: Event object
@return: By convention when used from the ProcessEvent class:
- Returning False or None (default value) means keep on
- executing next chained functors (see chain.py example).
+ executing next chained functors (see chain.py example).
- Returning True instead means do not execute next
processing functions.
@rtype: bool
@raise ProcessEventError: Event object undispatchable,
unknown event.
"""
- stripped_mask = event.mask - (event.mask & IN_ISDIR)
+ stripped_mask = event.mask & ~IN_ISDIR
+ # Bitbake hack - we see event masks of 0x6, i.e., IN_MODIFY & IN_ATTRIB.
+ # The kernel inotify code can set more than one of the bits in the mask,
+ # fsnotify_change() in linux/fsnotify.h is quite clear that IN_ATTRIB,
+ # IN_MODIFY and IN_ACCESS can arrive together.
+ # This breaks the code below which assume only one mask bit is ever
+ # set in an event. We don't care about attrib or access in bitbake so
+ # drop those.
+ if stripped_mask & IN_MODIFY:
+ stripped_mask &= ~(IN_ATTRIB | IN_ACCESS)
+
maskname = EventsCodes.ALL_VALUES.get(stripped_mask)
if maskname is None:
raise ProcessEventError("Unknown mask 0x%08x" % stripped_mask)
@@ -1475,35 +1484,6 @@ class ThreadedNotifier(threading.Thread, Notifier):
self.loop()
-class AsyncNotifier(asyncore.file_dispatcher, Notifier):
- """
- This notifier inherits from asyncore.file_dispatcher in order to be able to
- use pyinotify along with the asyncore framework.
-
- """
- def __init__(self, watch_manager, default_proc_fun=None, read_freq=0,
- threshold=0, timeout=None, channel_map=None):
- """
- Initializes the async notifier. The only additional parameter is
- 'channel_map' which is the optional asyncore private map. See
- Notifier class for the meaning of the others parameters.
-
- """
- Notifier.__init__(self, watch_manager, default_proc_fun, read_freq,
- threshold, timeout)
- asyncore.file_dispatcher.__init__(self, self._fd, channel_map)
-
- def handle_read(self):
- """
- When asyncore tells us we can read from the fd, we proceed processing
- events. This method can be overridden for handling a notification
- differently.
-
- """
- self.read_events()
- self.process_events()
-
-
class TornadoAsyncNotifier(Notifier):
"""
Tornado ioloop adapter.