Gentoo Archives: gentoo-commits

From: Sebastian Pipping <sping@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-misc/redshift/, x11-misc/redshift/files/
Date: Sun, 01 Jan 2023 16:03:25
Message-Id: 1672588918.ddf9074b3579b8587f3beb9f0817caa2d19c5ff8.sping@gentoo
1 commit: ddf9074b3579b8587f3beb9f0817caa2d19c5ff8
2 Author: Sebastian Pipping <sping <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 1 15:59:48 2023 +0000
4 Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 1 16:01:58 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddf9074b
7
8 x11-misc/redshift: Fix AppArmor profile
9
10 Closes: https://bugs.gentoo.org/887979
11 Signed-off-by: Sebastian Pipping <sping <AT> gentoo.org>
12
13 .../redshift/files/redshift-1.12-apparmor.patch | 35 +++++++++
14 x11-misc/redshift/redshift-1.12-r9.ebuild | 91 ++++++++++++++++++++++
15 2 files changed, 126 insertions(+)
16
17 diff --git a/x11-misc/redshift/files/redshift-1.12-apparmor.patch b/x11-misc/redshift/files/redshift-1.12-apparmor.patch
18 new file mode 100644
19 index 000000000000..cb939994bf52
20 --- /dev/null
21 +++ b/x11-misc/redshift/files/redshift-1.12-apparmor.patch
22 @@ -0,0 +1,35 @@
23 +From c740a3a733a59782c26f2f90a073befec2e2324d Mon Sep 17 00:00:00 2001
24 +From: Sebastian Pipping <sebastian@×××××××.org>
25 +Date: Tue, 27 Dec 2022 01:27:35 +0100
26 +Subject: [PATCH] Fix AppArmor profile
27 +
28 +Inspired by:
29 +- https://github.com/jonls/redshift/pull/864
30 +- https://gitlab.com/chinstrap/gammastep/-/blob/9db19f5ccfad20ab7b501daedcfd5ef137860dd2/data/apparmor/usr.bin.redshift.in
31 +---
32 + data/apparmor/usr.bin.redshift.in | 9 +++++++--
33 + 1 file changed, 7 insertions(+), 2 deletions(-)
34 +
35 +diff --git a/data/apparmor/usr.bin.redshift.in b/data/apparmor/usr.bin.redshift.in
36 +index d6696db..9b71f0d 100644
37 +--- a/data/apparmor/usr.bin.redshift.in
38 ++++ b/data/apparmor/usr.bin.redshift.in
39 +@@ -35,8 +35,13 @@
40 + # Allow but log any other dbus activity
41 + audit dbus bus=system,
42 +
43 +- owner @{HOME}/.config/redshift.conf r,
44 ++ owner @{HOME}/.config/{,redshift/}redshift.conf r,
45 ++ owner @{HOME}/.config/redshift/hooks/ r,
46 ++ owner @{HOME}/.config/redshift/hooks/* Ux,
47 ++
48 ++ # Required by getpwuid() call in config-ini.c.
49 ++ /etc/passwd* r,
50 +
51 + # Site-specific additions and overrides. See local/README for details.
52 +- #include <local/usr.bin.redshift>
53 ++ #include if exists <local/usr.bin.redshift>
54 + }
55 +--
56 +2.39.0
57 +
58
59 diff --git a/x11-misc/redshift/redshift-1.12-r9.ebuild b/x11-misc/redshift/redshift-1.12-r9.ebuild
60 new file mode 100644
61 index 000000000000..fd9f01b778a0
62 --- /dev/null
63 +++ b/x11-misc/redshift/redshift-1.12-r9.ebuild
64 @@ -0,0 +1,91 @@
65 +# Copyright 1999-2023 Gentoo Authors
66 +# Distributed under the terms of the GNU General Public License v2
67 +
68 +EAPI=8
69 +
70 +PYTHON_COMPAT=( python3_{8..11} )
71 +
72 +inherit flag-o-matic systemd xdg-utils python-r1
73 +
74 +DESCRIPTION="A screen color temperature adjusting software"
75 +HOMEPAGE="http://jonls.dk/redshift/"
76 +SRC_URI="https://github.com/jonls/${PN}/releases/download/v${PV}/${P}.tar.xz"
77 +
78 +LICENSE="GPL-3"
79 +SLOT="0"
80 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
81 +IUSE="appindicator geoclue gtk nls"
82 +
83 +COMMON_DEPEND=">=x11-libs/libX11-1.4
84 + x11-libs/libXxf86vm
85 + x11-libs/libxcb
86 + x11-libs/libdrm
87 + appindicator? ( dev-libs/libappindicator:3[introspection] )
88 + geoclue? ( app-misc/geoclue:2.0 dev-libs/glib:2 )
89 + gtk? ( ${PYTHON_DEPS} )"
90 +RDEPEND="${COMMON_DEPEND}
91 + gtk? ( dev-python/pygobject[${PYTHON_USEDEP}]
92 + x11-libs/gtk+:3[introspection]
93 + dev-python/pyxdg[${PYTHON_USEDEP}] )"
94 +DEPEND="${COMMON_DEPEND}
95 + >=dev-util/intltool-0.50
96 + nls? ( sys-devel/gettext )
97 +"
98 +REQUIRED_USE="gtk? ( ${PYTHON_REQUIRED_USE} )"
99 +
100 +PATCHES=(
101 + "${FILESDIR}"/${P}-apparmor.patch
102 +)
103 +
104 +src_configure() {
105 + use gtk && python_setup
106 +
107 + # Fix compile for Clang (bug #732438)
108 + append-cflags -fPIE
109 +
110 + econf \
111 + $(use_enable nls) \
112 + --enable-drm \
113 + --enable-randr \
114 + --enable-vidmode \
115 + --disable-wingdi \
116 + \
117 + --disable-corelocation \
118 + $(use_enable geoclue geoclue2) \
119 + \
120 + $(use_enable gtk gui) \
121 + --with-systemduserunitdir="$(systemd_get_userunitdir)" \
122 + --enable-apparmor \
123 + --disable-quartz \
124 + --disable-ubuntu
125 +}
126 +
127 +_impl_specific_src_install() {
128 + emake DESTDIR="${D}" \
129 + PYTHON="${PYTHON}" \
130 + pythondir="$(python_get_sitedir)" \
131 + -C src/redshift-gtk install
132 +}
133 +
134 +src_install() {
135 + emake DESTDIR="${D}" UPDATE_ICON_CACHE=/bin/true install
136 +
137 + if use gtk; then
138 + python_foreach_impl _impl_specific_src_install
139 + python_replicate_script "${D}"/usr/bin/redshift-gtk
140 + dosym redshift-gtk /usr/bin/gtk-redshift
141 +
142 + python_foreach_impl python_optimize
143 +
144 + # https://bugs.gentoo.org/784281
145 + mv "${D}"/usr/share/{appdata,metainfo}/ || die
146 + fi
147 +}
148 +
149 +pkg_postinst() {
150 + use gtk && xdg_icon_cache_update
151 +}
152 +
153 +pkg_postrm() {
154 + use gtk && xdg_icon_cache_update
155 +}