- up to 17.3; add systemd scripts; enable smp support auto/th/erlang-17.3-1
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Wed, 15 Oct 2014 07:42:38 +0000 (09:42 +0200)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Wed, 15 Oct 2014 07:42:38 +0000 (09:42 +0200)
epmd.service [new file with mode: 0644]
epmd.socket [new file with mode: 0644]
epmd@.service [new file with mode: 0644]
epmd@.socket [new file with mode: 0644]
erlang.spec
otp-0007-Added-systemd-notify-support-to-EPMD.patch [new file with mode: 0644]

diff --git a/epmd.service b/epmd.service
new file mode 100644 (file)
index 0000000..6881195
--- /dev/null
@@ -0,0 +1,25 @@
+[Unit]
+Description=Erlang Port Mapper Daemon
+After=network.target
+Requires=epmd.socket
+
+[Service]
+ExecStart=/usr/bin/epmd -systemd
+#ExecStop=/usr/bin/epmd -kill
+Type=notify
+StandardOutput=journal
+StandardError=journal
+DeviceAllow=/dev/null rw
+PrivateTmp=true
+#CapabilityBoundingSet=
+NoNewPrivileges=true
+Restart=always
+LimitNPROC=1
+LimitFSIZE=0
+User=epmd
+Group=epmd
+
+[Install]
+Also=epmd.socket
+WantedBy=multi-user.target
+
diff --git a/epmd.socket b/epmd.socket
new file mode 100644 (file)
index 0000000..8eee066
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Erlang Port Mapper Daemon Activation Socket
+
+[Socket]
+ListenStream=127.0.0.1:4369
+Accept=false
+
+[Install]
+WantedBy=sockets.target
+
diff --git a/epmd@.service b/epmd@.service
new file mode 100644 (file)
index 0000000..822268f
--- /dev/null
@@ -0,0 +1,25 @@
+[Unit]
+Description=Erlang Port Mapper Daemon
+After=network.target
+Requires=epmd@.socket
+
+[Service]
+ExecStart=/usr/bin/epmd -systemd
+#ExecStop=/usr/bin/epmd -kill
+Type=notify
+StandardOutput=journal
+StandardError=journal
+DeviceAllow=/dev/null rw
+PrivateTmp=true
+#CapabilityBoundingSet=
+NoNewPrivileges=true
+Restart=always
+LimitNPROC=1
+LimitFSIZE=0
+User=epmd
+Group=epmd
+
+[Install]
+Also=epmd@.socket
+WantedBy=multi-user.target
+
diff --git a/epmd@.socket b/epmd@.socket
new file mode 100644 (file)
index 0000000..5dda63d
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Erlang Port Mapper Daemon Activation Socket
+
+[Socket]
+ListenStream=%i:4369
+Accept=false
+
+[Install]
+WantedBy=sockets.target
+
index cc60d60..6c4ca1a 100644 (file)
 Summary:       OpenSource Erlang/OTP
 Summary(pl.UTF-8):     Erlang/OTP z otwartymi źródłami
 Name:          erlang
-Version:       17.1
+Version:       17.3
 Release:       1
 Epoch:         2
 %define                _version        %(echo %{version} | tr _ -)
 License:       distributable
 Group:         Development/Languages
 Source0:       http://www.erlang.org/download/otp_src_%{_version}.tar.gz
-# Source0-md5: 9c90706ce70e01651adde34a2b79bf4c
+# Source0-md5: 1d0bb2d54dfe1bb6844756b99902ba20
 Source1:       http://www.erlang.org/download/otp_doc_man_%{_version}.tar.gz
-# Source1-md5: a64a5d0214936211bfb3bac4b824ad49
+# Source1-md5: 6aa12c96d8d58ecc7be855c99286fc61
+Source2:       epmd.service
+Source3:       epmd.socket
+Source4:       epmd@.service
+Source5:       epmd@.socket
 Patch0:                %{name}-fPIC.patch
+Patch1:                otp-0007-Added-systemd-notify-support-to-EPMD.patch
 URL:           http://www.erlang.org/
 %{?with_java:BuildRequires:    /usr/bin/jar}
-BuildRequires: xorg-lib-libX11-devel
 BuildRequires: autoconf
 BuildRequires: automake
 BuildRequires: flex
@@ -36,11 +40,14 @@ BuildRequires:      ncurses-devel
 BuildRequires: openssl-devel >= 0.9.7
 BuildRequires: openssl-tools
 BuildRequires: perl-base
