Skip to contentSkip to conversation

gsettings: allow the schemas to be in any package

PATCH New Ross Burton 1 participant 3 messages Jan 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 gsettings: allow the schemas to be in any package

Instead of assuming that the schemas are located in ${PN}, add a GSETTINGS_PACKAGE variable for the package name and default it to ${PN}.

For recipe that can conditionally ship schemas, support GSETTINGS_PACKAGE being empty gracefully by doing nothing.

---
 meta/classes/gsettings.bbclass | 48 +++++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 22 deletions(-)
meta/classes/gsettings.bbclass +26 -22
index eae3dc7999f..47cf00102ec 100644
@@ -7,32 +7,36 @@
 
 # TODO use a trigger so that this runs once per package operation run
 
-
-RDEPENDS_${PN} += "glib-2.0-utils"
-
-FILES_${PN} += "${datadir}/glib-2.0/schemas"
-
-PACKAGE_WRITE_DEPS += "glib-2.0-native"
+GSETTINGS_PACKAGE ?= "${PN}"
+
+python __anonymous() {
+    pkg = d.getVar("GSETTINGS_PACKAGE")
+    if pkg:
+        d.appendVar("PACKAGE_WRITE_DEPS", " glib-2.0-native")
+        d.appendVar("RDEPENDS_" + pkg, " glib-2.0-utils")
+        d.appendVar("FILES_" + pkg, " ${datadir}/glib-2.0/schemas")
+}
 
 gsettings_postinstrm () {
 	glib-compile-schemas $D${datadir}/glib-2.0/schemas
 }
 
 python populate_packages_append () {
-    pkg = d.getVar('PN')
-    bb.note("adding gsettings postinst scripts to %s" % pkg)
-
-    postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst')
-    if not postinst:
-        postinst = '#!/bin/sh\n'
-    postinst += d.getVar('gsettings_postinstrm')
-    d.setVar('pkg_postinst_%s' % pkg, postinst)
-
-    bb.note("adding gsettings postrm scripts to %s" % pkg)
-
-    postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm')
-    if not postrm:
-        postrm = '#!/bin/sh\n'
-    postrm += d.getVar('gsettings_postinstrm')
-    d.setVar('pkg_postrm_%s' % pkg, postrm)
+    pkg = d.getVar('GSETTINGS_PACKAGE')
+    if pkg:
+        bb.note("adding gsettings postinst scripts to %s" % pkg)
+
+        postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst')
+        if not postinst:
+            postinst = '#!/bin/sh\n'
+        postinst += d.getVar('gsettings_postinstrm')
+        d.setVar('pkg_postinst_%s' % pkg, postinst)
+
+        bb.note("adding gsettings postrm scripts to %s" % pkg)
+
+        postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm')
+        if not postrm:
+            postrm = '#!/bin/sh\n'
+        postrm += d.getVar('gsettings_postinstrm')
+        d.setVar('pkg_postrm_%s' % pkg, postrm)
 }
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/3 pulseaudio: add PACKAGECONFIGs for GConf and GSettings

Behaviour is kept the same.

(From OE-Core rev: b1ea450037b3beacc7da5cbd27ad9ce895f475ff)

---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +9 -8
index 91d9b8ef832..7498185c5f2 100644
@@ -58,10 +58,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=0e5cd938de1a7a53ea5adac38cc10c39 \
 
 DEPENDS = "libatomic-ops libsndfile1 libtool intltool-native"
 # optional
-DEPENDS += "udev alsa-lib glib-2.0 gconf"
+DEPENDS += "udev alsa-lib glib-2.0"
 DEPENDS += "speexdsp libxml-parser-perl-native libcap"
 
-inherit autotools bash-completion pkgconfig useradd gettext perlnative bluetooth systemd manpages
+inherit autotools bash-completion pkgconfig useradd gettext perlnative bluetooth systemd manpages gsettings
 
 # *.desktop rules wont be generated during configure and build will fail
 # if using --disable-nls
@@ -98,20 +98,18 @@ EXTRA_OECONF += "--without-fftw"
 # very good anyway, better alternatives exist (such as the webrtc canceller).
 EXTRA_OECONF += "--disable-adrian-aec"
 
-# FIXME: The gsettings module is temporarily disabled, because adding support
-# for it is a bit complicated.
-EXTRA_OECONF += "--disable-gsettings"
-
 PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', '${BLUEZ}', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', '3g', 'ofono', '', d)} \
                    ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd x11', d)} \
-                   dbus \
+                   dbus gconf \
                    "
 
 PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus"
 PACKAGECONFIG[bluez4] = "--enable-bluez4,--disable-bluez4,bluez4 sbc"
 PACKAGECONFIG[bluez5] = "--enable-bluez5,--disable-bluez5,bluez5 sbc"
+PACKAGECONFIG[gconf] = "--enable-gconf,--disable-gconf,gconf"
+PACKAGECONFIG[gsettings] = "--enable-gsettings,--disable-gsettings,glib-2.0-native glib-2.0"
 PACKAGECONFIG[ofono] = "--enable-bluez5-ofono-headset,--disable-bluez5-ofono-headset,ofono"
 PACKAGECONFIG[gtk] = "--enable-gtk3,--disable-gtk3,gtk+3"
 PACKAGECONFIG[systemd] = "--enable-systemd-daemon --enable-systemd-login --enable-systemd-journal --with-systemduserunitdir=${systemd_user_unitdir},--disable-systemd-daemon --disable-systemd-login --disable-systemd-journal,systemd"
@@ -251,8 +249,11 @@ RDEPENDS_pulseaudio-server += "alsa-plugins-pulseaudio-conf"
 RDEPENDS_pulseaudio-module-console-kit =+ "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'consolekit', '', d)}"
 RDEPENDS_pulseaudio-misc += "pulseaudio-module-cli-protocol-unix"
 
-FILES_pulseaudio-module-gconf += "${libexecdir}/pulse/gconf-helper"
 FILES_pulseaudio-module-alsa-card += "${datadir}/pulseaudio/alsa-mixer"
+FILES_pulseaudio-module-gconf += "${libexecdir}/pulse/gconf-helper"
+
+GSETTINGS_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'gsettings', 'pulseaudio-module-gsettings', '', d)}"
+FILES_pulseaudio-module-gsettings += "${libexecdir}/pulse/gsettings-helper ${datadir}/GConf/gsettings ${datadir}/glib-2.0/schemas"
 
 # The console-kit module is good to have on X11 systems (it keeps PulseAudio
 # running for the duration of the user login session). The device-manager and
Signature · 1 line
2.11.0
#2 lore raw

PATCH 3/3 pulseaudio: switch configuration module from GConf to GSettings

In reply to Ross Burton

The only user of the configuration module is paprefs, which as of 1.0 uses GSettings not GConf.

Also GConf is unmaintained, so one less recipe using it is good.

---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +1 -1
index 7498185c5f2..1a23bd1ca1b 100644
@@ -102,7 +102,7 @@ PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', '${BLUEZ
                    ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', '3g', 'ofono', '', d)} \
                    ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd x11', d)} \
-                   dbus gconf \
+                   dbus gsettings \
                    "
 
 PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus"
Signature · 1 line
2.11.0