commit:     53b5eaaeadda10e7c5591a9ff9452e9dde21af78
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Sun Dec 31 18:48:50 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan  1 00:12:13 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=53b5eaae

sys-power/nut: fix confusing split-usr handling

Almost a decade ago, upstream moved their binary from libdir to sbindir.
Historically, Gentoo symlinked the binary into sbindir to make up for
this -- and when upstream moved to follow the Gentoo layout, the Gentoo
symlink overwrote the actual binary.

For some reason, at the time, the solution used was to add a
USE=split-usr and install extra symlinks for /sbin -> /usr/sbin even
though this didn't actually do something meaningful. The split-usr USE
flag has issues and using it unnecessarily should be avoided if
possible. Drop the USE flag, and the symlink, and stick with /usr/sbin
as upstream intends.

This should be 100% fine in all cases. The /sbin directory is only
needed for users who both have /usr on a different partition, *and*
don't use an initramfs. In such a case, it is nonsensical to provide a
symlink in /sbin that is a broken symlink to an un-mounted partition.

Bug: https://bugs.gentoo.org/517954
Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../nut/{nut-9999.ebuild => nut-2.8.0-r3.ebuild}   | 65 ++++------------------
 sys-power/nut/nut-9999.ebuild                      |  3 +-
 2 files changed, 12 insertions(+), 56 deletions(-)

diff --git a/sys-power/nut/nut-9999.ebuild b/sys-power/nut/nut-2.8.0-r3.ebuild
similarity index 73%
copy from sys-power/nut/nut-9999.ebuild
copy to sys-power/nut/nut-2.8.0-r3.ebuild
index a56635519b2d..20eea7107c63 100644
--- a/sys-power/nut/nut-9999.ebuild
+++ b/sys-power/nut/nut-2.8.0-r3.ebuild
@@ -3,9 +3,8 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{10..12} )
-inherit bash-completion-r1 desktop flag-o-matic linux-info optfeature
-inherit python-single-r1 systemd tmpfiles toolchain-funcs udev wrapper xdg
+inherit bash-completion-r1 flag-o-matic linux-info optfeature systemd
+inherit tmpfiles toolchain-funcs udev
 
 MY_P=${P/_/-}
 
@@ -17,37 +16,27 @@ if [[ ${PV} == *9999 ]] ; then
        inherit git-r3
 else
        SRC_URI="https://networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz";
-       KEYWORDS="~amd64 ~arm64 ~x86"
+       KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
 fi
 
 S="${WORKDIR}/${MY_P}"
 
 LICENSE="GPL-2"
 SLOT="0"
-IUSE="gpio cgi doc ipmi serial i2c +man snmp +usb modbus selinux split-usr ssl 
tcpd test xml zeroconf python monitor systemd"
+IUSE="cgi doc ipmi serial i2c +man snmp +usb modbus selinux ssl tcpd test xml 
zeroconf"
 RESTRICT="!test? ( test )"
 
-REQUIRED_USE="
-       monitor? ( python )
-       python? ( ${PYTHON_REQUIRED_USE} )
-       snmp? ( python )
-"
-
-# sys-apps/systemd-253 required for Type=notify-reload
 DEPEND="
        acct-group/nut
        acct-user/nut
        dev-libs/libltdl
        virtual/udev
        cgi? ( >=media-libs/gd-2[png] )
-       gpio? ( dev-libs/libgpiod )
        i2c? ( sys-apps/i2c-tools )
        ipmi? ( sys-libs/freeipmi )
        modbus? ( dev-libs/libmodbus )
-       python? ( ${PYTHON_DEPS} )
        snmp? ( net-analyzer/net-snmp:= )
        ssl? ( >=dev-libs/openssl-1:= )
-       systemd? ( >=sys-apps/systemd-253 )
        tcpd? ( sys-apps/tcp-wrappers )
        usb? ( virtual/libusb:1 )
        xml? ( >=net-libs/neon-0.25.0:= )
@@ -60,16 +49,11 @@ BDEPEND="
 "
 RDEPEND="
        ${DEPEND}
