1
0

Accepting request 921427 from GNOME:Next

- Pass explicit systemdsystemunitdir=%{_unitdir} to meson, ensure
  we have the correct systemd unitdir.
- Drop systemd and systemd-rpm-macros BuildRequires, not needed.
- Add check section and run meson_test macro, replace umockdev with
  pkgconfig(umockdev-1.0) BuildRequires.
- Add generic c_compiler BuildRequires as meson checks for it.
- Add upstream patches:
  + c9b646025d9f155509a6cda1c292bfd120daeb9e.patch:
    platform-profile: Add support for 'quiet' profile.
  + 20a2d7f7b80a1847f36236d40388f14ae99fa94b.patch: tests: Add
    tests for quiet profile support.

OBS-URL: https://build.opensuse.org/request/show/921427
OBS-URL: https://build.opensuse.org/package/show/Base:System/power-profiles-daemon?expand=0&rev=2
This commit is contained in:
Atri Bhattacharya 2021-09-26 14:40:36 +00:00 committed by Git OBS Bridge
parent 248bc0bf64
commit 3a5bc57fa7
4 changed files with 111 additions and 4 deletions

View File

@ -0,0 +1,45 @@
From 20a2d7f7b80a1847f36236d40388f14ae99fa94b Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sat, 24 Jul 2021 23:00:04 +0200
Subject: [PATCH] tests: Add tests for quiet profile support
---
tests/integration-test | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/integration-test b/tests/integration-test
index 848f743..9ff577f 100755
--- a/tests/integration-test
+++ b/tests/integration-test
@@ -559,6 +559,28 @@ class Tests(dbusmock.DBusTestCase):
self.stop_daemon()
+ def test_quiet(self):
+ # Uses cool instead of low-power
+ acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
+ os.makedirs(acpi_dir)
+ with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
+ profile.write("cool\n")
+ with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
+ choices.write("quiet balanced balanced-performance performance\n")
+
+ self.start_daemon()
+ profiles = self.get_dbus_property('Profiles')
+ self.assertEqual(len(profiles), 3)
+ self.assertEqual(profiles[0]['Driver'], 'platform_profile')
+ self.assertEqual(profiles[0]['Profile'], 'power-saver')
+ self.assertEqual(self.get_dbus_property('ActiveProfile'), 'balanced')
+ self.assertEqual(self.read_sysfs_file("sys/firmware/acpi/platform_profile"), b'balanced')
+ self.set_dbus_property('ActiveProfile', GLib.Variant.new_string('power-saver'))
+ self.assertEqual(self.get_dbus_property('ActiveProfile'), 'power-saver')
+ self.assertEqual(self.read_sysfs_file("sys/firmware/acpi/platform_profile"), b'quiet')
+
+ self.stop_daemon()
+
def test_hold_release_profile(self):
self.create_platform_profile()
self.start_daemon()
--
GitLab

View File

@ -0,0 +1,37 @@
From c9b646025d9f155509a6cda1c292bfd120daeb9e Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sat, 24 Jul 2021 22:59:12 +0200
Subject: [PATCH] platform-profile: Add support for 'quiet' profile
---
src/ppd-driver-platform-profile.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/ppd-driver-platform-profile.c b/src/ppd-driver-platform-profile.c
index 1da5a75..8111251 100644
--- a/src/ppd-driver-platform-profile.c
+++ b/src/ppd-driver-platform-profile.c
@@ -59,7 +59,9 @@ profile_to_acpi_platform_profile_value (PpdDriverPlatformProfile *self,
case PPD_PROFILE_POWER_SAVER:
if (g_strv_contains ((const char * const*) self->profile_choices, "low-power"))
return "low-power";
- return "cool";
+ if (g_strv_contains ((const char * const*) self->profile_choices, "cool"))
+ return "cool";
+ return "quiet";
case PPD_PROFILE_BALANCED:
return "balanced";
case PPD_PROFILE_PERFORMANCE:
@@ -141,7 +143,8 @@ verify_acpi_platform_profile_choices (PpdDriverPlatformProfile *self)
const char * const *choices = (const char * const*) self->profile_choices;
if ((g_strv_contains (choices, "low-power") ||
- g_strv_contains (choices, "cool")) &&
+ g_strv_contains (choices, "cool") ||
+ g_strv_contains (choices, "quiet")) &&
g_strv_contains (choices, "balanced") &&
g_strv_contains (choices, "performance"))
return PPD_PROBE_RESULT_SUCCESS;
--
GitLab

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Fri Sep 24 19:45:59 UTC 2021 - Bjørn Lie <bjorn.lie@gmail.com>
- Pass explicit systemdsystemunitdir=%{_unitdir} to meson, ensure
we have the correct systemd unitdir.
- Drop systemd and systemd-rpm-macros BuildRequires, not needed.
- Add check section and run meson_test macro, replace umockdev with
pkgconfig(umockdev-1.0) BuildRequires.
- Add generic c_compiler BuildRequires as meson checks for it.
- Add upstream patches:
+ c9b646025d9f155509a6cda1c292bfd120daeb9e.patch:
platform-profile: Add support for 'quiet' profile.
+ 20a2d7f7b80a1847f36236d40388f14ae99fa94b.patch: tests: Add
tests for quiet profile support.
-------------------------------------------------------------------
Thu Aug 26 18:16:58 UTC 2021 - Atri Bhattacharya <badshah400@gmail.com>

View File

@ -23,17 +23,21 @@ Summary: Power profiles handling over D-Bus
License: GPL-3.0-or-later
URL: https://gitlab.freedesktop.org/hadess/power-profiles-daemon
Source: %{url}/-/archive/%{version}/%{name}-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM c9b646025d9f155509a6cda1c292bfd120daeb9e.patch -- platform-profile: Add support for 'quiet' profile
Patch1: https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/commit/c9b646025d9f155509a6cda1c292bfd120daeb9e.patch
# PATCH-FIX-UPSTREAM 20a2d7f7b80a1847f36236d40388f14ae99fa94b.patch -- tests: Add tests for quiet profile support
Patch2: https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/commit/20a2d7f7b80a1847f36236d40388f14ae99fa94b.patch
BuildRequires: c_compiler
BuildRequires: gtk-doc
BuildRequires: meson
BuildRequires: pkgconfig
BuildRequires: python3-dbusmock
BuildRequires: systemd
BuildRequires: systemd-rpm-macros
BuildRequires: umockdev
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gudev-1.0)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
BuildRequires: pkgconfig(umockdev-1.0)
BuildRequires: pkgconfig(upower-glib)
%description
@ -52,12 +56,18 @@ This package provides documentation for %{name}.
%autosetup -p1
%build
%meson -Dgtk_doc=true
%meson \
-Dsystemdsystemunitdir=%{_unitdir} \
-Dgtk_doc=true \
%{nil}
%meson_build
%install
%meson_install
%check
%meson_test
%pre
%service_add_pre %{name}.service