Diff nut-2.8.0-r2 with a nut-9999

/usr/portage/sys-power/nut/nut-9999.ebuild 2023-10-09 14:52:35.568368503 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
inherit bash-completion-r1 flag-o-matic linux-info optfeature systemd
7
inherit tmpfiles toolchain-funcs udev
6
PYTHON_COMPAT=( python3_{10..12} )
7
inherit bash-completion-r1 desktop flag-o-matic linux-info optfeature
8
inherit python-single-r1 systemd tmpfiles toolchain-funcs udev wrapper xdg
8 9

  
9 10
MY_P=${P/_/-}
10 11

  
......
16 17
	inherit git-r3
17 18
else
18 19
	SRC_URI="https://networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
19
	KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
20
	KEYWORDS="~amd64 ~arm64 ~x86"
20 21
fi
21 22

  
22 23
S="${WORKDIR}/${MY_P}"
23 24

  
24 25
LICENSE="GPL-2"
25 26
SLOT="0"
26
IUSE="cgi doc ipmi serial i2c +man snmp +usb modbus selinux split-usr ssl tcpd test xml zeroconf"
27
IUSE="gpio cgi doc ipmi serial i2c +man snmp +usb modbus selinux split-usr ssl tcpd test xml zeroconf python monitor systemd"
27 28
RESTRICT="!test? ( test )"
28 29

  
30
REQUIRED_USE="
31
	monitor? ( python )
32
	python? ( ${PYTHON_REQUIRED_USE} )
33
	snmp? ( python )
34
"
35

  
36
# sys-apps/systemd-253 required for Type=notify-reload
29 37
DEPEND="
30 38
	acct-group/nut
31 39
	acct-user/nut
32 40
	dev-libs/libltdl
33 41
	virtual/udev
34 42
	cgi? ( >=media-libs/gd-2[png] )
43
	gpio? ( dev-libs/libgpiod )
35 44
	i2c? ( sys-apps/i2c-tools )
36 45
	ipmi? ( sys-libs/freeipmi )
37 46
	modbus? ( dev-libs/libmodbus )
47
	python? ( ${PYTHON_DEPS} )
38 48
	snmp? ( net-analyzer/net-snmp:= )
39 49
	ssl? ( >=dev-libs/openssl-1:= )
50
	systemd? ( >=sys-apps/systemd-253 )
40 51
	tcpd? ( sys-apps/tcp-wrappers )
41 52
	usb? ( virtual/libusb:1 )
42 53
	xml? ( >=net-libs/neon-0.25.0:= )
......
49 60
"
50 61
RDEPEND="
51 62
	${DEPEND}
63
	monitor? ( $(python_gen_cond_dep '
64
			dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}]
65
		')
66
	)
52 67
	selinux? ( sec-policy/selinux-nut )
53 68
"
54 69

  
55 70
PATCHES=(
56 71
	"${FILESDIR}/${PN}-2.6.2-lowspeed-buffer-size.patch"
72
	"${FILESDIR}/systemd_notify.path"
57 73
)
58 74

  
59 75
pkg_pretend() {
......
66 82
		ERROR_HIDRAW="HIDRAW is needed to support USB UPSes"
67 83
		ERROR_I2C_CHARDEV="USB_HIDDEV is needed to support USB UPSes"
68 84
	fi
85
	if use gpio; then
86
		CONFIG_CHECK="~GPIO_CDEV_V1"
87
		ERROR_GPIO_CDEV_V1="GPIO_CDEV_V1 is needed to support GPIO UPSes"
88
	fi
69 89
	if use serial; then
70 90
		CONFIG_CHECK="~SERIAL_8250"
71 91
		ERROR_SERIAL_8250="SERIAL_8250 is needed to support Serial UPSes"
......
75 95
	check_extra_config
76 96
}
77 97

  
98
pkg_setup() {
99
	use python && python-single-r1_pkg_setup
100
}
101

  
78 102
src_prepare() {
79 103
	default
80 104

  
81 105
	if [[ ${PV} == *9999 ]] ; then
82 106
		./autogen.sh || die
83 107
	fi
108

  
109
	xdg_environment_reset
84 110
}
85 111

  
86 112
src_configure() {
......
104 130
		--without-powerman
105 131
		--without-python
106 132
		--without-python2
107
		--without-python3
108 133
		--with-altpidpath=/run/nut
109 134
		--with-pidpath=/run/nut
110
		$(use_enable test cppunit)
111 135
		$(use_with cgi)
136
		$(use_with gpio)
112 137
		$(use_with i2c linux_i2c)
113 138
		$(use_with ipmi freeipmi)
114 139
		$(use_with ipmi)
140
		$(use_with monitor nut_monitor)
141
		$(use_with python pynut)
115 142
		$(use_with serial)
116 143
		$(use_with snmp)
117 144
		$(use_with ssl)
145
		$(use_with systemd libsystemd)
118 146
		$(use_with tcpd wrap)
119 147
		$(use_with usb)
120 148
		$(use_with xml neon)
......
127 155

  
128 156
	use cgi && myeconfargs+=( --with-cgipath=/usr/share/nut/cgi )
129 157
	use man && myeconfargs+=( --with-doc=man )
158
	use python && myeconfargs+=( --with-python3="${PYTHON}" ) || myeconfargs+=( --without-python3 )
130 159

  
131 160
	export bashcompdir="$(get_bashcompdir)"
132 161

  
......
182 211
		doins scripts/avahi/nut.service
183 212
	fi
184 213

  
185
	mv "${ED}"/usr/lib/tmpfiles.d/nut-common.tmpfiles "${ED}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
214
	if use monitor; then
215
		make_wrapper NUT-Monitor-py3qt5 /usr/share/nut/nut-monitor/app/NUT-Monitor-py3qt5 /usr/share/nut/nut-monitor/app
216

  
217
		# Install desktop shortcut
218
		newmenu scripts/python/app/nut-monitor-py3qt5.desktop nut-monitor.desktop
219

  
220
		# Installing Application icons
221
		local res
222
		for res in 48 64 256; do
223
			doicon -s ${res} scripts/python/app/icons/${res}x${res}/nut-monitor.png
224
		done
225
		doicon -s scalable scripts/python/app/icons/scalable/nut-monitor.svg
226
	fi
186 227

  
187
	# Fix double directory
188
	sed -i -e 's:/nut/nut:/nut:g' "${ED}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
228
	use python && python_optimize
189 229
}
190 230

  
191 231
pkg_postinst() {
......
214 254
	udev_reload
215 255

  
216 256
	tmpfiles_process nut-common-tmpfiles.conf
257
	xdg_pkg_postinst
217 258
}
218 259

  
219 260
pkg_postrm() {
220 261
	udev_reload
262
	xdg_pkg_postrm
221 263
}
Thank you!