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: net-analyzer/darkstat/
Date: Wed,  4 May 2022 04:23:24 +0000 (UTC)	[thread overview]
Message-ID: <1651637958.210c3f977cf72db1948716e4b7d85c7a5a984b5f.sam@gentoo> (raw)

commit:     210c3f977cf72db1948716e4b7d85c7a5a984b5f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May  4 04:10:31 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May  4 04:19:18 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=210c3f97

net-analyzer/darkstat: add error handling; EAPI 8; live template

- EAPI 8
- Add error handling for if chroot directory is empty (don't try to chown /;
  thankfully no -R option was there)
- Use fowners instead of chown to notice missing user earlier (although shouldn't
  happen)
- Use live ebuild template

Reported-by: Corvus
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...t-9999999.ebuild => darkstat-3.0.719-r4.ebuild} | 46 +++++++++++----------
 net-analyzer/darkstat/darkstat-9999999.ebuild      | 48 ++++++++++++----------
 2 files changed, 52 insertions(+), 42 deletions(-)

diff --git a/net-analyzer/darkstat/darkstat-9999999.ebuild b/net-analyzer/darkstat/darkstat-3.0.719-r4.ebuild
similarity index 58%
copy from net-analyzer/darkstat/darkstat-9999999.ebuild
copy to net-analyzer/darkstat/darkstat-3.0.719-r4.ebuild
index 4ca39eb748e3..1f62dd3d13c0 100644
--- a/net-analyzer/darkstat/darkstat-9999999.ebuild
+++ b/net-analyzer/darkstat/darkstat-3.0.719-r4.ebuild
@@ -1,32 +1,33 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
-inherit autotools git-r3
+inherit autotools
 
 DESCRIPTION="Network traffic analyzer with cute web interface"
 HOMEPAGE="https://unix4lyfe.org/darkstat/"
-EGIT_REPO_URI="https://www.unix4lyfe.org/git/darkstat"
+if [[ ${PV} == *9999* ]] ; then
+	EGIT_REPO_URI="https://www.unix4lyfe.org/git/darkstat"
+	inherit git-r3
+else
+	SRC_URI="https://unix4lyfe.org/${PN}/${P}.tar.bz2"
+	KEYWORDS="~amd64 ~ppc ~x86"
+fi
 
 LICENSE="GPL-2"
 SLOT="0"
-KEYWORDS=""
 
-BDEPEND="
-	app-editors/vim-core
-"
-DEPEND="
-	acct-user/darkstat
+DEPEND="acct-user/darkstat
 	dev-libs/libbsd
 	net-libs/libpcap
-	sys-libs/zlib
-"
-RDEPEND="
-	${DEPEND}
-"
+	sys-libs/zlib"
+RDEPEND="${DEPEND}"
+
 DARKSTAT_CHROOT_DIR=${DARKSTAT_CHROOT_DIR:-/var/lib/darkstat}
+
 DOCS=( AUTHORS ChangeLog README NEWS )
+
 PATCHES=(
 	"${FILESDIR}"/${PN}-3.0.719-strncpy-off-by-one.patch
 )
@@ -56,21 +57,24 @@ src_install() {
 	sed -i -e "s:__CHROOT__:${DARKSTAT_CHROOT_DIR}:g" "${D}"/etc/init.d/darkstat || die
 
 	keepdir "${DARKSTAT_CHROOT_DIR}"
-	chown darkstat:0 "${D}${DARKSTAT_CHROOT_DIR}"
+	fowners darkstat:0 "${DARKSTAT_CHROOT_DIR}"
 }
 
 pkg_postinst() {
 	# Workaround bug #141619
 	DARKSTAT_CHROOT_DIR=$(
-		sed -n 's/^#CHROOT=\(.*\)/\1/p' "${ROOT}"/etc/conf.d/darkstat
+		sed -n 's/^#CHROOT=\(.*\)/\1/p' "${EROOT}"/etc/conf.d/darkstat
 	)
-	chown darkstat:0 "${ROOT}${DARKSTAT_CHROOT_DIR}"
+
+	if [[ -n "${DARKSTAT_CHROOT_DIR}" ]] && [[ "${DARKSTAT_CHROOT_DIR}" != "${EROOT:-/}" ]] ; then
+		chown darkstat:0 "${EROOT}/${DARKSTAT_CHROOT_DIR#/}/"
+	fi
 
 	elog "To start different darkstat instances which will listen on a different"
-	elog "interfaces create in /etc/init.d directory the 'darkstat.if' symlink to"
+	elog "interface, create within the ${EROOT}/etc/init.d directory a 'darkstat.if' symlink to"
 	elog "darkstat script where 'if' is the name of the interface."
-	elog "Also in /etc/conf.d directory copy darkstat to darkstat.if"
+	elog "Also in the ${EROOT}/etc/conf.d directory, copy darkstat to darkstat.if"
 	elog "and edit it to change default values."
 	elog
-	elog "darkstat's default chroot directory is: \"${ROOT}${DARKSTAT_CHROOT_DIR}\""
+	elog "darkstat's default chroot directory is: ${EROOT}/${DARKSTAT_CHROOT_DIR#/}"
 }

