public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Steve Arnold" <nerdboy@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/erlang/files/, dev-lang/erlang/
Date: Tue,  7 Aug 2018 00:25:56 +0000 (UTC)	[thread overview]
Message-ID: <1533601546.cf2f2958d1397ef24fcb402e1115704058c05814.nerdboy@gentoo> (raw)

commit:     cf2f2958d1397ef24fcb402e1115704058c05814
Author:     Stephen L Arnold <nerdboy <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  7 00:24:33 2018 +0000
Commit:     Steve Arnold <nerdboy <AT> gentoo <DOT> org>
CommitDate: Tue Aug  7 00:25:46 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf2f2958

dev-lang/erlang: add create pidfile patch for epmd and openrc

* this is supposed to be clean and minimally invasive, so follows
  upstream idef practices :/

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 dev-lang/erlang/erlang-20.3.2.ebuild               |  1 +
 dev-lang/erlang/erlang-20.3.8.ebuild               |  1 +
 dev-lang/erlang/erlang-20.3.ebuild                 |  3 +-
 dev-lang/erlang/erlang-21.0.2.ebuild               |  1 +
 dev-lang/erlang/files/epmd.init                    | 13 +++-
 ...ang-add-epmd-pid-file-creation-for-openrc.patch | 90 ++++++++++++++++++++++
 6 files changed, 105 insertions(+), 4 deletions(-)

diff --git a/dev-lang/erlang/erlang-20.3.2.ebuild b/dev-lang/erlang/erlang-20.3.2.ebuild
index d9828cad710..fa93bdca560 100644
--- a/dev-lang/erlang/erlang-20.3.2.ebuild
+++ b/dev-lang/erlang/erlang-20.3.2.ebuild
@@ -48,6 +48,7 @@ S="${WORKDIR}/otp-OTP-${PV}"
 PATCHES=(
 		"${FILESDIR}/18.2.1-wx3.0.patch"
 		"${FILESDIR}/${PN}-20.3.2-dont-ignore-LDFLAGS.patch"
+		"${FILESDIR}/${PN}-add-epmd-pid-file-creation-for-openrc.patch"
 	)
 
 SITEFILE=50"${PN}"-gentoo.el

diff --git a/dev-lang/erlang/erlang-20.3.8.ebuild b/dev-lang/erlang/erlang-20.3.8.ebuild
index ed20da173d4..5ca952eeb26 100644
--- a/dev-lang/erlang/erlang-20.3.8.ebuild
+++ b/dev-lang/erlang/erlang-20.3.8.ebuild
@@ -48,6 +48,7 @@ S="${WORKDIR}/otp-OTP-${PV}"
 PATCHES=(
 		"${FILESDIR}/18.2.1-wx3.0.patch"
 		"${FILESDIR}/${PN}-20.3.2-dont-ignore-LDFLAGS.patch"
+		"${FILESDIR}/${PN}-add-epmd-pid-file-creation-for-openrc.patch"
 	)
 
 SITEFILE=50"${PN}"-gentoo.el

