commit:     9d2c7e21b776f68866e045407c10e6b1133b189f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 19 22:49:00 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 19 22:50:11 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d2c7e21

sys-apps/xdg-desktop-portal: avoid gstreamer harder for now

gstreamer is searched for unconditionally, but we don't have gstreamer-pbutils
packaged yet, so that's a problem. Make it conditional for now (as it ought
to be upstream either way if they're going to have an option for it).

Noticed the upstream bug link and got the patch (tweaked style slightly
after) from flint2's PR at https://github.com/gentoo/gentoo/pull/41133.

Closes: https://bugs.gentoo.org/951609
Closes: https://bugs.gentoo.org/951611
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-desktop-portal-1.20.0-optional-gstreamer.patch | 104 +++++++++++++++++++++
 ...rtal-1.20.0-sandbox-disable-failing-tests.patch |   7 +-
 .../xdg-desktop-portal-1.20.0.ebuild               |   3 +
 3 files changed, 111 insertions(+), 3 deletions(-)

diff --git 
a/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.20.0-optional-gstreamer.patch
 
b/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.20.0-optional-gstreamer.patch
new file mode 100644
index 000000000000..e89844a8345f
--- /dev/null
+++ 
b/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.20.0-optional-gstreamer.patch
@@ -0,0 +1,104 @@
+https://bugs.gentoo.org/951611
+https://bugs.gentoo.org/951609
+https://github.com/flatpak/xdg-desktop-portal/issues/1650
+https://github.com/flint2/gentoo/blob/7c8a4b4deb84826f20a7c8af1a0f125cd4942b4a/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.20.0-disable-gstreamer.patch
+
+gstreamer is searched for unconditionally, but we don't have gstreamer-pbutils
+packaged yet, so that's a problem. Make it conditional for now (as it ought
+to be upstream either way if they're going to have an option for it).
+--- a/meson.build
++++ b/meson.build
+@@ -112,7 +112,7 @@ gio_unix_dep = dependency('gio-unix-2.0')
+ json_glib_dep = dependency('json-glib-1.0')
+ fuse3_dep = dependency('fuse3', version: '>= 3.10.0')
+ gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0')
+-gst_pbutils_dep = dependency('gstreamer-pbutils-1.0')
++gst_pbutils_dep = dependency('gstreamer-pbutils-1.0', required: 
get_option('sandboxed-sound-validation'))
+ geoclue_dep = dependency(
+   'libgeoclue-2.0',
+   version: '>= 2.5.2',
+@@ -122,8 +122,8 @@ pipewire_dep = dependency('libpipewire-0.3', version: '>= 
0.2.90')
+ libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))
+ gudev_dep = dependency('gudev-1.0', required: get_option('gudev'))
+ umockdev_dep = dependency('umockdev-1.0', required: get_option('tests'))
+-
+-gst_inspect = find_program('gst-inspect-1.0', required: false)
++gst_inspect = find_program('gst-inspect-1.0', required: 
get_option('sandboxed-sound-validation'))
++have_gst_inspect = gst_inspect.found()
+ if gst_inspect.found()
+   have_wav_parse = run_command(
+     gst_inspect, 'wavparse', '--exists',
+@@ -132,6 +132,7 @@ if gst_inspect.found()
+ else
+   have_wav_parse = false
+ endif
++
+ if have_wav_parse
+   config_h.set('HAVE_WAV_PARSE', 1)
+ endif
+@@ -224,7 +225,7 @@ enable_tests = get_option('tests') \
+   .require(python.found() and 
python.language_version().version_compare('>=3.9'),
+            error_message: 'Python version >=3.9 is required') \
+   .require(umockdev_dep.found()) \
+-  .require(have_wav_parse,
++  .require(not have_wav_parse and not 
get_option('sandboxed-sound-validation').allowed(),
+            error_message: 'gst-inspect and the wavparse plugins are 
required') \
+   .allowed()
+ 
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -206,14 +206,16 @@ if bwrap.found()
+   validate_sound_c_args += '-DHELPER="@0@"'.format(bwrap.full_path())
+ endif
+ 
+-xdp_validate_sound = executable(
+-  'xdg-desktop-portal-validate-sound',
+-  'validate-sound.c',
+-  dependencies: [gst_pbutils_dep],
+-  c_args: validate_sound_c_args,
+-  install: true,
+-  install_dir: libexecdir,
+-)
++if gst_inspect.found()
++  xdp_validate_sound = executable(
++    'xdg-desktop-portal-validate-sound',
++    'validate-sound.c',
++    dependencies: [gst_pbutils_dep],
++    c_args: validate_sound_c_args,
++    install: true,
++    install_dir: libexecdir,
++  )
++endif
+ 
+ configure_file(
+   input: 'xdg-desktop-portal-rewrite-launchers.service.in',
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -94,7 +94,6 @@ pytest_files = [
+   'test_inhibit.py',
+   'test_inputcapture.py',
+   'test_location.py',
+-  'test_notification.py',
+   'test_openuri.py',
+   'test_permission_store.py',
+   'test_print.py',
+@@ -122,7 +121,6 @@ template_files = [
+   'templates/__init__.py',
+   'templates/inputcapture.py',
+   'templates/lockdown.py',
+-  'templates/notification.py',
+   'templates/print.py',
+   'templates/remotedesktop.py',
+   'templates/screenshot.py',
+@@ -131,6 +129,11 @@ template_files = [
+   'templates/wallpaper.py',
+ ]
+ 
++if have_gst_inspect
++  template_files += ['templates/notification.py']
++  pytest_files += ['test_notification.py']
++endif
++
+ foreach pytest_file : pytest_files
+   testname = pytest_file.replace('.py', '').replace('test_', '')
+   test(

diff --git 
a/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.20.0-sandbox-disable-failing-tests.patch
 
b/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.20.0-sandbox-disable-failing-tests.patch
index 2faee17533cb..42162dafc571 100644
--- 
a/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.20.0-sandbox-disable-failing-tests.patch
+++ 
b/sys-apps/xdg-desktop-portal/files/xdg-desktop-portal-1.20.0-sandbox-disable-failing-tests.patch
@@ -1,6 +1,8 @@
+diff --git a/tests/meson.build b/tests/meson.build
+index 377d48a..8a6ebe0 100644
 --- a/tests/meson.build
 +++ b/tests/meson.build
-@@ -87,14 +87,11 @@ pytest_files = [
+@@ -87,13 +87,11 @@ pytest_files = [
    'test_clipboard.py',
    'test_documents.py',
    'test_document_fuse.py',
@@ -11,11 +13,10 @@
    'test_inhibit.py',
    'test_inputcapture.py',
 -  'test_location.py',
--  'test_notification.py',
    'test_openuri.py',
    'test_permission_store.py',
    'test_print.py',
-@@ -188,4 +185,4 @@ if enable_installed_tests
+@@ -191,4 +189,4 @@ if enable_installed_tests
        install_dir: installed_tests_data_dir,
      )
    endforeach

diff --git a/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.20.0.ebuild 
b/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.20.0.ebuild
index dbffadc6d97c..90a013fc9354 100644
--- a/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.20.0.ebuild
+++ b/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.20.0.ebuild
@@ -54,6 +54,8 @@ BDEPEND="
 "
 
 PATCHES=(
+       # Needed until gstreamer-rs (for gstreamer-pbutils) is packaged
+       "${FILESDIR}/${PN}-1.20.0-optional-gstreamer.patch"
        # These tests require connections to pipewire, internet, /dev/fuse
        "${FILESDIR}/${PN}-1.20.0-sandbox-disable-failing-tests.patch"
 )
@@ -79,6 +81,7 @@ src_configure() {
                # Needs gstreamer-pbutils (part of gstreamer-rs)?
                # Not yet packaged
                #$(meson_feature seccomp sandboxed-sound-validation)
+               -Dsandboxed-sound-validation=disabled
                $(meson_feature systemd)
                # Requires flatpak
                -Ddocumentation=disabled

Reply via email to