]>
Commit | Line | Data |
---|---|---|
b53d342f | 1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
aa62a755 | 4 | |
b53d342f | 5 | %define pdir Server |
6 | %define pnam Starter | |
b53d342f | 7 | Summary: Server::Starter - a superdaemon for hot-deploying server programs |
b53d342f | 8 | Name: perl-Server-Starter |
b8f3d75c | 9 | Version: 0.35 |
b53d342f | 10 | Release: 1 |
11 | # same as perl | |
12 | License: GPL v1+ or Artistic | |
13 | Group: Development/Languages/Perl | |
14 | Source0: http://www.cpan.org/modules/by-module/Server/%{pdir}-%{pnam}-%{version}.tar.gz | |
b8f3d75c | 15 | # Source0-md5: 10cc818382ff22b27d9af37344fbff18 |
aa62a755 | 16 | URL: http://search.cpan.org/dist/Server-Starter/ |
b53d342f | 17 | BuildRequires: perl-devel >= 1:5.8.0 |
18 | BuildRequires: rpm-perlprov >= 4.1-13 | |
b53d342f | 19 | %if %{with tests} |
20 | BuildRequires: perl-List-MoreUtils | |
21 | BuildRequires: perl-Proc-Wait3 | |
22 | BuildRequires: perl-Scope-Guard | |
23 | %endif | |
24 | BuildArch: noarch | |
25 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
26 | ||
27 | %description | |
28 | It is often a pain to write a server program that supports graceful | |
29 | restarts, with no resource leaks. Server::Starter, solves the problem | |
30 | by splitting the task into two. One is start_server, a script provided | |
31 | as a part of the module, which works as a superdaemon that binds to | |
32 | zero or more TCP ports or unix sockets, and repeatedly spawns the | |
33 | server program that actually handles the necessary tasks (for example, | |
34 | responding to incoming commenctions). The spawned server programs | |
35 | under Server::Starter call accept(2) and handle the requests. | |
36 | ||
37 | To gracefully restart the server program, send SIGHUP to the | |
38 | superdaemon. The superdaemon spawns a new server program, and if (and | |
39 | only if) it starts up successfully, sends SIGTERM to the old server | |
40 | program. | |
41 | ||
42 | By using Server::Starter it is much easier to write a hot-deployable | |
43 | server. Following are the only requirements a server program to be run | |
44 | under Server::Starter should conform to: | |
45 | ||
46 | - receive file descriptors to listen to through an environment | |
47 | variable | |
48 | - perform a graceful shutdown when receiving SIGTERM | |
49 | ||
50 | A Net::Server personality that can be run under Server::Starter exists | |
51 | under the name Net::Server::SS::PreFork. | |
52 | ||
b53d342f | 53 | %prep |
54 | %setup -q -n %{pdir}-%{pnam}-%{version} | |
55 | ||
56 | %build | |
b8f3d75c AM |
57 | %{__perl} Build.PL \ |
58 | --destdir=$RPM_BUILD_ROOT \ | |
59 | --installdirs=vendor | |
60 | ./Build | |
b53d342f | 61 | |
b8f3d75c | 62 | %{?with_tests:./Build test} |
b53d342f | 63 | |
64 | %install | |
65 | rm -rf $RPM_BUILD_ROOT | |
66 | ||
b8f3d75c | 67 | ./Build install |
b53d342f | 68 | |
69 | %clean | |
70 | rm -rf $RPM_BUILD_ROOT | |
71 | ||
72 | %files | |
73 | %defattr(644,root,root,755) | |
b8f3d75c | 74 | %doc Changes README.md |
b53d342f | 75 | %attr(755,root,root) %{_bindir}/start_server |
76 | %{_mandir}/man1/start_server.1p* | |
b8f3d75c AM |
77 | %dir %{perl_vendorlib}/Server/Starter |
78 | %{perl_vendorlib}/Server/Starter/Guard.pm | |
b53d342f | 79 | %{perl_vendorlib}/Server/*.pm |
80 | %{_mandir}/man3/* |