public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-power/nut/
Date: Sat, 17 Jun 2023 03:55:21 +0000 (UTC)	[thread overview]
Message-ID: <1686974067.a84735cb1e18ea166a702da5dc48f20e89f86fbb.sam@gentoo> (raw)

commit:     a84735cb1e18ea166a702da5dc48f20e89f86fbb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 17 03:47:13 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 17 03:54:27 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a84735cb

sys-power/nut: misc tweaks

- Style tweaks to be closer to skel.ebuild
- Use EROOT and ED where appropriate
- Add missing 'local'
- Fix typo in pkg_postinst optfeature for util-linux
- Add additional configure options for tmpfiles, udev paths
- Wire up tests

Closes: https://bugs.gentoo.org/908615
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../nut/{nut-2.8.0.ebuild => nut-2.8.0-r1.ebuild}  | 66 ++++++++++----------
 sys-power/nut/nut-9999.ebuild                      | 71 +++++++++++-----------
 2 files changed, 66 insertions(+), 71 deletions(-)

diff --git a/sys-power/nut/nut-2.8.0.ebuild b/sys-power/nut/nut-2.8.0-r1.ebuild
similarity index 83%
rename from sys-power/nut/nut-2.8.0.ebuild
rename to sys-power/nut/nut-2.8.0-r1.ebuild
index 163885862062..c08bb5d648d0 100644
--- a/sys-power/nut/nut-2.8.0.ebuild
+++ b/sys-power/nut/nut-2.8.0-r1.ebuild
@@ -3,30 +3,35 @@
 
 EAPI=8
 
-inherit bash-completion-r1 flag-o-matic linux-info optfeature systemd tmpfiles toolchain-funcs udev
+inherit bash-completion-r1 flag-o-matic linux-info optfeature systemd
+inherit tmpfiles toolchain-funcs udev
 
 MY_P=${P/_/-}
 
 DESCRIPTION="Network-UPS Tools"
 HOMEPAGE="https://networkupstools.org/"
-if [[ "${PV}" == *9999 ]] ; then
-	inherit git-r3
+
+if [[ ${PV} == *9999 ]] ; then
 	EGIT_REPO_URI="https://github.com/networkupstools/${PN}.git"
+	inherit git-r3
 else
 	SRC_URI="https://networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+	KEYWORDS="~amd64 ~arm64 ~x86"
 fi
 
+S="${WORKDIR}/${MY_P}"
+
 LICENSE="GPL-2"
 SLOT="0"
-KEYWORDS="~amd64 ~arm64 ~x86"
-
-IUSE="cgi doc ipmi serial i2c +man snmp +usb modbus selinux split-usr ssl tcpd xml zeroconf"
+IUSE="cgi doc ipmi serial i2c +man snmp +usb modbus selinux split-usr ssl tcpd test xml zeroconf"
+RESTRICT="!test? ( test )"
 
 DEPEND="
 	acct-group/nut
 	acct-user/nut
-	cgi? ( >=media-libs/gd-2[png] )
 	dev-libs/libltdl
+	virtual/udev
+	cgi? ( >=media-libs/gd-2[png] )
 	i2c? ( sys-apps/i2c-tools )
 	ipmi? ( sys-libs/freeipmi )
 	modbus? ( dev-libs/libmodbus )
@@ -34,23 +39,19 @@ DEPEND="
 	ssl? ( >=dev-libs/openssl-1:= )
 	tcpd? ( sys-apps/tcp-wrappers )
 	usb? ( virtual/libusb:1 )
-	virtual/udev
 	xml? ( >=net-libs/neon-0.25.0:= )
 	zeroconf? ( net-dns/avahi )
 "
-
 BDEPEND="
-	man? ( app-text/asciidoc )
 	virtual/pkgconfig
+	man? ( app-text/asciidoc )
+	test? ( dev-util/cppunit )
 "
-
 RDEPEND="
 	${DEPEND}
 	selinux? ( sec-policy/selinux-nut )
 "
 
-S="${WORKDIR}/${MY_P}"
-
 PATCHES=(
 	"${FILESDIR}/${PN}-2.6.2-lowspeed-buffer-size.patch"
 )
@@ -74,18 +75,11 @@ pkg_pretend() {
 	check_extra_config
 }
 