-       monitor? ( $(python_gen_cond_dep '
-                       dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}]
-               ')
-       )
        selinux? ( sec-policy/selinux-nut )
 "
 
 PATCHES=(
        "${FILESDIR}/${PN}-2.6.2-lowspeed-buffer-size.patch"
-       "${FILESDIR}/systemd_notify.path"
 )
 
 pkg_pretend() {
@@ -82,10 +66,6 @@ pkg_pretend() {
                ERROR_HIDRAW="HIDRAW is needed to support USB UPSes"
                ERROR_I2C_CHARDEV="USB_HIDDEV is needed to support USB UPSes"
        fi
-       if use gpio; then
-               CONFIG_CHECK="~GPIO_CDEV_V1"
-               ERROR_GPIO_CDEV_V1="GPIO_CDEV_V1 is needed to support GPIO 
UPSes"
-       fi
        if use serial; then
                CONFIG_CHECK="~SERIAL_8250"
                ERROR_SERIAL_8250="SERIAL_8250 is needed to support Serial 
UPSes"
@@ -95,18 +75,12 @@ pkg_pretend() {
        check_extra_config
 }
 
-pkg_setup() {
-       use python && python-single-r1_pkg_setup
-}
-
 src_prepare() {
        default
 
        if [[ ${PV} == *9999 ]] ; then
                ./autogen.sh || die
        fi
-
-       xdg_environment_reset
 }
 
 src_configure() {
@@ -130,19 +104,17 @@ src_configure() {
                --without-powerman
                --without-python
                --without-python2
+               --without-python3
                --with-altpidpath=/run/nut
                --with-pidpath=/run/nut
+               $(use_enable test cppunit)
                $(use_with cgi)
-               $(use_with gpio)
                $(use_with i2c linux_i2c)
                $(use_with ipmi freeipmi)
                $(use_with ipmi)
-               $(use_with monitor nut_monitor)
-               $(use_with python pynut)
                $(use_with serial)
                $(use_with snmp)
                $(use_with ssl)
-               $(use_with systemd libsystemd)
                $(use_with tcpd wrap)
                $(use_with usb)
                $(use_with xml neon)
@@ -155,7 +127,6 @@ src_configure() {
 
        use cgi && myeconfargs+=( --with-cgipath=/usr/share/nut/cgi )
        use man && myeconfargs+=( --with-doc=man )
-       use python && myeconfargs+=( --with-python3="${PYTHON}" ) || 
myeconfargs+=( --without-python3 )
 
        export bashcompdir="$(get_bashcompdir)"
 
@@ -170,7 +141,6 @@ src_install() {
        find "${ED}" -name '*.la' -delete || die
 
        dodir /sbin
-       use split-usr && dosym ../usr/sbin/upsdrvctl /sbin/upsdrvctl
 
        if use cgi; then
                elog "CGI monitoring scripts are installed in 
${EPREFIX}/usr/share/nut/cgi."
@@ -187,11 +157,11 @@ src_install() {
                mv "${i}" "${i/.sample/}" || die
        done
 
-       local DOCS=( AUTHORS MAINTAINERS NEWS.adoc README.adoc TODO.adoc 
UPGRADING.adoc )
+       local DOCS=( AUTHORS MAINTAINERS NEWS README TODO UPGRADING )
        einstalldocs
 
        if use doc; then
-               newdoc lib/README.adoc
+               newdoc lib/README README.lib
                dodoc docs/*.txt
                docinto cables
                dodoc docs/cables/*
@@ -211,21 +181,10 @@ src_install() {
                doins scripts/avahi/nut.service
        fi
 
-       if use monitor; then
-               make_wrapper NUT-Monitor-py3qt5 
/usr/share/nut/nut-monitor/app/NUT-Monitor-py3qt5 /usr/share/nut/nut-monitor/app
-
-               # Install desktop shortcut
-               newmenu scripts/python/app/nut-monitor-py3qt5.desktop 
nut-monitor.desktop
-
-               # Installing Application icons
-               local res
-               for res in 48 64 256; do
-                       doicon -s ${res} 
scripts/python/app/icons/${res}x${res}/nut-monitor.png
-               done
-               doicon -s scalable 
scripts/python/app/icons/scalable/nut-monitor.svg
-       fi
+       mv "${ED}"/usr/lib/tmpfiles.d/nut-common.tmpfiles 
"${ED}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
 
-       use python && python_optimize
+       # Fix double directory
+       sed -i -e 's:/nut/nut:/nut:g' 
"${ED}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
 }
 
 pkg_postinst() {
@@ -254,10 +213,8 @@ pkg_postinst() {
        udev_reload
 
        tmpfiles_process nut-common-tmpfiles.conf
-       xdg_pkg_postinst
 }
 
 pkg_postrm() {
        udev_reload
-       xdg_pkg_postrm
 }

diff --git a/sys-power/nut/nut-9999.ebuild b/sys-power/nut/nut-9999.ebuild
index a56635519b2d..22a0e6bc597a 100644
--- a/sys-power/nut/nut-9999.ebuild
+++ b/sys-power/nut/nut-9999.ebuild
@@ -24,7 +24,7 @@ S="${WORKDIR}/${MY_P}"
 
 LICENSE="GPL-2"
 SLOT="0"
-IUSE="gpio cgi doc ipmi serial i2c +man snmp +usb modbus selinux split-usr ssl 
tcpd test xml zeroconf python monitor systemd"
+IUSE="gpio cgi doc ipmi serial i2c +man snmp +usb modbus selinux ssl tcpd test 
xml zeroconf python monitor systemd"
 RESTRICT="!test? ( test )"
 
 REQUIRED_USE="
@@ -170,7 +170,6 @@ src_install() {
        find "${ED}" -name '*.la' -delete || die
 
        dodir /sbin
-       use split-usr && dosym ../usr/sbin/upsdrvctl /sbin/upsdrvctl
 
        if use cgi; then
                elog "CGI monitoring scripts are installed in 
${EPREFIX}/usr/share/nut/cgi."

Reply via email to