+BuildRequires: xorg-lib-libX11-devel
 %if %{with odbc}
 BuildRequires: unixODBC-devel
 %else
 BuildConflicts:        unixODBC-devel
 %endif
+Requires:      systemd-units >= 38
+Requires(post,preun,postun):   systemd-units >= 38
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define _erl_target %(echo %{_build}-gnu | sed -e's/amd64/x86_64/;s/athlon/i686/;s/ppc/powerpc/')
@@ -59,6 +66,7 @@ rozpowszechnianiu Erlanga poza Ericssonem.
 %setup -q -n otp_src_%{_version}
 %{__tar} xzf %{SOURCE1} man/ COPYRIGHT
 #%patch0 -p1
+%patch1 -p1
 
 %build
 find . -name config.sub | xargs -n 1 cp -f /usr/share/automake/config.sub
@@ -72,6 +80,8 @@ done
 %ifarch sparc
        CFLAGS="%{rpmcflags} -mv8plus" \
 %endif
+       --disable-silent-rules \
+       --enable-smp-support \
        --with-javac%{!?with_java:=no}
 rm -f lib/ssl/SKIP
 ERL_TOP=`pwd`; export ERL_TOP
@@ -86,6 +96,11 @@ rm -rf $RPM_BUILD_ROOT
        TARGET="%{_erl_target}" \
        INSTALL_PREFIX=$RPM_BUILD_ROOT
 
+install -D -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/epmd.service
+install -D -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/epmd.socket
+install -D -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/epmd@.service
+install -D -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/epmd@.socket
+
 sed -i -e"s#$RPM_BUILD_ROOT##" \
        $RPM_BUILD_ROOT%{_libdir}/%{name}/bin/{erl,start,start_erl}
 
@@ -107,6 +122,17 @@ find $RPM_BUILD_ROOT%{_libdir}/%{name}/lib -type f '!' -perm -500 \
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+%systemd_post epmd.service
+%systemd_post epmd@.service
+
+%preun
+%systemd_preun epmd.service
+%systemd_preun epmd@.service
+
+%postun
+%systemd_reload
+
 %files -f lib.list
 %defattr(644,root,root,755)
 %doc AUTHORS EPLICENCE COPYRIGHT
@@ -160,3 +186,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/%{name}/usr
 %doc %{_libdir}/%{name}/man
 %attr(755,root,root) %{_libdir}/%{name}/Install
+
+%{systemdunitdir}/epmd.service
+%{systemdunitdir}/epmd.socket
+%{systemdunitdir}/epmd@.service
+%{systemdunitdir}/epmd@.socket
diff --git a/otp-0007-Added-systemd-notify-support-to-EPMD.patch b/otp-0007-Added-systemd-notify-support-to-EPMD.patch
new file mode 100644 (file)
index 0000000..dd4ddcd
--- /dev/null
@@ -0,0 +1,45 @@
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Fri, 6 Jun 2014 15:29:49 +0400
+Subject: [PATCH] Added systemd notify support to EPMD
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+
+Conflicts:
+       erts/configure.in
+
+diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c
+index 3cfa7a7..67e8b49 100644
+--- a/erts/epmd/src/epmd.c
++++ b/erts/epmd/src/epmd.c
+@@ -589,9 +589,11 @@ void epmd_cleanup_exit(EpmdVars *g, int exitval)
+       for(i=0; g->argv[i] != NULL; ++i)
+         free(g->argv[i]);
+       free(g->argv);
+-  }      
+-      
+-
++  }
++#ifdef HAVE_SYSTEMD_SD_DAEMON_H
++  sd_notifyf(0, "STATUS=Exited.\n"
++                "ERRNO=%i", exitval);
++#endif // HAVE_SYSTEMD_SD_DAEMON_H
+   exit(exitval);
+ }
+diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c
+index 48fd7a5..18d898a 100644
+--- a/erts/epmd/src/epmd_srv.c
++++ b/erts/epmd/src/epmd_srv.c
+@@ -399,8 +399,11 @@ void run(EpmdVars *g)
+       }
+       select_fd_set(g, listensock[i]);
+     }
+-#ifdef HAVE_SYSTEMD_SD_DAEMON_H 
++#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+     }
++    sd_notifyf(0, "READY=1\n"
++                  "STATUS=Processing port mapping requests...\n"
++                  "MAINPID=%lu", (unsigned long) getpid());
+ #endif
+   dbg_tty_printf(g,2,"entering the main select() loop");
This page took 0.090676 seconds and 4 git commands to generate.