[arch-commits] Commit in dbus-core/trunk (PKGBUILD monitor-service-directories.patch)

Jan de Groot jgc at archlinux.org
Sun Mar 7 15:10:46 UTC 2010


    Date: Sunday, March 7, 2010 @ 10:10:46
  Author: jgc
Revision: 71488

upgpkg: dbus-core 1.2.20-1
Update to 1.2.20, add patch to monitor service directories for changes

Added:
  dbus-core/trunk/monitor-service-directories.patch
Modified:
  dbus-core/trunk/PKGBUILD

-----------------------------------+
 PKGBUILD                          |    7 +
 monitor-service-directories.patch |  135 ++++++++++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+), 2 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2010-03-07 13:43:05 UTC (rev 71487)
+++ PKGBUILD	2010-03-07 15:10:46 UTC (rev 71488)
@@ -3,7 +3,7 @@
 # Contributor: Link Dupont <link at subpop.net>
 #
 pkgname=dbus-core
-pkgver=1.2.16
+pkgver=1.2.20
 pkgrel=1
 pkgdesc="Freedesktop.org message bus system"
 url="http://www.freedesktop.org/Software/dbus"
@@ -14,12 +14,15 @@
 options=(!libtool)
 install=dbus.install
 source=(http://dbus.freedesktop.org/releases/dbus/dbus-${pkgver}.tar.gz
+        monitor-service-directories.patch
         dbus)
-md5sums=('c7a47b851ebe02f6726b65b78d1b730b'
+md5sums=('63f4e2412f6599a5e7b10281b9ddc0ac'
+         'c2dc3e91f4bb819a992b178419f21fb3'
          '08f93dd19cffd1b45ab05c1fd4efb560')
 
 build() {
   cd "${srcdir}/dbus-${pkgver}"
+  patch -Np1 -i "${srcdir}/monitor-service-directories.patch" || return 1
   ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
       --libexecdir=/usr/lib/dbus-1.0 --with-dbus-user=81 \
       --with-system-pid-file=/var/run/dbus.pid \

Added: monitor-service-directories.patch
===================================================================
--- monitor-service-directories.patch	                        (rev 0)
+++ monitor-service-directories.patch	2010-03-07 15:10:46 UTC (rev 71488)
@@ -0,0 +1,135 @@
+From 9c90fcd2dc4b1b7d818a35ef43d4686052902f59 Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters at verbum.org>
+Date: Thu, 18 Feb 2010 20:33:28 +0000
+Subject: Monitor service directories for changes
+
+It's not expected to have to manually SIGHUP the bus after installing
+a new .service file.  Since our directory monitoring is already set
+up to queue a full reload which includes service activation, simply
+monitor the servicedirs too.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=23846
+---
+diff --git a/bus/bus.c b/bus/bus.c
+index 8150df2..6495ae7 100644
+--- a/bus/bus.c
++++ b/bus/bus.c
+@@ -529,11 +529,39 @@ process_config_every_time (BusContext      *context,
+ }
+ 
+ static dbus_bool_t
++list_concat_new (DBusList **a,
++                 DBusList **b,
++                 DBusList **result)
++{
++  DBusList *link;
++
++  *result = NULL;
++
++  link = _dbus_list_get_first_link (a);
++  for (link = _dbus_list_get_first_link (a); link; link = _dbus_list_get_next_link (a, link))
++    {
++      if (!_dbus_list_append (result, link->data))
++        goto oom;
++    }
++  for (link = _dbus_list_get_first_link (b); link; link = _dbus_list_get_next_link (b, link))
++    {
++      if (!_dbus_list_append (result, link->data))
++        goto oom;
++    }
++
++  return TRUE;
++oom:
++  _dbus_list_clear (result);
++  return FALSE;
++}
++
++static dbus_bool_t
+ process_config_postinit (BusContext      *context,
+ 			 BusConfigParser *parser,
+ 			 DBusError       *error)
+ {
+   DBusHashTable *service_context_table;
++  DBusList *watched_dirs = NULL;
+ 
+   service_context_table = bus_config_parser_steal_service_context_table (parser);
+   if (!bus_registry_set_service_context_table (context->registry,
+@@ -545,8 +573,20 @@ process_config_postinit (BusContext      *context,
+ 
+   _dbus_hash_table_unref (service_context_table);
+ 
+-  /* Watch all conf directories */
+-  bus_set_watched_dirs (context, bus_config_parser_get_conf_dirs (parser));
++  /* We need to monitor both the configuration directories and directories
++   * containing .service files.
++   */
++  if (!list_concat_new (bus_config_parser_get_conf_dirs (parser),
++                        bus_config_parser_get_service_dirs (parser),
++                        &watched_dirs))
++    {
++      BUS_SET_OOM (error);
++      return FALSE;
++    }
++
++  bus_set_watched_dirs (context, &watched_dirs);
++
++  _dbus_list_clear (&watched_dirs);
+ 
+   return TRUE;
+ }
+diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c
+index bb71394..c98e6fc 100644
+--- a/bus/dir-watch-inotify.c
++++ b/bus/dir-watch-inotify.c
+@@ -156,8 +156,18 @@ _set_watched_dirs_internal (DBusList **directories)
+           wd = inotify_add_watch (inotify_fd, new_dirs[i], IN_CLOSE_WRITE | IN_DELETE | IN_MOVED_TO | IN_MOVED_FROM);
+           if (wd < 0)
+             {
+-              _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
+-              goto out;
++              /* Not all service directories need to exist. */
++              if (errno != ENOENT)
++                {
++                  _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
++                  goto out;
++                }
++              else
++                {
++                  new_wds[i] = -1;
++                  new_dirs[i] = NULL;
++                  continue;
++                }
+             }
+           new_wds[i] = wd;
+           new_dirs[i] = _dbus_strdup (new_dirs[i]);
+diff --git a/bus/dir-watch-kqueue.c b/bus/dir-watch-kqueue.c
+index e7b0e2c..4a01b74 100644
+--- a/bus/dir-watch-kqueue.c
++++ b/bus/dir-watch-kqueue.c
+@@ -204,11 +204,20 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories)
+ 	   * we may need to sleep.
+ 	   */
+           fd = open (new_dirs[i], O_RDONLY);
+-	  if (fd < 0)
++          if (fd < 0)
+             {
+-              _dbus_warn ("Cannot open directory '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
+-	      goto out;
+-	    }
++              if (errno != ENOENT)
++                {
++                  _dbus_warn ("Cannot open directory '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
++                  goto out;
++                }
++              else
++                {
++                  new_fds[i] = -1;
++                  new_dirs[i] = NULL;
++                  continue;
++                }
++            }
+ 
+           EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
+                   NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME, 0, 0);
+--
+cgit v0.8.3-6-g21f6




More information about the arch-commits mailing list