Browse code

Adding pgbouncer and libevent: BugId: 1651068, 1651069 (github issue # 432,433)

Change-Id: Idde72deb38ec2863c3df8c29476b6560e9bc63ec
Reviewed-on: http://photon-jenkins.eng.vmware.com/772
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: suezzelur <anishs@vmware.com>

Kumar Kaushik authored on 2016/04/29 09:12:33
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,55 @@
0
+Summary:	An Event notification library.
1
+Name:		libevent
2
+Version:	2.0.22
3
+Release:	1%{?dist}
4
+License:	BSD
5
+URL:		http://libevent.org
6
+Source0:        https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/%{name}-%{version}-stable.tar.gz
7
+%define sha1 libevent=a586882bc93a208318c70fc7077ed8fca9862864
8
+Group:		System/Library
9
+Vendor:		VMware, Inc.
10
+Distribution:	Photon
11
+BuildRequires:  pkg-config
12
+BuildRequires:  openssl-devel
13
+
14
+%description
15
+The libevent API provides a mechanism to execute a callback function when a specific event 
16
+occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also 
17
+support callbacks due to signals or regular timeouts.
18
+
19
+%package        devel
20
+Summary:        Development files for libevent
21
+Group:          Development/Libraries
22
+Requires:       %{name} = %{version}-%{release}
23
+
24
+%description    devel
25
+The subpackage includes all development related headers and library.
26
+
27
+%prep
28
+%setup -q -n %{name}-%{version}-stable
29
+
30
+%build
31
+%configure --disable-static --disable-libevent-regress
32
+make %{?_smp_mflags}
33
+
34
+%install
35
+%makeinstall
36
+
37
+%post -p /sbin/ldconfig
38
+
39
+%files
40
+%defattr(-,root,root)
41
+%{_libdir}/*
42
+
43
+%files devel
44
+%defattr(-,root,root)
45
+%{_includedir}/*
46
+%{_bindir}/event_rpcgen.py
47
+%{_libdir}/*.so
48
+%{_libdir}/pkgconfig/libevent.pc
49
+%{_libdir}/pkgconfig/libevent_pthreads.pc
50
+%{_libdir}/pkgconfig/libevent_openssl.pc
51
+
52
+%changelog
53
+*       Thu Apr 28 2016 Kumar Kaushik <kaushikk@vmware.com> 2.0.22-1
54
+-       Initial Version.
0 55
new file mode 100644
... ...
@@ -0,0 +1,77 @@
0
+Summary:	Connection pooler for PostgreSQL.
1
+Name:		pgbouncer
2
+Version:	1.7.2
3
+Release:	1%{?dist}
4
+License:	BSD
5
+URL:		https://wiki.postgresql.org/wiki/PgBouncer
6
+Source0:        https://pgbouncer.github.io/downloads/files/1.7.2/%{name}-%{version}.tar.gz
7
+%define sha1 pgbouncer=d9bb29da15d90713e2399af3ebf5019da5cbe2d6
8
+Group:		Application/Databases.
9
+Vendor:		VMware, Inc.
10
+Distribution:	Photon
11
+BuildRequires:  libevent-devel
12
+BuildRequires:  openssl-devel
13
+BuildRequires:  systemd
14
+BuildRequires:  pkg-config
15
+
16
+%description
17
+Pgbouncer is a light-weight, robust connection pooler for PostgreSQL.
18
+
19
+%prep
20
+%setup
21
+
22
+%build
23
+%configure --datadir=%{_datadir}
24
+make %{?_smp_mflags} V=1
25
+
26
+%install
27
+[ %{buildroot} != "/"] && rm -rf %{buildroot}/*
28
+make DESTDIR=%{buildroot} install
29
+install -vdm 744 %{buildroot}/var/log/pgbouncer
30
+install -vdm 755 %{buildroot}/var/run/pgbouncer
31
+install -p -d %{buildroot}%{_sysconfdir}/
32
+install -p -d %{buildroot}%{_sysconfdir}/sysconfig
33
+install -p -m 644 etc/pgbouncer.ini %{buildroot}%{_sysconfdir}/
34
+mkdir -p %{buildroot}/etc/systemd/system/
35
+cat << EOF >> %{buildroot}/etc/systemd/system/%{name}.service
36
+[Unit]
37
+Description=Connection poller for PostgreSQL.
38
+After=syslog.target network.target
39
+
40
+[Service]
41
+ExecStart=/usr/bin/pgbouncer --quiet --user pgbouncer /etc/pgbouncer.ini
42
+ExecReload=/bin/kill -USR2 $MAINPID
43
+Restart=always
44
+
45
+[Install]
46
+WantedBy=multi-user.target
47
+EOF
48
+
49
+%pre
50
+/sbin/groupadd -r %{name}
51
+/sbin/useradd -g %{name} %{name}
52
+
53
+%post
54
+chown %{name}:%{name} /var/log/%{name}
55
+chown %{name}:%{name} /var/run/%{name}
56
+
57
+%postun
58
+/sbin/userdel pgbouncer
59
+/sbin/groupdel pgbouncer
60
+rm -rf /var/log/%{name}
61
+rm -rf /var/run/%{name}
62
+
63
+%files
64
+%defattr(-,root,root,-)
65
+%{_bindir}/*
66
+/etc/systemd/system/%{name}.service
67
+%config(noreplace) %{_sysconfdir}/%{name}.ini
68
+%{_mandir}/man1/%{name}.*
69
+%{_mandir}/man5/%{name}.*
70
+/usr/share/doc/pgbouncer/*
71
+/var/log/pgbouncer
72
+/var/run/pgbouncer
73
+
74
+%changelog
75
+*       Thu Apr 28 2016 Kumar Kaushik <kaushikk@vmware.com> 1.7.2-1
76
+-       Initial Version.
... ...
@@ -53,6 +53,8 @@
53 53
         "perl-common-sense",
54 54
         "perl-libintl",
55 55
         "perl-CGI",
56
+        "libevent",
57
+        "pgbouncer",
56 58
         "perl-JSON-Any",
57 59
         "perl-Net-SSLeay",
58 60
         "perl-IO-Socket-SSL",