From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A4C0F1382C5 for ; Tue, 27 Apr 2021 10:17:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F2D98E087C; Tue, 27 Apr 2021 10:17:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C7924E087C for ; Tue, 27 Apr 2021 10:17:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 666A7340D2D for ; Tue, 27 Apr 2021 10:17:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8F69059C for ; Tue, 27 Apr 2021 10:17:46 +0000 (UTC) From: "Anna Vyalkova" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anna Vyalkova" Message-ID: <1619518664.6a09bfd48b6caecf555d2c0d32394d9c2eccd2f1.cybertailor@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: net-misc/gmid/files/, net-misc/gmid/ X-VCS-Repository: repo/proj/guru X-VCS-Files: net-misc/gmid/Manifest net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch net-misc/gmid/files/gmid.initd net-misc/gmid/gmid-1.6.1.ebuild net-misc/gmid/gmid-1.6.ebuild net-misc/gmid/gmid-9999.ebuild net-misc/gmid/metadata.xml X-VCS-Directories: net-misc/gmid/ net-misc/gmid/files/ X-VCS-Committer: cybertailor X-VCS-Committer-Name: Anna Vyalkova X-VCS-Revision: 6a09bfd48b6caecf555d2c0d32394d9c2eccd2f1 X-VCS-Branch: dev Date: Tue, 27 Apr 2021 10:17:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e80e6e8f-0c1a-48f2-a762-26240cb2132e X-Archives-Hash: 6685d9965ae518264d5aefaf8518996b commit: 6a09bfd48b6caecf555d2c0d32394d9c2eccd2f1 Author: Anna Vyalkova sysrq in> AuthorDate: Tue Apr 27 10:17:33 2021 +0000 Commit: Anna Vyalkova sysrq in> CommitDate: Tue Apr 27 10:17:44 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=6a09bfd4 net-misc/gmid: version bump to 1.6.1 also... * include patch from the application developer to make a pidfile * alter init.d script * update a live ebuild Package-Manager: Portage-3.0.18, Repoman-3.0.3 Signed-off-by: Anna Vyalkova sysrq.in> net-misc/gmid/Manifest | 2 +- net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch | 111 +++++++++++++++++++++ net-misc/gmid/files/gmid.initd | 7 +- .../gmid/{gmid-1.6.ebuild => gmid-1.6.1.ebuild} | 4 +- net-misc/gmid/gmid-9999.ebuild | 12 +-- net-misc/gmid/metadata.xml | 1 - 6 files changed, 117 insertions(+), 20 deletions(-) diff --git a/net-misc/gmid/Manifest b/net-misc/gmid/Manifest index 00cf99da9..636020c63 100644 --- a/net-misc/gmid/Manifest +++ b/net-misc/gmid/Manifest @@ -1 +1 @@ -DIST gmid-1.6.tar.gz 59402 BLAKE2B 1a13ae3f598a406e7920ad3a4f73cb230d70fe3bf4a1017d8d196ab80fdc0ffcf339ad79c64de93dc69d06e294132d714ad8ea1a5248dc69377e8d088f772d6c SHA512 cf118ac3b067b23d480006bccf36218ab0bf91d778092855a01706782fb0c68252157615d92d143d29deb8331422ef1263228b9eb53dd30e64a480b17c48af7a +DIST gmid-1.6.1.tar.gz 59488 BLAKE2B 147c8eb4e1c7195405fdce9bef8260e1a3acb145e9dfd2cb3fb126e4445685a3a1826906b01699429e98a61db6bb2089ec3399a1403323b36adf2555afc61bf2 SHA512 b98592e4bb5b1121fad07dc1fcbdbc95ce69a5648b3c2d22dba974511ae265255be62a330125c2da9b0b357edc2f24065fd8b475013d3d2023a8eded2c01a490 diff --git a/net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch b/net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch new file mode 100644 index 000000000..f95d583a7 --- /dev/null +++ b/net-misc/gmid/files/gmid-1.6.1-make-pidfile.patch @@ -0,0 +1,111 @@ +--- a/gmid.1 ++++ b/gmid.1 +@@ -22,6 +22,7 @@ + .Bk -words + .Op Fl fnv + .Op Fl c Ar config ++.Op Fl P Ar pidfile + .Ek + .Nm + .Bk -words +@@ -51,6 +52,10 @@ Specify the configuration file. + Stays and logs on the foreground. + .It Fl n + Check that the configuration is valid, but don't start the server. ++.It Fl P Pa pidfile ++Write ++.Nm ++pid to the given path. + .El + .Pp + If no configuration file is given, +--- a/gmid.c ++++ b/gmid.c +@@ -316,7 +316,7 @@ static void + usage(const char *me) + { + fprintf(stderr, +- "USAGE: %s [-fn] [-c config] | [-6h] [-d certs-dir] [-H host]\n" ++ "USAGE: %s [-fn] [-c config] [-P pidfile] | [-6h] [-d certs-dir] [-H host]\n" + " [-p port] [-x cgi] [dir]\n", + me); + } +@@ -411,6 +411,34 @@ serve(int argc, char **argv, struct imsgbuf *ibuf) + _exit(executor_main(ibuf)); + } + ++static int ++write_pidfile(const char *pidfile) ++{ ++ struct flock lock; ++ int fd; ++ ++ if (pidfile == NULL) ++ return -1; ++ ++ if ((fd = open(pidfile, O_WRONLY|O_CREAT|O_CLOEXEC, 0600)) == -1) ++ fatal("can't open pidfile %s: %s", pidfile, strerror(errno)); ++ ++ lock.l_start = 0; ++ lock.l_len = 0; ++ lock.l_type = F_WRLCK; ++ lock.l_whence = SEEK_SET; ++ ++ if (fcntl(fd, F_SETLK, &lock) == -1) ++ fatal("can't lock %s, gmid is already running?", pidfile); ++ ++ if (ftruncate(fd, 0) == -1) ++ fatal("ftruncate: %s: %s", pidfile, strerror(errno)); ++ ++ dprintf(fd, "%d\n", getpid()); ++ ++ return fd; ++} ++ + static void + setup_configless(int argc, char **argv, const char *cgi) + { +@@ -434,11 +462,12 @@ main(int argc, char **argv) + { + struct imsgbuf exibuf; + int ch, conftest = 0, configless = 0; +- int old_ipv6, old_port; ++ int pidfd, old_ipv6, old_port; ++ const char *pidfile = NULL; + + init_config(); + +- while ((ch = getopt(argc, argv, "6c:d:fH:hnp:vx:")) != -1) { ++ while ((ch = getopt(argc, argv, "6c:d:fH:hnP:p:vx:")) != -1) { + switch (ch) { + case '6': + conf.ipv6 = 1; +@@ -472,6 +501,10 @@ main(int argc, char **argv) + conftest = 1; + break; + ++ case 'P': ++ pidfile = optarg; ++ break; ++ + case 'p': + conf.port = parse_portno(optarg); + configless = 1; +@@ -536,6 +569,8 @@ main(int argc, char **argv) + return 0; + } + ++ pidfd = write_pidfile(pidfile); ++ + /* Linux seems to call the event handlers even when we're + * doing a sigwait. These dummy handlers are here to avoid + * being terminated on SIGHUP, SIGINT or SIGTERM. */ +@@ -604,5 +639,8 @@ main(int argc, char **argv) + imsg_compose(&logibuf, IMSG_QUIT, 0, 0, -1, NULL, 0); + imsg_flush(&logibuf); + ++ if (pidfd != -1) ++ close(pidfd); ++ + return 0; + } diff --git a/net-misc/gmid/files/gmid.initd b/net-misc/gmid/files/gmid.initd index 6607c7d2f..a5f3b9f7e 100644 --- a/net-misc/gmid/files/gmid.initd +++ b/net-misc/gmid/files/gmid.initd @@ -12,9 +12,8 @@ description_reload="Reload the gmid configuration without losing connections." GMID_CONFIGFILE=${GMID_CONFIGFILE:-/etc/gmid/gmid.conf} command="/usr/bin/gmid" -command_args="-c \"${GMID_CONFIGFILE}\" -f" -command_background=1 pidfile="/var/run/gmid.pid" +command_args="-c \"${GMID_CONFIGFILE}\" -P ${pidfile}" depend() { need net @@ -33,10 +32,6 @@ stop_pre() { fi } -stop_post() { - rm -f ${pidfile} -} - reload() { configtest || return 1 ebegin "Refreshing gmid's configuration" diff --git a/net-misc/gmid/gmid-1.6.ebuild b/net-misc/gmid/gmid-1.6.1.ebuild similarity index 94% rename from net-misc/gmid/gmid-1.6.ebuild rename to net-misc/gmid/gmid-1.6.1.ebuild index 3e844bfec..3f3f487a7 100644 --- a/net-misc/gmid/gmid-1.6.ebuild +++ b/net-misc/gmid/gmid-1.6.1.ebuild @@ -8,7 +8,7 @@ SSL_DAYS=36500 inherit ssl-cert toolchain-funcs -DESCRIPTION="simple and secure Gemini server" +DESCRIPTION="Simple and secure Gemini server" HOMEPAGE="https://www.omarpolo.com/pages/gmid.html" if [[ ${PV} == "9999" ]] ; then @@ -23,6 +23,8 @@ LICENSE="ISC" SLOT="0" IUSE="libressl" +PATCHES=( "${FILESDIR}"/${P}-make-pidfile.patch ) + DEPEND="acct-user/gemini dev-libs/libevent !libressl? ( dev-libs/libretls ) diff --git a/net-misc/gmid/gmid-9999.ebuild b/net-misc/gmid/gmid-9999.ebuild index 3e844bfec..9398659da 100644 --- a/net-misc/gmid/gmid-9999.ebuild +++ b/net-misc/gmid/gmid-9999.ebuild @@ -8,7 +8,7 @@ SSL_DAYS=36500 inherit ssl-cert toolchain-funcs -DESCRIPTION="simple and secure Gemini server" +DESCRIPTION="Simple and secure Gemini server" HOMEPAGE="https://www.omarpolo.com/pages/gmid.html" if [[ ${PV} == "9999" ]] ; then @@ -33,16 +33,6 @@ RDEPEND="${DEPEND}" DOCS=( README.md ChangeLog ) -src_prepare() { - default - - # QA Notice: command not found - # remove `etags` from the "all" target - sed \ - -e "s/^\(all: .*\) TAGS \(.*\)$/\1 \2/" \ - -i Makefile || die -} - src_configure() { # note: not an autoconf configure script ./configure \ diff --git a/net-misc/gmid/metadata.xml b/net-misc/gmid/metadata.xml index 2f806f847..db6c28fd0 100644 --- a/net-misc/gmid/metadata.xml +++ b/net-misc/gmid/metadata.xml @@ -6,7 +6,6 @@ Omar Polo op@omarpolo.com - https://git.omarpolo.com/gmid/tree/ChangeLog cyber@sysrq.in