From 8bd3253381b951e1d1223004191fc1ff36674b9dd7aa63578301e15282a15d84 Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Sun, 17 Jun 2018 17:36:59 +0000 Subject: [PATCH] - Update to version 0.1.12. - Rewrite /usr/bin/apulse. OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/apulse?expand=0&rev=21 --- apulse | 9 --------- apulse-0.1.10.tar.gz | 3 --- apulse-0.1.12.tar.gz | 3 +++ apulse-fix-pulse-12.patch | 16 +++++++++++++++ apulse-link-math.patch | 13 ------------- apulse.changes | 21 ++++++++++++++++++++ apulse.conf | 8 ++++++-- apulse.py | 31 +++++++++++++++++++++++++++++ apulse.spec | 41 +++++++++++++++++++++++---------------- 9 files changed, 101 insertions(+), 44 deletions(-) delete mode 100644 apulse delete mode 100644 apulse-0.1.10.tar.gz create mode 100644 apulse-0.1.12.tar.gz create mode 100644 apulse-fix-pulse-12.patch delete mode 100644 apulse-link-math.patch create mode 100644 apulse.py diff --git a/apulse b/apulse deleted file mode 100644 index 4b72bdd..0000000 --- a/apulse +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -[ -f '/etc/apulse.conf' -a -r '/etc/apulse.conf' ] && . '/etc/apulse.conf'; -[ -f $HOME'/.apulse.conf' -a -r $HOME'/.apulse.conf' ] && . $HOME'/.apulse.conf'; - -APULSE_CAPTURE_DEVICE=${APULSE_CAPTURE_DEVICE:='plughw:0,0'}; -APULSE_PLAYBACK_DEVICE=${APULSE_PLAYBACK_DEVICE:='default'}; - -LD_LIBRARY_PATH='/usr/$LIB/apulse'${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} APULSE_CAPTURE_DEVICE="$APULSE_CAPTURE_DEVICE" APULSE_PLAYBACK_DEVICE="$APULSE_PLAYBACK_DEVICE" "$@"; diff --git a/apulse-0.1.10.tar.gz b/apulse-0.1.10.tar.gz deleted file mode 100644 index 82b24bf..0000000 --- a/apulse-0.1.10.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4f8aa9059d07bac1006e920a4a6b875ad63fdde973b83c138507812c00dd5cd6 -size 110272 diff --git a/apulse-0.1.12.tar.gz b/apulse-0.1.12.tar.gz new file mode 100644 index 0000000..e9bd429 --- /dev/null +++ b/apulse-0.1.12.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfcadfe971abd785ed3ca24e576fcbaade185525c1eda76daf32dbf298e52892 +size 117220 diff --git a/apulse-fix-pulse-12.patch b/apulse-fix-pulse-12.patch new file mode 100644 index 0000000..38ffa7d --- /dev/null +++ b/apulse-fix-pulse-12.patch @@ -0,0 +1,16 @@ +--- a/src/apulse-volume.c ++++ b/src/apulse-volume.c +@@ -282,8 +282,13 @@ pa_cvolume_scale(pa_cvolume *v, pa_volum + + APULSE_EXPORT + pa_cvolume * ++#if PA_CHECK_VERSION(11, 99, 0) ++pa_cvolume_scale_mask(pa_cvolume *v, pa_volume_t max, const pa_channel_map *cm, ++ pa_channel_position_mask_t mask) ++#else + pa_cvolume_scale_mask(pa_cvolume *v, pa_volume_t max, pa_channel_map *cm, + pa_channel_position_mask_t mask) ++#endif + { + trace_info_z("Z %s\n", __func__); + return NULL; diff --git a/apulse-link-math.patch b/apulse-link-math.patch deleted file mode 100644 index 06c5638..0000000 --- a/apulse-link-math.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -60,8 +60,8 @@ set_target_properties(pulse-simple PROPE - - set(SYMBOLMAP "-Wl,-version-script=\"${CMAKE_SOURCE_DIR}/src/symbolmap\"") - --target_link_libraries(pulse ${SYMBOLMAP} trace-helper ${REQ_LIBRARIES}) --target_link_libraries(pulse-simple ${SYMBOLMAP} trace-helper ${REQ_LIBRARIES}) -+target_link_libraries(pulse ${SYMBOLMAP} trace-helper m ${REQ_LIBRARIES}) -+target_link_libraries(pulse-simple ${SYMBOLMAP} trace-helper m ${REQ_LIBRARIES}) - target_link_libraries(pulsecommon-5.0 ${SYMBOLMAP} trace-helper ${REQ_LIBRARIES}) - - add_subdirectory(tests) diff --git a/apulse.changes b/apulse.changes index 3ed2b23..b7f0910 100644 --- a/apulse.changes +++ b/apulse.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Sat Jun 16 15:48:41 UTC 2018 - sor.alexei@meowr.ru + +- Update to version 0.1.12 (changes since 0.1.10): + * Implement new, free, and write functions of the pa_simple_* + family. + * Add some documentation about issues related to sandboxing. + * Drop the libpulsecommon-5.0.so binary. + * Add stub functions for the mainloop-glib interface. + * add a man- page. + * Cosmetic code changes. + * Misc compatibility fixes. +- Add apulse-fix-pulse-12.patch sor.alexei@meowr.ru: Fix + PulseAudio 12+ compatibility. +- Remove apulse-link-math.patch. +- Use %cmake_install. +- Rewrite the apulse script in Python 3 to avoid insecure config + reading from home. The apulse.conf format was changed, and the + user config also was moved from ~/.apulse.conf to + $XDG_CONFIG_HOME/apulse.conf. + ------------------------------------------------------------------- Fri Mar 12 17:50:15 UTC 2018 - ilya@ilya.pp.ua diff --git a/apulse.conf b/apulse.conf index 48ce580..91091b8 100644 --- a/apulse.conf +++ b/apulse.conf @@ -1,2 +1,6 @@ -APULSE_CAPTURE_DEVICE=${APULSE_CAPTURE_DEVICE:='plughw:0,0'}; -APULSE_PLAYBACK_DEVICE=${APULSE_PLAYBACK_DEVICE:='default'}; +# This file is part of the apulse package. +# +# User-specific configuration can go to ~/.config/apulse.conf + +; playback-device = default +capture-device = plughw:0,0 diff --git a/apulse.py b/apulse.py new file mode 100644 index 0000000..bda7025 --- /dev/null +++ b/apulse.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +import configparser +import itertools +import os +import sys + +xdg_config_home = os.environ.get("XDG_CONFIG_HOME", + os.path.expanduser("~/.config")) +proc_env = os.environ +conf_parser = configparser.SafeConfigParser() + +for conf_file in ("/etc/apulse.conf", + os.path.join(xdg_config_home, "apulse.conf")): + if os.access(conf_file, os.R_OK): + with open(conf_file, "r") as conf: + conf = itertools.chain(("[0]",), conf) + conf_parser.read_file(conf) + +playback_device = conf_parser.get("0", "playback-device", fallback="default") +capture_device = conf_parser.get("0", "capture-device", fallback="default") + +if "APULSE_PLAYBACK_DEVICE" not in proc_env: + proc_env["APULSE_PLAYBACK_DEVICE"] = playback_device +if "APULSE_CAPTURE_DEVICE" not in proc_env: + proc_env["APULSE_CAPTURE_DEVICE"] = capture_device + +ld_libpath = os.environ.get("LD_LIBRARY_PATH", "") +proc_env["LD_LIBRARY_PATH"] = "/usr/$LIB/apulse" + \ + (":" if ld_libpath else "") + ld_libpath + +os.execvpe(sys.argv[1], sys.argv[1:], proc_env) diff --git a/apulse.spec b/apulse.spec index 157a751..9cb149b 100644 --- a/apulse.spec +++ b/apulse.spec @@ -12,12 +12,13 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via https://bugs.opensuse.org +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # + %define __provides_exclude_from ^%{_libdir}/apulse/.*.so.*$ Name: apulse -Version: 0.1.10 +Version: 0.1.12 Release: 0 Summary: PulseAudio emulation for ALSA License: MIT @@ -25,10 +26,10 @@ Group: System/Libraries URL: https://github.com/i-rinat/apulse Source0: https://github.com/i-rinat/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: baselibs.conf -Source2: %{name}.conf -Source3: %{name} -# PATCH-FIX-OPENSUSE apulse-link-math.patch sor.alexei@meowr.ru -- Link with -lm to fix building. -Patch0: apulse-link-math.patch +Source2: %{name}.py +Source3: %{name}.conf +# PATCH-FIX-OPENSUSE apulse-fix-pulse-12.patch sor.alexei@meowr.ru -- Fix PulseAudio 12+ compatibility. +Patch0: apulse-fix-pulse-12.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkgconfig @@ -40,34 +41,40 @@ Recommends: %{name}-32bit = %{version} %endif %description -PulseAudio emulation intended to be used with Skype and Firefox +PulseAudio emulation intended to be used with Firefox and Skype. %prep %setup -q %patch0 -p1 %build -%cmake -LA -DUSE_BUNDLED_PULSEAUDIO_HEADERS=OFF -DAPULSEPATH=%{_libdir}/%{name} -make %{?_smp_mflags} +%cmake \ + -DUSE_BUNDLED_PULSEAUDIO_HEADERS=OFF \ + -DAPULSEPATH=%{_libdir}/%{name} \ + -DCMAKE_SHARED_LINKER_FLAGS="" -LA +make %{?_smp_mflags} V=1 %install -mkdir -p %{buildroot}%{_libdir}/%{name} -install -m644 build/libpulse*.so.* %{buildroot}%{_libdir}/%{name} -mkdir %{buildroot}%{_sysconfdir} -install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir} -mkdir %{buildroot}%{_bindir} -install %{SOURCE3} %{buildroot}%{_bindir} +%cmake_install +rm %{buildroot}%{_libdir}/%{name}/libpulse*.so +install -Dpm 0755 %{SOURCE2} %{buildroot}%{_bindir}/%{name} +install -Dpm 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/%{name}.conf %post -p /sbin/ldconfig + %postun -p /sbin/ldconfig %files -%defattr(0644,root,root,-) +%if 0%{?suse_version} >= 1500 %license LICENSE.MIT +%else +%doc LICENSE.MIT +%endif %doc README.md %config(noreplace) %{_sysconfdir}/%{name}.conf -%attr(0755,root,root) %{_bindir}/%{name} +%{_bindir}/%{name} %dir %{_libdir}/%{name} %{_libdir}/%{name}/libpulse*.so.* +%{_mandir}/man1/apulse.1%{?ext_man} %changelog