-src_unpack() {
-	if [[ "${PV}" == *9999 ]] ; then
-		git-r3_src_unpack
-	fi
-	default
-}
-
 src_prepare() {
 	default
 
-	if [[ "${PV}" == *9999 ]] ; then
-		./autogen.sh
+	if [[ ${PV} == *9999 ]] ; then
+		./autogen.sh || die
 	fi
 }
 
@@ -94,6 +88,8 @@ src_configure() {
 		--datadir=/usr/share/nut
 		--datarootdir=/usr/share/nut
 		--disable-static
+		--disable-strip
+		--disable-Werror
 		--sysconfdir=/etc/nut
 		--with-dev
 		--with-drvpath="/$(get_libdir)/nut"
@@ -102,6 +98,8 @@ src_configure() {
 		--with-logfacility=LOG_DAEMON
 		--with-statepath=/var/lib/nut
 		--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+		--with-systemdtmpfilesdir="/usr/lib/tmpfiles.d"
+		--with-udev-dir="$(get_udevdir)"
 		--with-user=nut
 		--without-powerman
 		--without-python
@@ -109,6 +107,7 @@ src_configure() {
 		--without-python3
 		--with-altpidpath=/run/nut
 		--with-pidpath=/run/nut
+		$(use_enable test cppunit)
 		$(use_with i2c linux_i2c)
 		$(use_with ipmi freeipmi)
 		$(use_with ipmi)
@@ -121,11 +120,9 @@ src_configure() {
 		$(use_with zeroconf avahi)
 	)
 
+	filter-lto
 	append-flags -fno-lto
-
-	tc-export CC
-	tc-export CXX
-	tc-export AR
+	tc-export CC CXX AR
 
 	use cgi && myeconfargs+=( --with-cgipath=/usr/share/nut/cgi )
 	use man && myeconfargs+=( --with-doc=man )
@@ -138,15 +135,15 @@ src_configure() {
 src_install() {
 	default
 
-	rm -rf "${D}/etc/hotplug" || die
+	rm -rf "${ED}/etc/hotplug" || die
 
-	find "${D}" -name '*.la' -delete || die
+	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 /usr/share/nut/cgi."
+		elog "CGI monitoring scripts are installed in ${EROOT}/usr/share/nut/cgi."
 		elog "copy them to your web server's ScriptPath to activate (this is a"
 		elog "change from the old location)."
 		elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
@@ -154,8 +151,9 @@ src_install() {
 		elog "Use script aliases according to the web server you use (apache, nginx, lighttpd, etc...)"
 	fi
 
-	# this must be done after all of the install phases
-	for i in "${D}"/etc/nut/*.sample ; do
+	# This must be done after all of the install phases
+	local i
+	for i in "${ED}"/etc/nut/*.sample ; do
 		mv "${i}" "${i/.sample/}" || die
 	done
 
@@ -183,10 +181,10 @@ src_install() {
 		doins scripts/avahi/nut.service
 	fi
 
-	mv "${D}"/usr/lib/tmpfiles.d/nut-common.tmpfiles "${D}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
+	mv "${ED}"/usr/lib/tmpfiles.d/nut-common.tmpfiles "${ED}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
 
 	# Fix double directory
-	sed -i -e 's:/nut/nut:/nut:g' "${D}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
+	sed -i -e 's:/nut/nut:/nut:g' "${ED}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
 }
 
 pkg_postinst() {
@@ -210,7 +208,7 @@ pkg_postinst() {
 	elog
 
 	optfeature "all notify events generate a global message (wall) to all users, plus they are logged via the syslog" \
-		sys-apps/util-linu[logger,tty-helpers]
+		sys-apps/util-linux[logger,tty-helpers]
 
 	udev_reload
 

diff --git a/sys-power/nut/nut-9999.ebuild b/sys-power/nut/nut-9999.ebuild
index 445fb3b9c78d..0b2f92a75a29 100644
--- a/sys-power/nut/nut-9999.ebuild
+++ b/sys-power/nut/nut-9999.ebuild
@@ -3,26 +3,30 @@
 
 EAPI=8
 
-PYTHON_COMPAT=(python3_{10..12})
-inherit bash-completion-r1 desktop flag-o-matic linux-info optfeature python-single-r1 systemd tmpfiles \
-	toolchain-funcs udev wrapper xdg
+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
 
 MY_P=${P/_/-}
 
 DESCRIPTION="Network-UPS Tools"
 HOMEPAGE="https://networkupstools.org/"
-if [[ "${PV}" == *9999 ]] ; then
-	inherit git-r3
+
+if [[ ${PV} == *9999 ]] ; then
 	EGIT_REPO_URI="https://github.com/networkupstools/${PN}.git"
+	inherit git-r3
 else
-	KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
 	SRC_URI="https://networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+	KEYWORDS="~amd64 ~arm64 ~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 xml zeroconf python monitor systemd"
+IUSE="gpio cgi doc ipmi serial i2c +man snmp +usb modbus selinux split-usr ssl tcpd test xml zeroconf python monitor systemd"
+RESTRICT="!test? ( test )"
 
 REQUIRED_USE="
 	monitor? ( python )
@@ -30,11 +34,13 @@ REQUIRED_USE="
 	snmp? ( python )
 "
 
+# sys-apps/systemd-253 required for Type=notify-reload
 DEPEND="
 	acct-group/nut
 	acct-user/nut
-	cgi? ( >=media-libs/gd-2[png] )
 	dev-libs/libltdl
+	virtual/udev
+	cgi? ( >=media-libs/gd-2[png] )
 	gpio? ( dev-libs/libgpiod )
 	i2c? ( sys-apps/i2c-tools )
 	ipmi? ( sys-libs/freeipmi )
@@ -45,17 +51,14 @@ DEPEND="
 	systemd? ( >=sys-apps/systemd-253 )
 	tcpd? ( sys-apps/tcp-wrappers )
 	usb? ( virtual/libusb:1 )
-	virtual/udev
 	xml? ( >=net-libs/neon-0.25.0:= )
 	zeroconf? ( net-dns/avahi )
 "
-# sys-apps/systemd-253 required for Type=notify-reload
-
 BDEPEND="
-	man? ( app-text/asciidoc )
 	virtual/pkgconfig
+	man? ( app-text/asciidoc )
+	test? ( dev-util/cppunit )
 "
-
 RDEPEND="
 	${DEPEND}
 	monitor? ( $(python_gen_cond_dep '
@@ -65,8 +68,6 @@ RDEPEND="
 	selinux? ( sec-policy/selinux-nut )
 "
 
-S="${WORKDIR}/${MY_P}"
-
 PATCHES=(
 	"${FILESDIR}/${PN}-2.6.2-lowspeed-buffer-size.patch"
 	"${FILESDIR}/systemd_notify.path"
@@ -95,22 +96,15 @@ pkg_pretend() {
 	check_extra_config
 }
 
-src_unpack() {
-	if [[ "${PV}" == *9999 ]] ; then
-		git-r3_src_unpack
-	fi
-	default
-}
-
 pkg_setup() {
-	python-single-r1_pkg_setup
+	use python && python-single-r1_pkg_setup
 }
 
 src_prepare() {
 	default
 
-	if [[ "${PV}" == *9999 ]] ; then
-		./autogen.sh
+	if [[ ${PV} == *9999 ]] ; then
+		./autogen.sh || die
 	fi
 
 	xdg_environment_reset
@@ -121,6 +115,8 @@ src_configure() {
 		--datadir=/usr/share/nut
 		--datarootdir=/usr/share/nut
 		--disable-static
+		--disable-strip
+		--disable-Werror
 		--sysconfdir=/etc/nut
 		--with-dev
 		--with-drvpath="/$(get_libdir)/nut"
@@ -129,6 +125,8 @@ src_configure() {
 		--with-logfacility=LOG_DAEMON
 		--with-statepath=/var/lib/nut
 		--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+		--with-systemdtmpfilesdir="/usr/lib/tmpfiles.d"
+		--with-udev-dir="$(get_udevdir)"
 		--with-user=nut
 		--without-powerman
 		--without-python
@@ -151,15 +149,13 @@ src_configure() {
 		$(use_with zeroconf avahi)
 	)
 
+	filter-lto
 	append-flags -fno-lto
-
-	tc-export CC
-	tc-export CXX
-	tc-export AR
+	tc-export CC CXX AR
 
 	use cgi && myeconfargs+=( --with-cgipath=/usr/share/nut/cgi )
 	use man && myeconfargs+=( --with-doc=man )
-	use python && myeconfargs+=( --with-python3=/usr/bin/python3 ) || myeconfargs+=( --without-python3 )
+	use python && myeconfargs+=( --with-python3="${PYTHON}" ) || myeconfargs+=( --without-python3 )
 
 	export bashcompdir="$(get_bashcompdir)"
 
@@ -169,15 +165,15 @@ src_configure() {
 src_install() {
 	default
 
-	rm -rf "${D}/etc/hotplug" || die
+	rm -rf "${ED}/etc/hotplug" || die
 
-	find "${D}" -name '*.la' -delete || die
+	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 /usr/share/nut/cgi."
+		elog "CGI monitoring scripts are installed in ${EROOT}/usr/share/nut/cgi."
 		elog "copy them to your web server's ScriptPath to activate (this is a"
 		elog "change from the old location)."
 		elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
@@ -185,8 +181,9 @@ src_install() {
 		elog "Use script aliases according to the web server you use (apache, nginx, lighttpd, etc...)"
 	fi
 
-	# this must be done after all of the install phases
-	for i in "${D}"/etc/nut/*.sample ; do
+	# This must be done after all of the install phases
+	local i
+	for i in "${ED}"/etc/nut/*.sample ; do
 		mv "${i}" "${i/.sample/}" || die
 	done
 
@@ -252,7 +249,7 @@ pkg_postinst() {
 	elog
 
 	optfeature "all notify events generate a global message (wall) to all users, plus they are logged via the syslog" \
-		sys-apps/util-linu[logger,tty-helpers]
+		sys-apps/util-linux[logger,tty-helpers]
 
 	udev_reload
 


             reply	other threads:[~2023-06-17  3:55 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17  3:55 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-25  8:49 [gentoo-commits] repo/gentoo:master commit in: sys-power/nut/ Sam James
2025-01-24  8:14 Sam James
2024-10-12 11:22 Michał Górny
2024-10-12 10:08 Michał Górny
2024-10-12  7:52 Michał Górny
2024-05-29 18:27 Robin H. Johnson
2024-05-27 21:08 Robin H. Johnson
2024-05-27 21:08 Robin H. Johnson
2024-02-06  6:54 Sam James
2024-02-06  6:47 Sam James
2024-02-06  6:25 Sam James
2024-02-06  6:25 Sam James
2024-01-17  2:46 Ionen Wolkens
2024-01-01  0:12 Sam James
2023-12-18 13:36 Joonas Niilola
2023-12-18  1:09 Sam James
2023-12-18  0:11 Sam James
2023-12-11 13:04 Joonas Niilola
2023-08-09  3:34 Sam James
2023-06-24  1:18 Sam James
2023-06-17 17:11 Arthur Zamarin
2023-06-17 17:11 Arthur Zamarin
2023-06-17 15:48 Arthur Zamarin
2023-06-17 10:33 Yixun Lan
2023-06-17  3:56 Sam James
2023-06-17  3:19 Sam James
2022-06-21 18:21 Arthur Zamarin
2021-09-21 21:57 Marek Szuba
2021-08-18 14:28 Sam James
2021-08-04 19:37 Sam James
2021-07-09 22:36 Conrad Kostecki
2021-07-09 22:36 Conrad Kostecki
2020-08-30  1:17 Sam James
2020-08-22 15:51 Michał Górny
2020-08-11 18:46 Sam James
2020-08-10 14:33 Agostino Sarubbo
2020-08-07 18:51 Sam James
2020-02-19 18:24 Robin H. Johnson
2020-02-09 16:42 Michał Górny
2020-01-08 22:27 David Seifert
2020-01-08 22:27 David Seifert
2019-08-20 11:47 Louis Sautier
2019-08-13 12:10 Michał Górny
2019-07-29 10:45 Mikle Kolyada
2019-07-02  8:28 Sergei Trofimovich
2019-07-02  8:24 Sergei Trofimovich
2019-06-29 13:03 Agostino Sarubbo
2019-06-28 15:21 Agostino Sarubbo
2018-11-18 15:27 Thomas Deutschmann
2018-11-14 18:23 Robin H. Johnson
2018-10-27 19:02 Andreas Sturmlechner
2018-03-15 16:13 Mikle Kolyada
2018-01-15 19:03 Tobias Klausmann
2018-01-08 22:50 Thomas Deutschmann
2018-01-08 22:24 Sergei Trofimovich
2017-12-08 22:34 Matt Thode
2017-11-26 23:26 David Seifert
2017-03-21 12:57 Michael Weber
2016-12-20 18:21 Thomas Deutschmann
2016-12-20 17:31 Tobias Klausmann
2016-10-02 12:37 Pacho Ramos
2016-03-18 19:11 Michał Górny
2015-09-03  4:53 Matt Thode

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1686974067.a84735cb1e18ea166a702da5dc48f20e89f86fbb.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox