[pulseaudio] 01/01: Add upstream patches for config.d

David Henningsson diwic-guest at moszumanska.debian.org
Thu Dec 17 08:57:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

diwic-guest pushed a commit to branch ubuntu
in repository pulseaudio.

commit 8b6ec105ec542991ea5d3f41d865a693d587b8e5
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Thu Dec 17 09:07:17 2015 +0100

    Add upstream patches for config.d
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
 debian/changelog                                   |   2 +
 ...onf-parser-add-support-for-.d-directories.patch | 184 +++++++++++++++++++++
 ...nt-conf-daemon-conf-enable-.d-directories.patch | 127 ++++++++++++++
 debian/patches/series                              |   4 +
 4 files changed, 317 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 83f6f19..0abb266 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
 pulseaudio (1:7.1-1ubuntu3) UNRELEASED; urgency=medium
 
   * trust-store: Update translation string
+  * Cherrypick upstream patches to allow client.conf.d
+    and daemon.conf.d
 
  -- David Henningsson <david.henningsson at canonical.com>  Mon, 30 Nov 2015 16:43:53 +0100
 
diff --git a/debian/patches/0101-conf-parser-add-support-for-.d-directories.patch b/debian/patches/0101-conf-parser-add-support-for-.d-directories.patch
new file mode 100644
index 0000000..d3bb73e
--- /dev/null
+++ b/debian/patches/0101-conf-parser-add-support-for-.d-directories.patch
@@ -0,0 +1,184 @@
+From 1d7ce901398b4e65bfac991aa7a351ac15c4910e Mon Sep 17 00:00:00 2001
+From: Tanu Kaskinen <tanuk at iki.fi>
+Date: Mon, 7 Dec 2015 23:22:41 +0200
+Subject: [PATCH 2/2] conf-parser: add support for .d directories
+
+This allows a configuration scheme where after loading configuration
+from "somefile", the parser loads configuration from files in
+directory "somefile.d". This feature needs to be enabled on a per-file
+basis, though, and this patch doesn't yet enable the feature for any
+files.
+---
+ src/daemon/daemon-conf.c                |  2 +-
+ src/modules/alsa/alsa-mixer.c           |  4 ++--
+ src/modules/module-augment-properties.c |  2 +-
+ src/pulse/client-conf.c                 |  2 +-
+ src/pulsecore/conf-parser.c             | 42 +++++++++++++++++++++++++++++++--
+ src/pulsecore/conf-parser.h             |  8 ++++++-
+ 6 files changed, 52 insertions(+), 8 deletions(-)
+
+diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
+index f94cdeb..306c8cb 100644
+--- a/src/daemon/daemon-conf.c
++++ b/src/daemon/daemon-conf.c
+@@ -617,7 +617,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
+     ci.default_channel_map_set = ci.default_sample_spec_set = false;
+     ci.conf = c;
+ 
+-    r = f ? pa_config_parse(c->config_file, f, table, NULL, NULL) : 0;
++    r = f ? pa_config_parse(c->config_file, f, table, NULL, false, NULL) : 0;
+ 
+     if (r >= 0) {
+ 
+diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
+index 515b285..1fe2a02 100644
+--- a/src/modules/alsa/alsa-mixer.c
++++ b/src/modules/alsa/alsa-mixer.c
+@@ -2594,7 +2594,7 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa
+ 
+     fn = pa_maybe_prefix_path(fname, paths_dir);
+ 
+-    r = pa_config_parse(fn, NULL, items, p->proplist, p);
++    r = pa_config_parse(fn, NULL, items, p->proplist, false, p);
+     pa_xfree(fn);
+ 
+     if (r < 0)
+@@ -4411,7 +4411,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel
+                               pa_run_from_build_tree() ? PA_SRCDIR "/modules/alsa/mixer/profile-sets/" :
+                               PA_ALSA_PROFILE_SETS_DIR);
+ 
+-    r = pa_config_parse(fn, NULL, items, NULL, ps);
++    r = pa_config_parse(fn, NULL, items, NULL, false, ps);
+     pa_xfree(fn);
+ 
+     if (r < 0)
+diff --git a/src/modules/module-augment-properties.c b/src/modules/module-augment-properties.c
+index 42b6fd9..541f0e7 100644
+--- a/src/modules/module-augment-properties.c
++++ b/src/modules/module-augment-properties.c
+@@ -204,7 +204,7 @@ static void update_rule(struct rule *r) {
+     table[0].data = &r->application_name;
+     table[1].data = &r->icon_name;
+ 
+-    if (pa_config_parse(fn, NULL, table, NULL, r) < 0)
++    if (pa_config_parse(fn, NULL, table, NULL, false, r) < 0)
+         pa_log_warn("Failed to parse .desktop file %s.", fn);
+ 
+     pa_xfree(fn);
+diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
+index 47fe183..c2ece90 100644
+--- a/src/pulse/client-conf.c
++++ b/src/pulse/client-conf.c
+@@ -149,7 +149,7 @@ void pa_client_conf_load(pa_client_conf *c, bool load_from_x11, bool load_from_e
+ 
+     f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn);
+     if (f) {
+-        pa_config_parse(fn, f, table, NULL, NULL);
++        pa_config_parse(fn, f, table, NULL, false, NULL);
+         pa_xfree(fn);
+         fclose(f);
+     }
+diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
+index 2dcd45a..60345ad 100644
+--- a/src/pulsecore/conf-parser.c
++++ b/src/pulsecore/conf-parser.c
+@@ -21,6 +21,7 @@
+ #include <config.h>
+ #endif
+ 
++#include <dirent.h>
+ #include <string.h>
+ #include <stdio.h>
+ #include <errno.h>
+@@ -103,7 +104,7 @@ static int parse_line(pa_config_parser_state *state) {
+             }
+         }
+ 
+-        r = pa_config_parse(fn, NULL, state->item_table, state->proplist, state->userdata);
++        r = pa_config_parse(fn, NULL, state->item_table, state->proplist, false, state->userdata);
+         pa_xfree(path);
+         return r;
+     }
+@@ -152,8 +153,13 @@ static int parse_line(pa_config_parser_state *state) {
+         return normal_assignment(state);
+ }
+ 
++static int conf_filter(const struct dirent *entry) {
++    return pa_endswith(entry->d_name, ".conf");
++}
++
+ /* Go through the file and parse each line */
+-int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, void *userdata) {
++int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, bool use_dot_d,
++                    void *userdata) {
+     int r = -1;
+     bool do_close = !f;
+     pa_config_parser_state state;
+@@ -211,6 +217,38 @@ finish:
+     if (do_close && f)
+         fclose(f);
+ 
++    if (use_dot_d) {
++        char *dir_name;
++        int n;
++        struct dirent **entries = NULL;
++
++        dir_name = pa_sprintf_malloc("%s.d", filename);
++
++        n = scandir(dir_name, &entries, conf_filter, alphasort);
++        if (n >= 0) {
++            int i;
++
++            for (i = 0; i < n; i++) {
++                char *filename2;
++
++                filename2 = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", dir_name, entries[i]->d_name);
++                pa_config_parse(filename2, NULL, t, proplist, false, userdata);
++                pa_xfree(filename2);
++
++                free(entries[i]);
++            }
++
++            free(entries);
++        } else {
++            if (errno == ENOENT)
++                pa_log_debug("%s does not exist, ignoring.", dir_name);
++            else
++                pa_log_warn("scandir(\"%s\") failed: %s", dir_name, pa_cstrerror(errno));
++        }
++
++        pa_xfree(dir_name);
++    }
++
+     return r;
+ }
+ 
+diff --git a/src/pulsecore/conf-parser.h b/src/pulsecore/conf-parser.h
+index dbb6f5c..7dc0ff9 100644
+--- a/src/pulsecore/conf-parser.h
++++ b/src/pulsecore/conf-parser.h
+@@ -59,6 +59,11 @@ struct pa_config_parser_state {
+  * pa_config_items in *t that is terminated by an item where lvalue is
+  * NULL.
+  *
++ * If use_dot_d is true, then after parsing the file named by the filename
++ * argument, the function will parse all files ending with ".conf" in
++ * alphabetical order from a directory whose name is filename + ".d", if such
++ * directory exists.
++ *
+  * Some configuration files may contain a Properties section, which
+  * is a bit special. Normally all accepted lvalues must be predefined
+  * in the pa_config_item table, but in the Properties section the
+@@ -68,7 +73,8 @@ struct pa_config_parser_state {
+  * properties, and those properties will be merged into the given
+  * proplist. If proplist is NULL, then sections named "Properties"
+  * are not allowed at all in the configuration file. */
+-int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, void *userdata);
++int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, bool use_dot_d,
++                    void *userdata);
+ 
+ /* Generic parsers for integers, size_t, booleans and strings */
+ int pa_config_parse_int(pa_config_parser_state *state);
+-- 
+2.6.4
+
diff --git a/debian/patches/0102-client-conf-daemon-conf-enable-.d-directories.patch b/debian/patches/0102-client-conf-daemon-conf-enable-.d-directories.patch
new file mode 100644
index 0000000..5df2848
--- /dev/null
+++ b/debian/patches/0102-client-conf-daemon-conf-enable-.d-directories.patch
@@ -0,0 +1,127 @@
+From 7b9fcc01f62558a6f517e2a23408e98c2688bd9e Mon Sep 17 00:00:00 2001
+From: Tanu Kaskinen <tanuk at iki.fi>
+Date: Mon, 7 Dec 2015 23:22:42 +0200
+Subject: [PATCH] client-conf, daemon-conf: enable .d directories
+
+I want to enable client.conf.d, because in OpenEmbedded-core we have
+a graphical environment called Sato that runs as root. Sato needs to
+set allow-autospawn-for-root=true in client.conf, but the default
+configuration in OpenEmbedded-core should not set that option. With
+this patch, I can create a Sato-specific package that simply installs
+50-sato.conf in /etc/pulse/client.conf.d without conflicting with the
+main client.conf coming from a different package.
+
+daemon.conf.d is enabled just because it would be strange to not
+support it while client.conf.d is supported.
+---
+ man/pulse-client.conf.5.xml.in | 19 +++++++++++++++----
+ man/pulse-daemon.conf.5.xml.in | 25 ++++++++++++++++++-------
+ src/daemon/daemon-conf.c       |  2 +-
+ src/pulse/client-conf.c        |  2 +-
+ 4 files changed, 35 insertions(+), 13 deletions(-)
+
+diff --git a/man/pulse-client.conf.5.xml.in b/man/pulse-client.conf.5.xml.in
+index 1002dbe..cca2219 100644
+--- a/man/pulse-client.conf.5.xml.in
++++ b/man/pulse-client.conf.5.xml.in
+@@ -23,15 +23,26 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+ 
+   <synopsis>
+     <p><file>~/.config/pulse/client.conf</file></p>
+-
++    <p><file>~/.config/pulse/client.conf.d/*.conf</file></p>
+     <p><file>@PA_DEFAULT_CONFIG_DIR@/client.conf</file></p>
++    <p><file>@PA_DEFAULT_CONFIG_DIR@/client.conf.d/*.conf</file></p>
+   </synopsis>
+ 
+   <description>
+     <p>The PulseAudio client library reads configuration directives from
+-    a file <file>~/.config/pulse/client.conf</file> on startup and when that
+-    file doesn't exist from
+-    <file>@PA_DEFAULT_CONFIG_DIR@/client.conf</file>.</p>
++    a configuration file on startup. If the per-user file
++    <file>~/.config/pulse/client.conf</file> exists, it is used, otherwise the
++    system configuration file <file>@PA_DEFAULT_CONFIG_DIR@/client.conf</file>
++    is used. In addition to those main files, configuration directives can also
++    be put in files under directories
++    <file>~/.config/pulse/client.conf.d/</file> and
++    <file>@PA_DEFAULT_CONFIG_DIR@/client.conf.d/</file>. Those files have to
++    have the .conf file name extension, but otherwise the file names can be
++    chosen freely. The files under client.conf.d are processed in alphabetical
++    order. In case the same option is set in multiple files, the last file to
++    set an option overrides earlier files. The main client.conf file is
++    processed first, so options set in files under client.conf.d override the
++    main file.</p>
+ 
+     <p>The configuration file is a simple collection of variable
+     declarations. If the configuration file parser encounters either ;
+diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
+index d221585..0367b1f 100644
+--- a/man/pulse-daemon.conf.5.xml.in
++++ b/man/pulse-daemon.conf.5.xml.in
+@@ -23,18 +23,29 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+ 
+   <synopsis>
+     <p><file>~/.config/pulse/daemon.conf</file></p>
+-
++    <p><file>~/.config/pulse/daemon.conf.d/*.conf</file></p>
+     <p><file>@PA_DEFAULT_CONFIG_DIR@/daemon.conf</file></p>
++    <p><file>@PA_DEFAULT_CONFIG_DIR@/daemon.conf.d/*.conf</file></p>
+   </synopsis>
+ 
+   <description>
+     <p>The PulseAudio sound server reads configuration directives from
+-    a file <file>~/.config/pulse/daemon.conf</file> on startup and when that
+-    file doesn't exist from
+-    <file>@PA_DEFAULT_CONFIG_DIR@/daemon.conf</file>. Please note that the
+-    server also reads a configuration script on startup
+-    <file>default.pa</file> which also contains runtime configuration
+-    directives.</p>
++    a configuration file on startup. If the per-user file
++    <file>~/.config/pulse/daemon.conf</file> exists, it is used, otherwise the
++    system configuration file <file>@PA_DEFAULT_CONFIG_DIR@/daemon.conf</file>
++    is used. In addition to those main files, configuration directives can also
++    be put in files under directories
++    <file>~/.config/pulse/daemon.conf.d/</file> and
++    <file>@PA_DEFAULT_CONFIG_DIR@/daemon.conf.d/</file>. Those files have to
++    have the .conf file name extension, but otherwise the file names can be
++    chosen freely. The files under daemon.conf.d are processed in alphabetical
++    order. In case the same option is set in multiple files, the last file to
++    set an option overrides earlier files. The main daemon.conf file is
++    processed first, so options set in files under daemon.conf.d override the
++    main file.</p>
++
++    <p>Please note that the server also reads a configuration script on
++    startup. See <manref name="default.pa" section="5"/>.</p>
+ 
+     <p>The configuration file is a simple collection of variable
+     declarations. If the configuration file parser encounters either ;
+diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
+index 306c8cb..288aed2 100644
+--- a/src/daemon/daemon-conf.c
++++ b/src/daemon/daemon-conf.c
+@@ -617,7 +617,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
+     ci.default_channel_map_set = ci.default_sample_spec_set = false;
+     ci.conf = c;
+ 
+-    r = f ? pa_config_parse(c->config_file, f, table, NULL, false, NULL) : 0;
++    r = f ? pa_config_parse(c->config_file, f, table, NULL, true, NULL) : 0;
+ 
+     if (r >= 0) {
+ 
+diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
+index c2ece90..c23aa6b 100644
+--- a/src/pulse/client-conf.c
++++ b/src/pulse/client-conf.c
+@@ -149,7 +149,7 @@ void pa_client_conf_load(pa_client_conf *c, bool load_from_x11, bool load_from_e
+ 
+     f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn);
+     if (f) {
+-        pa_config_parse(fn, f, table, NULL, false, NULL);
++        pa_config_parse(fn, f, table, NULL, true, NULL);
+         pa_xfree(fn);
+         fclose(f);
+     }
+-- 
+2.6.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 03a7000..21955b1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,6 +6,10 @@
 0022-inotify-wrapper-Quit-daemon-if-pid-file-is-removed.patch
 0023-fixing_snd_mixer_poll_descriptors_count_when_zero.patch
 
+# Patches cherrypicked from upstream
+0101-conf-parser-add-support-for-.d-directories.patch
+0102-client-conf-daemon-conf-enable-.d-directories.patch
+
 # Ubuntu touch stuff
 0202-dont-probe-ucm.patch
 0203-card-Add-hook-before-profile-changes.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-pulseaudio/pulseaudio.git



More information about the pkg-pulseaudio-devel mailing list