diff --git a/dev-lang/erlang/erlang-20.3.ebuild b/dev-lang/erlang/erlang-20.3.ebuild
index 80c077ee54b..80b1e5b08a4 100644
--- a/dev-lang/erlang/erlang-20.3.ebuild
+++ b/dev-lang/erlang/erlang-20.3.ebuild
@@ -48,7 +48,8 @@ SITEFILE=50${PN}-gentoo.el
 src_prepare() {
 	default
 
-	eapply "${FILESDIR}"/18.2.1-wx3.0.patch
+	eapply "${FILESDIR}"/18.2.1-wx3.0.patch \
+		"${FILESDIR}"/${PN}-add-epmd-pid-file-creation-for-openrc.patch
 
 	if ! use odbc; then
 		sed -i 's: odbc : :' lib/Makefile || die

diff --git a/dev-lang/erlang/erlang-21.0.2.ebuild b/dev-lang/erlang/erlang-21.0.2.ebuild
index 4d85955c470..874512907a2 100644
--- a/dev-lang/erlang/erlang-21.0.2.ebuild
+++ b/dev-lang/erlang/erlang-21.0.2.ebuild
@@ -47,6 +47,7 @@ S="${WORKDIR}/otp-OTP-${PV}"
 PATCHES=(
 		"${FILESDIR}/18.2.1-wx3.0.patch"
 		"${FILESDIR}/${PN}-20.3.2-dont-ignore-LDFLAGS.patch"
+		"${FILESDIR}/${PN}-add-epmd-pid-file-creation-for-openrc.patch"
 	)
 
 SITEFILE=50"${PN}"-gentoo.el

diff --git a/dev-lang/erlang/files/epmd.init b/dev-lang/erlang/files/epmd.init
index 9b3b9e2ad72..f0ef7c22416 100644
--- a/dev-lang/erlang/files/epmd.init
+++ b/dev-lang/erlang/files/epmd.init
@@ -1,14 +1,21 @@
 #!/sbin/openrc-run
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the Erlang Public License 1.1
 
+ZT_ADDRESS=""
+pidfile="/var/run/epmd.pid"
+command_args="-daemon -relaxed_command_check -address 127.0.0.1"
+
 depend() {
-	need net
+	need loopback
+	before sshd
 }
 
 start() {
 	ebegin "Starting Erlang Port Mapper Daemon"
-	start-stop-daemon --start --quiet --user nobody --group nobody --exec /usr/bin/epmd -- -daemon
+	start-stop-daemon --start --quiet \
+		--pidfile $pidfile \
+		--exec /usr/bin/epmd -- $command_args
 	eend $?
 }
 

diff --git a/dev-lang/erlang/files/erlang-add-epmd-pid-file-creation-for-openrc.patch b/dev-lang/erlang/files/erlang-add-epmd-pid-file-creation-for-openrc.patch
new file mode 100644
index 00000000000..56e3946c93f
--- /dev/null
+++ b/dev-lang/erlang/files/erlang-add-epmd-pid-file-creation-for-openrc.patch
@@ -0,0 +1,90 @@
+From 04ace92c33a699f75445dc99c30d521311aba826 Mon Sep 17 00:00:00 2001
+From: Steve Arnold <nerdboy@gentoo.org>
+Date: Mon, 6 Aug 2018 16:38:30 -0700
+Subject: [PATCH] Add daemon-mode pid file creation when not configured for
+ systemd
+
+Signed-off-by: Steve Arnold <nerdboy@gentoo.org>
+---
+ erts/epmd/src/epmd.c | 39 ++++++++++++++++++++++++++++++++++++++-
+ erts/epmd/src/epmd.h |  3 +++
+ 2 files changed, 41 insertions(+), 1 deletion(-)
+
+diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c
+index 44e997e609..c74888a1ee 100644
+--- a/erts/epmd/src/epmd.c
++++ b/erts/epmd/src/epmd.c
+@@ -40,6 +40,37 @@ static int check_relaxed(void);
+ #ifdef __WIN32__
+ static int has_console(void);
+ #endif
++#ifndef HAVE_SYSTEMD_DAEMON
++static int create_pidfile(void);
++static const char *pidfile = EPMD_PIDFILE;
++#endif
++
++#ifndef HAVE_SYSTEMD_DAEMON
++static int create_pidfile(void)
++{
++    int fd;
++
++    unlink(pidfile);
++
++    /* open the pidfile */
++    fd = open(pidfile, O_WRONLY|O_CREAT|O_EXCL, 0644);
++    if (fd >= 0) {
++        FILE *f;
++
++        /* write our pid to it */
++        f = fdopen(fd, "w");
++        if (f != NULL) {
++            fprintf(f, "%d\n", getpid());
++            fclose(f);
++            /* leave the fd open */
++            return 0;
++        }
++        close(fd);
++    }
++
++    return -1;
++}
++#endif    /* (no) HAVE_SYSTEMD_DAEMON */
+ 
+ #ifdef DONT_USE_MAIN
+ 
+@@ -340,6 +371,13 @@ static void run_daemon(EpmdVars *g)
+     
+     umask(0);
+ 
++#ifndef HAVE_SYSTEMD_DAEMON
++    if (create_pidfile() < 0) {
++        dbg_perror(g,"could not create pidfile %s", pidfile);
++        epmd_cleanup_exit(g,1);
++    }
++#endif /* HAVE_SYSTEMD_DAEMON */
++
+     for (fd = 0; fd < g->max_conn ; fd++) /* close all files ... */
+         close(fd);
+     /* Syslog on linux will try to write to whatever if we dont
+@@ -614,4 +652,3 @@ static int check_relaxed(void)
+     char* port_str = getenv("ERL_EPMD_RELAXED_COMMAND_CHECK");
+     return (port_str != NULL) ? 1 : 0;
+ }
+-
+diff --git a/erts/epmd/src/epmd.h b/erts/epmd/src/epmd.h
+index cffcd4ae7a..e53322acf5 100644
+--- a/erts/epmd/src/epmd.h
++++ b/erts/epmd/src/epmd.h
+@@ -20,6 +20,9 @@
+ 
+ /* The port number is defined in a makefile */
+ 
++/* The name and path to the pid file */
++#define EPMD_PIDFILE "/var/run/epmd.pid"
++
+ /* Definitions of message codes */
+ 
+ /* Registration and queries */
+-- 
+2.17.0
+


             reply	other threads:[~2018-08-07  0:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07  0:25 Steve Arnold [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-21 11:45 [gentoo-commits] repo/gentoo:master commit in: dev-lang/erlang/files/, dev-lang/erlang/ Matthew Smith
2022-11-25  8:56 Matthew Smith
2022-07-09  8:32 Sam James
2021-07-05  7:49 Sergei Trofimovich
2020-11-07 10:29 Sergei Trofimovich
2019-11-22 13:59 Sergei Trofimovich
2019-10-10  5:38 Joonas Niilola
2019-06-04 17:24 Anthony G. Basile
2018-10-22 10:38 Jeroen Roovers
2018-01-21 11:20 Sergei Trofimovich
2016-01-09 15:05 Dirkjan Ochtman

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=1533601546.cf2f2958d1397ef24fcb402e1115704058c05814.nerdboy@gentoo \
    --to=nerdboy@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