commit:     850afc904a3c133d9bf360723973f916658416d2
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 20 09:01:48 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Thu Oct 20 10:52:37 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=850afc90

x11-misc/autorandr: fix non-systemd udev rule, add missing pkg_postrm

Also use PEP517 build mode.

Closes: https://bugs.gentoo.org/803545
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 ...1.12.1-r1.ebuild => autorandr-1.12.1-r2.ebuild} | 12 ++++++++++
 x11-misc/autorandr/autorandr-9999.ebuild           |  7 ++++++
 ...x-install_udev-target-by-s-TARGETS-MAKECM.patch | 28 ++++++++++++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/x11-misc/autorandr/autorandr-1.12.1-r1.ebuild 
b/x11-misc/autorandr/autorandr-1.12.1-r2.ebuild
similarity index 84%
rename from x11-misc/autorandr/autorandr-1.12.1-r1.ebuild
rename to x11-misc/autorandr/autorandr-1.12.1-r2.ebuild
index 0badb8f708aa..77f954a8aaa0 100644
--- a/x11-misc/autorandr/autorandr-1.12.1-r1.ebuild
+++ b/x11-misc/autorandr/autorandr-1.12.1-r2.ebuild
@@ -3,6 +3,7 @@
 
 EAPI=7
 
+DISTUTILS_USE_PEP517=setuptools
 PYTHON_COMPAT=( python3_{8..11} )
 
 inherit bash-completion-r1 distutils-r1 systemd udev
@@ -30,6 +31,11 @@ RDEPEND="
 DEPEND="${RDEPEND}"
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=(
+       # https://github.com/phillipberndt/autorandr/pull/306
+       
"${FILESDIR}"/autorandr-Makefile-fix-install_udev-target-by-s-TARGETS-MAKECM.patch
+)
+
 src_compile() {
        distutils-r1_src_compile
 
@@ -63,3 +69,9 @@ pkg_postinst() {
                udev_reload
        fi
 }
+
+pkg_postrm() {
+       if use udev; then
+               udev_reload
+       fi
+}

diff --git a/x11-misc/autorandr/autorandr-9999.ebuild 
b/x11-misc/autorandr/autorandr-9999.ebuild
index 0badb8f708aa..7f0dd9c1da1b 100644
--- a/x11-misc/autorandr/autorandr-9999.ebuild
+++ b/x11-misc/autorandr/autorandr-9999.ebuild
@@ -3,6 +3,7 @@
 
 EAPI=7
 
+DISTUTILS_USE_PEP517=setuptools
 PYTHON_COMPAT=( python3_{8..11} )
 
 inherit bash-completion-r1 distutils-r1 systemd udev
@@ -63,3 +64,9 @@ pkg_postinst() {
                udev_reload
        fi
 }
+
+pkg_postrm() {
+       if use udev; then
+               udev_reload
+       fi
+}

diff --git 
a/x11-misc/autorandr/files/autorandr-Makefile-fix-install_udev-target-by-s-TARGETS-MAKECM.patch
 
b/x11-misc/autorandr/files/autorandr-Makefile-fix-install_udev-target-by-s-TARGETS-MAKECM.patch
new file mode 100644
index 000000000000..ff3b31d01326
--- /dev/null
+++ 
b/x11-misc/autorandr/files/autorandr-Makefile-fix-install_udev-target-by-s-TARGETS-MAKECM.patch
@@ -0,0 +1,28 @@
+From 4b8d397fc7a0d22a51ee13428ae13d892c0cc911 Mon Sep 17 00:00:00 2001
+From: Florian Schmaus <[email protected]>
+Date: Thu, 20 Oct 2022 10:48:54 +0200
+Subject: [PATCH] Makefile: fix install_udev target by s/TARGETS/MAKECMDGOALS/
+
+A Gentoo user reported [1] that the 'install_udev' target would
+install a systemd-flavored udev rules, despite the 'systemd' target
+not being selected. Replacing 'TARGETS' with 'MAKECMDGOALS' in the
+Makefile rule fixes this .
+
+I am not sure where the TARGETS variable origniates from, but GNU make
+uses MAKECMDGOALS (FreeBSD make uses .TARGETS, i.e., with a leading
+dot). So if further portability between make variants is required,
+then this needs to be adjusted.
+
+1: https://bugs.gentoo.org/803545#c3
+Fixes: ae1f18a06039 ("udev rule: Dynamically call either systemd or autorandr 
directly depending on whether systemd unit is available")
+--- a/Makefile
++++ b/Makefile
+@@ -129,7 +129,7 @@ endif
+ install_udev:
+       $(if $(UDEV_RULES_DIR),,$(error UDEV_RULES_DIR is not defined))
+       mkdir -p ${DESTDIR}/${UDEV_RULES_DIR}/
+-      echo 'ACTION=="change", SUBSYSTEM=="drm", RUN+="$(if $(findstring 
systemd, $(TARGETS)),/bin/systemctl start --no-block 
autorandr.service,${PREFIX}/bin/autorandr --batch --change --default default)"' 
> ${DESTDIR}/${UDEV_RULES_DIR}/40-monitor-hotplug.rules
++      echo 'ACTION=="change", SUBSYSTEM=="drm", RUN+="$(if $(findstring 
systemd, $(MAKECMDGOALS)),/bin/systemctl start --no-block 
autorandr.service,${PREFIX}/bin/autorandr --batch --change --default default)"' 
> ${DESTDIR}/${UDEV_RULES_DIR}/40-monitor-hotplug.rules
+       @echo
+       @echo "To activate the udev rules, run this command as root:"
+       @echo "    udevadm control --reload-rules"

Reply via email to