diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2018-12-12 10:43:54 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-11 10:39:09 +0000 |
commit | 5ddda07850a1381cf55faf8436f9ce816829293c (patch) | |
tree | a747484d5579ce79a74ea4990804810583cd964f | |
parent | 0f0c16071d7290c2fc698cfec6417a8b13f0e697 (diff) | |
download | poky-5ddda07850a1381cf55faf8436f9ce816829293c.tar.gz |
pulseaudio: improve reproducibility
There are two fixes, one is sent to upstream,
and another is oe specific.
[YOCTO #12638]
(From OE-Core rev: 81e3d7bdafc9a8af8d0618a852fc67e938f5d18e)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
4 files changed, 196 insertions, 2 deletions
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio.inc b/meta/recipes-multimedia/pulseaudio/pulseaudio.inc index f526690390..91d9b8ef83 100644 --- a/meta/recipes-multimedia/pulseaudio/pulseaudio.inc +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio.inc | |||
@@ -76,8 +76,9 @@ EXTRA_OECONF = "\ | |||
76 | --with-database=simple \ | 76 | --with-database=simple \ |
77 | --without-zsh-completion-dir \ | 77 | --without-zsh-completion-dir \ |
78 | --with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d \ | 78 | --with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d \ |
79 | ac_cv_header_valgrind_memcheck_h=no \ | 79 | ac_cv_header_valgrind_memcheck_h=no \ |
80 | --disable-tests \ | 80 | --disable-tests \ |
81 | --disable-running-from-build-tree \ | ||
81 | " | 82 | " |
82 | 83 | ||
83 | # soxr (the SoX Resampler library) doesn't seem to be currently packaged in | 84 | # soxr (the SoX Resampler library) doesn't seem to be currently packaged in |
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-introduce-a-special-build-flag-to-explicitly-disable.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-introduce-a-special-build-flag-to-explicitly-disable.patch new file mode 100644 index 0000000000..b7e9cd8c5c --- /dev/null +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-introduce-a-special-build-flag-to-explicitly-disable.patch | |||
@@ -0,0 +1,161 @@ | |||
1 | From 36feb98e568221e24286615730888d5f6ff323f0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Fri, 7 Dec 2018 15:12:38 +0800 | ||
4 | Subject: [PATCH] introduce a special build flag to explicitly disables running | ||
5 | from build tree | ||
6 | |||
7 | It is helpful to improve reproducibility build [1] since | ||
8 | PA_SRCDIR/PA_BUILDDIR contains build path, disable running | ||
9 | from build tree could drop these macros at precompilation. | ||
10 | |||
11 | [1] https://reproducible-builds.org/ | ||
12 | |||
13 | Upstream-Status: Submitted [pulseaudio-discuss@lists.freedesktop.org] | ||
14 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
15 | Acked-by: Tanu Kaskinen <tanuk@iki.fi> | ||
16 | --- | ||
17 | configure.ac | 10 ++++++++++ | ||
18 | src/daemon/daemon-conf.c | 4 +++- | ||
19 | src/daemon/main.c | 6 ++++++ | ||
20 | src/modules/alsa/alsa-mixer.c | 4 ++++ | ||
21 | src/modules/gconf/module-gconf.c | 2 +- | ||
22 | src/modules/gsettings/module-gsettings.c | 2 +- | ||
23 | src/pulsecore/core-util.c | 4 +++- | ||
24 | 7 files changed, 28 insertions(+), 4 deletions(-) | ||
25 | |||
26 | diff --git a/configure.ac b/configure.ac | ||
27 | index c9c414f..8b345ef 100644 | ||
28 | --- a/configure.ac | ||
29 | +++ b/configure.ac | ||
30 | @@ -998,6 +998,16 @@ AS_IF([test "x$enable_asyncns" = "xyes" && test "x$HAVE_LIBASYNCNS" = "x0"], | ||
31 | AM_CONDITIONAL([HAVE_LIBASYNCNS], [test "x$HAVE_LIBASYNCNS" = x1]) | ||
32 | AS_IF([test "x$HAVE_LIBASYNCNS" = "x1"], AC_DEFINE([HAVE_LIBASYNCNS], 1, [Have libasyncns?])) | ||
33 | |||
34 | +#### Running from build tree (optional) #### | ||
35 | + | ||
36 | +AC_ARG_ENABLE([running-from-build-tree], | ||
37 | + AS_HELP_STRING([--disable-running-from-build-tree],[Disable running from build tree])) | ||
38 | + | ||
39 | +AS_IF([test "x$enable_running_from_build_tree" != "xno"], | ||
40 | + AC_DEFINE([HAVE_RUNNING_FROM_BUILD_TREE], 1, [Have running from build tree])) | ||
41 | + | ||
42 | +AC_SUBST(HAVE_RUNNING_FROM_BUILD_TREE) | ||
43 | + | ||
44 | #### TCP wrappers (optional) #### | ||
45 | |||
46 | AC_ARG_ENABLE([tcpwrap], | ||
47 | diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c | ||
48 | index 9883126..f01eff4 100644 | ||
49 | --- a/src/daemon/daemon-conf.c | ||
50 | +++ b/src/daemon/daemon-conf.c | ||
51 | @@ -155,12 +155,14 @@ pa_daemon_conf *pa_daemon_conf_new(void) { | ||
52 | c->dl_search_path = pa_sprintf_malloc("%s" PA_PATH_SEP "lib" PA_PATH_SEP "pulse-%d.%d" PA_PATH_SEP "modules", | ||
53 | pa_win32_get_toplevel(NULL), PA_MAJOR, PA_MINOR); | ||
54 | #else | ||
55 | +#ifdef HAVE_RUNNING_FROM_BUILD_TREE | ||
56 | if (pa_run_from_build_tree()) { | ||
57 | pa_log_notice("Detected that we are run from the build tree, fixing search path."); | ||
58 | c->dl_search_path = pa_xstrdup(PA_BUILDDIR); | ||
59 | } else | ||
60 | - c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH); | ||
61 | #endif | ||
62 | + c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH); | ||
63 | +#endif //Endof #ifdef OS_IS_WIN32 | ||
64 | |||
65 | return c; | ||
66 | } | ||
67 | diff --git a/src/daemon/main.c b/src/daemon/main.c | ||
68 | index c80fa94..1e00388 100644 | ||
69 | --- a/src/daemon/main.c | ||
70 | +++ b/src/daemon/main.c | ||
71 | @@ -932,6 +932,12 @@ int main(int argc, char *argv[]) { | ||
72 | |||
73 | pa_log_debug("Running in VM: %s", pa_yes_no(pa_running_in_vm())); | ||
74 | |||
75 | +#ifdef HAVE_RUNNING_FROM_BUILD_TREE | ||
76 | + pa_log_debug("Running from build tree: %s", pa_yes_no(pa_run_from_build_tree())); | ||
77 | +#else | ||
78 | + pa_log_debug("Running from build tree: no"); | ||
79 | +#endif | ||
80 | + | ||
81 | #ifdef __OPTIMIZE__ | ||
82 | pa_log_debug("Optimized build: yes"); | ||
83 | #else | ||
84 | diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c | ||
85 | index a524d6d..670f646 100644 | ||
86 | --- a/src/modules/alsa/alsa-mixer.c | ||
87 | +++ b/src/modules/alsa/alsa-mixer.c | ||
88 | @@ -2571,9 +2571,11 @@ static int path_verify(pa_alsa_path *p) { | ||
89 | } | ||
90 | |||
91 | static const char *get_default_paths_dir(void) { | ||
92 | +#ifdef HAVE_RUNNING_FROM_BUILD_TREE | ||
93 | if (pa_run_from_build_tree()) | ||
94 | return PA_SRCDIR "/modules/alsa/mixer/paths/"; | ||
95 | else | ||
96 | +#endif | ||
97 | return PA_ALSA_PATHS_DIR; | ||
98 | } | ||
99 | |||
100 | @@ -4455,7 +4457,9 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel | ||
101 | fname = "default.conf"; | ||
102 | |||
103 | fn = pa_maybe_prefix_path(fname, | ||
104 | +#ifdef HAVE_RUNNING_FROM_BUILD_TREE | ||
105 | pa_run_from_build_tree() ? PA_SRCDIR "/modules/alsa/mixer/profile-sets/" : | ||
106 | +#endif | ||
107 | PA_ALSA_PROFILE_SETS_DIR); | ||
108 | |||
109 | r = pa_config_parse(fn, NULL, items, NULL, false, ps); | ||
110 | diff --git a/src/modules/gconf/module-gconf.c b/src/modules/gconf/module-gconf.c | ||
111 | index c0f4dde..76a1f19 100644 | ||
112 | --- a/src/modules/gconf/module-gconf.c | ||
113 | +++ b/src/modules/gconf/module-gconf.c | ||
114 | @@ -51,7 +51,7 @@ int pa__init(pa_module*m) { | ||
115 | u->buf_fill = 0; | ||
116 | |||
117 | if ((u->fd = pa_start_child_for_read( | ||
118 | -#if defined(__linux__) && !defined(__OPTIMIZE__) | ||
119 | +#if defined(__linux__) && defined(HAVE_RUNNING_FROM_BUILD_TREE) | ||
120 | pa_run_from_build_tree() ? PA_BUILDDIR "/gconf-helper" : | ||
121 | #endif | ||
122 | PA_GCONF_HELPER, NULL, &u->pid)) < 0) | ||
123 | diff --git a/src/modules/gsettings/module-gsettings.c b/src/modules/gsettings/module-gsettings.c | ||
124 | index 330eca1..209c857 100644 | ||
125 | --- a/src/modules/gsettings/module-gsettings.c | ||
126 | +++ b/src/modules/gsettings/module-gsettings.c | ||
127 | @@ -51,7 +51,7 @@ int pa__init(pa_module*m) { | ||
128 | u->buf_fill = 0; | ||
129 | |||
130 | if ((u->fd = pa_start_child_for_read( | ||
131 | -#if defined(__linux__) && !defined(__OPTIMIZE__) | ||
132 | +#if defined(__linux__) && defined(HAVE_RUNNING_FROM_BUILD_TREE) | ||
133 | pa_run_from_build_tree() ? PA_BUILDDIR "/gsettings-helper" : | ||
134 | #endif | ||
135 | PA_GSETTINGS_HELPER, NULL, &u->pid)) < 0) | ||
136 | diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c | ||
137 | index 64e9f21..f85dd20 100644 | ||
138 | --- a/src/pulsecore/core-util.c | ||
139 | +++ b/src/pulsecore/core-util.c | ||
140 | @@ -3436,15 +3436,17 @@ void pa_reset_personality(void) { | ||
141 | } | ||
142 | |||
143 | bool pa_run_from_build_tree(void) { | ||
144 | - char *rp; | ||
145 | static bool b = false; | ||
146 | |||
147 | +#ifdef HAVE_RUNNING_FROM_BUILD_TREE | ||
148 | + char *rp; | ||
149 | PA_ONCE_BEGIN { | ||
150 | if ((rp = pa_readlink("/proc/self/exe"))) { | ||
151 | b = pa_startswith(rp, PA_BUILDDIR); | ||
152 | pa_xfree(rp); | ||
153 | } | ||
154 | } PA_ONCE_END; | ||
155 | +#endif | ||
156 | |||
157 | return b; | ||
158 | } | ||
159 | -- | ||
160 | 2.7.4 | ||
161 | |||
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0002-do-not-display-CLFAGS-to-improve-reproducibility-bui.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0002-do-not-display-CLFAGS-to-improve-reproducibility-bui.patch new file mode 100644 index 0000000000..43add75db4 --- /dev/null +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/0002-do-not-display-CLFAGS-to-improve-reproducibility-bui.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From f0ddd7c36556ad05c1398fdd132947323ad26473 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 6 Dec 2018 11:43:41 +0800 | ||
4 | Subject: [PATCH 2/2] do not display CLFAGS to improve reproducibility build | ||
5 | |||
6 | Macro PA_CFLAGS contains build path, do not use it to | ||
7 | display CFLAGS which could improve reproducibility build. | ||
8 | |||
9 | Upstream-Status: Inappropriate [oe specific] | ||
10 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
11 | --- | ||
12 | src/daemon/main.c | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/src/daemon/main.c b/src/daemon/main.c | ||
16 | index c80fa94..75496be 100644 | ||
17 | --- a/src/daemon/main.c | ||
18 | +++ b/src/daemon/main.c | ||
19 | @@ -908,7 +908,7 @@ int main(int argc, char *argv[]) { | ||
20 | |||
21 | pa_log_info("This is PulseAudio %s", PACKAGE_VERSION); | ||
22 | pa_log_debug("Compilation host: %s", CANONICAL_HOST); | ||
23 | - pa_log_debug("Compilation CFLAGS: %s", PA_CFLAGS); | ||
24 | + pa_log_debug("Compilation CFLAGS: ***"); | ||
25 | |||
26 | #ifdef HAVE_LIBSAMPLERATE | ||
27 | pa_log_warn("Compiled with DEPRECATED libsamplerate support!"); | ||
28 | -- | ||
29 | 2.7.4 | ||
30 | |||
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio_12.2.bb b/meta/recipes-multimedia/pulseaudio/pulseaudio_12.2.bb index 36d92bcae9..c020fbd4f6 100644 --- a/meta/recipes-multimedia/pulseaudio/pulseaudio_12.2.bb +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio_12.2.bb | |||
@@ -2,6 +2,8 @@ require pulseaudio.inc | |||
2 | 2 | ||
3 | SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \ | 3 | SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \ |
4 | file://0001-client-conf-Add-allow-autospawn-for-root.patch \ | 4 | file://0001-client-conf-Add-allow-autospawn-for-root.patch \ |
5 | file://0001-introduce-a-special-build-flag-to-explicitly-disable.patch \ | ||
6 | file://0002-do-not-display-CLFAGS-to-improve-reproducibility-bui.patch \ | ||
5 | file://volatiles.04_pulse \ | 7 | file://volatiles.04_pulse \ |
6 | " | 8 | " |
7 | SRC_URI[md5sum] = "c42f1f1465e8df9859d023dc184734bf" | 9 | SRC_URI[md5sum] = "c42f1f1465e8df9859d023dc184734bf" |