diff --git a/net-analyzer/darkstat/darkstat-9999999.ebuild b/net-analyzer/darkstat/darkstat-9999999.ebuild
index 4ca39eb748e3..1274c0c32950 100644
--- a/net-analyzer/darkstat/darkstat-9999999.ebuild
+++ b/net-analyzer/darkstat/darkstat-9999999.ebuild
@@ -1,32 +1,35 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
-inherit autotools git-r3
+inherit autotools
 
 DESCRIPTION="Network traffic analyzer with cute web interface"
 HOMEPAGE="https://unix4lyfe.org/darkstat/"
-EGIT_REPO_URI="https://www.unix4lyfe.org/git/darkstat"
+if [[ ${PV} == *9999* ]] ; then
+	EGIT_REPO_URI="https://www.unix4lyfe.org/git/darkstat"
+	inherit git-r3
+else
+	SRC_URI="https://unix4lyfe.org/${PN}/${P}.tar.bz2"
+	KEYWORDS="~amd64 ~ppc ~x86"
+fi
 
 LICENSE="GPL-2"
 SLOT="0"
-KEYWORDS=""
 
-BDEPEND="
-	app-editors/vim-core
-"
-DEPEND="
-	acct-user/darkstat
+# The live ebuild requires xxd to generate favicon.h.
+BDEPEND="app-editors/vim-core"
+DEPEND="acct-user/darkstat
 	dev-libs/libbsd
 	net-libs/libpcap
-	sys-libs/zlib
-"
-RDEPEND="
-	${DEPEND}
-"
+	sys-libs/zlib"
+RDEPEND="${DEPEND}"
+
 DARKSTAT_CHROOT_DIR=${DARKSTAT_CHROOT_DIR:-/var/lib/darkstat}
+
 DOCS=( AUTHORS ChangeLog README NEWS )
+
 PATCHES=(
 	"${FILESDIR}"/${PN}-3.0.719-strncpy-off-by-one.patch
 )
@@ -56,21 +59,24 @@ src_install() {
 	sed -i -e "s:__CHROOT__:${DARKSTAT_CHROOT_DIR}:g" "${D}"/etc/init.d/darkstat || die
 
 	keepdir "${DARKSTAT_CHROOT_DIR}"
-	chown darkstat:0 "${D}${DARKSTAT_CHROOT_DIR}"
+	fowners darkstat:0 "${DARKSTAT_CHROOT_DIR}"
 }
 
 pkg_postinst() {
 	# Workaround bug #141619
 	DARKSTAT_CHROOT_DIR=$(
-		sed -n 's/^#CHROOT=\(.*\)/\1/p' "${ROOT}"/etc/conf.d/darkstat
+		sed -n 's/^#CHROOT=\(.*\)/\1/p' "${EROOT}"/etc/conf.d/darkstat
 	)
-	chown darkstat:0 "${ROOT}${DARKSTAT_CHROOT_DIR}"
+
+	if [[ -n "${DARKSTAT_CHROOT_DIR}" ]] && [[ "${DARKSTAT_CHROOT_DIR}" != "${EROOT:-/}" ]] ; then
+		chown darkstat:0 "${EROOT}/${DARKSTAT_CHROOT_DIR#/}/"
+	fi
 
 	elog "To start different darkstat instances which will listen on a different"
-	elog "interfaces create in /etc/init.d directory the 'darkstat.if' symlink to"
+	elog "interface, create within the ${EROOT}/etc/init.d directory a 'darkstat.if' symlink to"
 	elog "darkstat script where 'if' is the name of the interface."
-	elog "Also in /etc/conf.d directory copy darkstat to darkstat.if"
+	elog "Also in the ${EROOT}/etc/conf.d directory, copy darkstat to darkstat.if"
 	elog "and edit it to change default values."
 	elog
-	elog "darkstat's default chroot directory is: \"${ROOT}${DARKSTAT_CHROOT_DIR}\""
+	elog "darkstat's default chroot directory is: ${EROOT}/${DARKSTAT_CHROOT_DIR#/}"
 }


             reply	other threads:[~2022-05-04  4:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04  4:23 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-12-18 19:36 [gentoo-commits] repo/gentoo:master commit in: net-analyzer/darkstat/ Arthur Zamarin
2022-05-05  1:35 Sam James
2022-05-04  4:23 Sam James
2022-05-04  4:23 Sam James
2021-03-15 22:02 Sam James
2021-03-15 21:54 Sam James
2021-03-15 21:25 Sam James
2021-03-15 21:25 Sam James
2020-10-03 15:30 David Seifert
2020-07-03 11:07 Jeroen Roovers
2020-07-03  9:55 Jeroen Roovers
2020-07-03  9:55 Jeroen Roovers
2017-03-08  5:03 Jeroen Roovers
2017-02-24 14:07 Agostino Sarubbo
2017-02-22 16:08 Agostino Sarubbo
2017-02-22 15:06 Agostino Sarubbo
2017-02-21 23:55 Jeroen Roovers

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=1651637958.210c3f977cf72db1948716e4b7d85c7a5a984b5f.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