Change-Id: I5d14ad245bd584e64ce5194b153d43cfff1a101f
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2657
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,66 @@ |
0 |
+Name: c-rest-engine |
|
1 |
+Summary: minimal http(s) server library |
|
2 |
+Version: 1.0.0 |
|
3 |
+Release: 1%{?dist} |
|
4 |
+Group: Applications/System |
|
5 |
+Vendor: VMware, Inc. |
|
6 |
+License: Apache 2.0 |
|
7 |
+URL: http://www.github.com/vmware/c-rest-engine |
|
8 |
+BuildArch: x86_64 |
|
9 |
+Requires: coreutils >= 8.22 |
|
10 |
+Requires: openssl >= 1.0.1 |
|
11 |
+BuildRequires: coreutils >= 8.22 |
|
12 |
+BuildRequires: openssl-devel >= 1.0.1 |
|
13 |
+Source0: %{name}-%{version}.tar.gz |
|
14 |
+%define sha1 c-rest-engine=49c8c4c701650bf435307e2e5cbc72d723abbded |
|
15 |
+ |
|
16 |
+%description |
|
17 |
+c-rest-engine is a minimal embedded http(s) server written in C. |
|
18 |
+Its primary intent is to enable REST(Representational State Transfer) |
|
19 |
+API support for C daemons. |
|
20 |
+ |
|
21 |
+%package devel |
|
22 |
+Summary: c-rest-engine dev files |
|
23 |
+Requires: coreutils >= 8.22 |
|
24 |
+Requires: openssl-devel >= 1.0.1 |
|
25 |
+Requires: %{name} = %{version}-%{release} |
|
26 |
+ |
|
27 |
+%description devel |
|
28 |
+development libs and header files for c-rest-engine |
|
29 |
+ |
|
30 |
+%prep |
|
31 |
+%setup -q |
|
32 |
+ |
|
33 |
+%build |
|
34 |
+cd build |
|
35 |
+autoreconf -mif .. |
|
36 |
+../configure \ |
|
37 |
+ --prefix=%{_prefix} \ |
|
38 |
+ --with-ssl=/usr \ |
|
39 |
+ --enable-debug=%{_enable_debug} \ |
|
40 |
+ --disable-static |
|
41 |
+ |
|
42 |
+make |
|
43 |
+ |
|
44 |
+%install |
|
45 |
+ |
|
46 |
+[ %{buildroot} != "/" ] && rm -rf %{buildroot}/* |
|
47 |
+cd build && make install DESTDIR=$RPM_BUILD_ROOT |
|
48 |
+find %{buildroot} -name '*.la' -delete |
|
49 |
+ |
|
50 |
+%post -p /sbin/ldconfig |
|
51 |
+ |
|
52 |
+%files |
|
53 |
+%defattr(-,root,root) |
|
54 |
+%{_libdir}/*.so.* |
|
55 |
+%exclude %{_sbindir}/vmrestd |
|
56 |
+ |
|
57 |
+%files devel |
|
58 |
+%{_includedir}/vmrest.h |
|
59 |
+%{_libdir}/*.so |
|
60 |
+ |
|
61 |
+# %doc ChangeLog README COPYING |
|
62 |
+ |
|
63 |
+%changelog |
|
64 |
+* Thu May 04 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0.0-1 |
|
65 |
+- Initial build. First version |
0 | 66 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,62 @@ |
0 |
+Name: copenapi |
|
1 |
+Summary: c open api spec parser |
|
2 |
+Version: 0.0.1 |
|
3 |
+Release: 1%{?dist} |
|
4 |
+Group: Development/Libraries |
|
5 |
+Vendor: VMware, Inc. |
|
6 |
+Distribution: Photon |
|
7 |
+License: Apache 2.0 |
|
8 |
+URL: https://www.github.com/vmware/copenapi |
|
9 |
+BuildArch: x86_64 |
|
10 |
+Requires: jansson |
|
11 |
+Requires: curl |
|
12 |
+BuildRequires: jansson-devel |
|
13 |
+BuildRequires: curl-devel |
|
14 |
+Source0: %{name}-%{version}.tar.gz |
|
15 |
+%define sha1 copenapi=0cfd79271ec3639129a36c4a5c3375cca8c54f32 |
|
16 |
+ |
|
17 |
+%description |
|
18 |
+copenapi is an openapi parser written in c |
|
19 |
+ |
|
20 |
+%package devel |
|
21 |
+Summary: copenapi development files |
|
22 |
+Group: Development/Libraries |
|
23 |
+Requires: %{name} = %{version}-%{release} |
|
24 |
+ |
|
25 |
+%description devel |
|
26 |
+copenapi development files |
|
27 |
+ |
|
28 |
+%prep |
|
29 |
+%setup -q |
|
30 |
+ |
|
31 |
+%build |
|
32 |
+autoreconf -mif |
|
33 |
+./configure \ |
|
34 |
+ --prefix=%{_prefix} \ |
|
35 |
+ --disable-static |
|
36 |
+make |
|
37 |
+ |
|
38 |
+%install |
|
39 |
+ |
|
40 |
+make install DESTDIR=$RPM_BUILD_ROOT |
|
41 |
+rm -f %{buildroot}%{_libdir}/*.la |
|
42 |
+ |
|
43 |
+%post |
|
44 |
+ /sbin/ldconfig |
|
45 |
+ |
|
46 |
+%clean |
|
47 |
+rm -rf %{buildroot}/* |
|
48 |
+ |
|
49 |
+%files |
|
50 |
+%defattr(-,root,root) |
|
51 |
+%{_bindir}/* |
|
52 |
+%{_libdir}/*.so.* |
|
53 |
+ |
|
54 |
+%files devel |
|
55 |
+%{_libdir}/pkgconfig/copenapi.pc |
|
56 |
+%{_includedir}/* |
|
57 |
+%{_libdir}/*.so |
|
58 |
+ |
|
59 |
+%changelog |
|
60 |
+* Thu May 04 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.0.1-1 |
|
61 |
+- Initial build. First version |
0 | 12 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,266 @@ |
0 |
+# |
|
1 |
+# pmd spec file |
|
2 |
+# |
|
3 |
+ |
|
4 |
+%define _mech_file /etc/gss/mech |
|
5 |
+%define _mech_id 1.3.6.1.4.1.6876.11711.2.1.2 |
|
6 |
+%define _python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))") |
|
7 |
+ |
|
8 |
+Summary: Photon Management Daemon |
|
9 |
+Name: pmd |
|
10 |
+Version: 0.0.1 |
|
11 |
+Release: 1%{?dist} |
|
12 |
+Vendor: VMware, Inc. |
|
13 |
+Distribution: Photon |
|
14 |
+License: Apache 2.0 |
|
15 |
+URL: https://www.github.com/vmware/pmd |
|
16 |
+Group: Applications/System |
|
17 |
+Requires: copenapi |
|
18 |
+Requires: c-rest-engine |
|
19 |
+Requires: jansson |
|
20 |
+Requires: likewise-open >= 6.2.9 |
|
21 |
+Requires: netmgmt |
|
22 |
+Requires: systemd |
|
23 |
+Requires: tdnf >= 1.2.0 |
|
24 |
+Requires: vmware-afd-client |
|
25 |
+Requires: vmware-directory-client |
|
26 |
+BuildRequires: copenapi-devel |
|
27 |
+BuildRequires: c-rest-engine-devel |
|
28 |
+BuildRequires: curl-devel |
|
29 |
+BuildRequires: hawkey-devel >= 2017.1 |
|
30 |
+BuildRequires: jansson-devel |
|
31 |
+BuildRequires: krb5-devel |
|
32 |
+BuildRequires: likewise-open-devel >= 6.2.9 |
|
33 |
+BuildRequires: netmgmt-cli-devel |
|
34 |
+BuildRequires: netmgmt-devel |
|
35 |
+BuildRequires: tdnf-devel >= 1.2.0 |
|
36 |
+BuildRequires: vmware-afd-client-devel |
|
37 |
+BuildRequires: vmware-directory-client-devel |
|
38 |
+Source0: %{name}-%{version}.tar.gz |
|
39 |
+%define sha1 pmd=d09828dc160b1fb12d891bed00100d9bcdd402ce |
|
40 |
+Source1: pmd.service |
|
41 |
+ |
|
42 |
+%description |
|
43 |
+Photon Management Daemon |
|
44 |
+ |
|
45 |
+%package cli |
|
46 |
+Summary: photon management daemon cmd line cli |
|
47 |
+Requires: likewise-open >= 6.2.0 |
|
48 |
+Requires: vmware-directory-client |
|
49 |
+ |
|
50 |
+%description cli |
|
51 |
+photon management daemon cmd line cli |
|
52 |
+ |
|
53 |
+%package devel |
|
54 |
+Summary: photon management daemon client devel |
|
55 |
+Group: Development/Libraries |
|
56 |
+ |
|
57 |
+%description devel |
|
58 |
+photon management daemon client devel |
|
59 |
+ |
|
60 |
+%package python2 |
|
61 |
+Summary: Python2 bindings for photon management daemon |
|
62 |
+Group: Development/Libraries |
|
63 |
+Requires: python2 >= 2.7 |
|
64 |
+Requires: %{name}-cli = %{version}-%{release} |
|
65 |
+BuildRequires: python2-devel >= 2.7 |
|
66 |
+ |
|
67 |
+%description python2 |
|
68 |
+Python2 bindings for photon management daemon |
|
69 |
+ |
|
70 |
+%package python3 |
|
71 |
+Summary: Python3 bindings for photon management daemon |
|
72 |
+Group: Development/Libraries |
|
73 |
+Requires: python3 >= 3.5 |
|
74 |
+Requires: %{name}-cli = %{version}-%{release} |
|
75 |
+BuildRequires: python3-devel >= 3.5 |
|
76 |
+ |
|
77 |
+%description python3 |
|
78 |
+Python3 bindings for photon management daemon |
|
79 |
+ |
|
80 |
+%prep |
|
81 |
+%setup -q |
|
82 |
+ |
|
83 |
+%build |
|
84 |
+sed -i 's,c-rest-engine/,,' server/includes.h |
|
85 |
+sed -i 's,c-rest-engine/,,' server/restutils/includes.h |
|
86 |
+autoreconf -mif |
|
87 |
+./configure \ |
|
88 |
+ --prefix=%{_prefix} \ |
|
89 |
+ --bindir=%{_bindir} \ |
|
90 |
+ --libdir=%{_libdir} \ |
|
91 |
+ --sysconfdir=/etc \ |
|
92 |
+ --with-likewise=/opt/likewise \ |
|
93 |
+ --with-vmware-rest=/usr/lib \ |
|
94 |
+ --enable-python=no \ |
|
95 |
+ --disable-static |
|
96 |
+make |
|
97 |
+ |
|
98 |
+pushd python |
|
99 |
+python2 setup.py build |
|
100 |
+python3 setup.py build |
|
101 |
+popd |
|
102 |
+ |
|
103 |
+%install |
|
104 |
+cd $RPM_BUILD_DIR/%{name}-%{version} |
|
105 |
+make DESTDIR=%{buildroot} install |
|
106 |
+ |
|
107 |
+pushd python |
|
108 |
+python2 setup.py install --skip-build --root %{buildroot} |
|
109 |
+rm -f %{buildroot}%{python_sitearch}/pmd.so |
|
110 |
+python3 setup.py install --skip-build --root %{buildroot} |
|
111 |
+popd |
|
112 |
+ |
|
113 |
+install -d $RPM_BUILD_ROOT/var/log/pmd |
|
114 |
+install -vdm755 %{buildroot}%{_unitdir} |
|
115 |
+install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir} |
|
116 |
+install -D -m 444 conf/restapispec.json %{buildroot}/etc/pmd/restapispec.json |
|
117 |
+install -D -m 444 conf/api_sddl.conf %{buildroot}/etc/pmd/api_sddl.conf |
|
118 |
+install -D -m 444 conf/restconfig.txt %{buildroot}/etc/pmd/restconfig.txt |
|
119 |
+install -D -m 444 conf/server.crt %{buildroot}/etc/pmd/server.crt |
|
120 |
+install -D -m 444 conf/server.key %{buildroot}/etc/pmd/server.key |
|
121 |
+ |
|
122 |
+# Pre-install |
|
123 |
+%pre |
|
124 |
+ |
|
125 |
+ # First argument is 1 => New Installation |
|
126 |
+ # First argument is 2 => Upgrade |
|
127 |
+ |
|
128 |
+# Post-install |
|
129 |
+%post |
|
130 |
+ |
|
131 |
+ # First argument is 1 => New Installation |
|
132 |
+ # First argument is 2 => Upgrade |
|
133 |
+ sed -i "s/IPADDRESS_MARKER/`ifconfig eth0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`/g" /etc/pmd/restapispec.json |
|
134 |
+ /sbin/ldconfig |
|
135 |
+ %systemd_post pmd.service |
|
136 |
+ |
|
137 |
+ if [ ! -d "%{_libdir}/gss" ] ; then |
|
138 |
+ mkdir %{_libdir}/gss |
|
139 |
+ fi |
|
140 |
+ |
|
141 |
+ # Add libgssapi_unix.so to GSSAPI plugin directory |
|
142 |
+ if [ ! -h %{_libdir}/gss/libgssapi_unix.so ]; then |
|
143 |
+ /bin/ln -sf /opt/vmware/lib64/libgssapi_unix.so %{_libdir}/gss/libgssapi_unix.so |
|
144 |
+ fi |
|
145 |
+ # Add gssapi_unix plugin configuration to GSS mech file |
|
146 |
+ if [ -f "%{_mech_file}" ]; then |
|
147 |
+ if [ `grep -c "%{_mech_id}" "%{_mech_file}"` -lt 1 ]; then |
|
148 |
+ echo "unix %{_mech_id} libgssapi_unix.so" >> "%{_mech_file}" |
|
149 |
+ fi |
|
150 |
+ fi |
|
151 |
+ |
|
152 |
+# Pre-uninstall |
|
153 |
+%preun |
|
154 |
+ |
|
155 |
+ # First argument is 0 => Uninstall |
|
156 |
+ # First argument is 1 => Upgrade |
|
157 |
+ %systemd_preun pmd.service |
|
158 |
+if [ "$1" = 0 ]; then |
|
159 |
+ if [ ! -e %{_bindir}/pmd-cli ]; then |
|
160 |
+ # Cleanup GSSAPI UNIX symlink |
|
161 |
+ if [ -h %{_libdir}/gss/libgssapi_unix.so ]; then |
|
162 |
+ rm -f %{_libdir}/gss/libgssapi_unix.so |
|
163 |
+ fi |
|
164 |
+ # Remove GSSAPI SRP plugin configuration from GSS mech file |
|
165 |
+ if [ -f "%{_mech_file}" ]; then |
|
166 |
+ if [ `grep -c "%{_mech_id}" "%{_mech_file}"` -gt 0 ]; then |
|
167 |
+ cat "%{_mech_file}" | sed '/%{_mech_id}/d' > "/tmp/mech-$$" |
|
168 |
+ if [ -s /tmp/mech-$$ ]; then |
|
169 |
+ mv "/tmp/mech-$$" "%{_mech_file}" |
|
170 |
+ fi |
|
171 |
+ fi |
|
172 |
+ fi |
|
173 |
+ fi |
|
174 |
+fi |
|
175 |
+ |
|
176 |
+ |
|
177 |
+# Post-uninstall |
|
178 |
+%postun |
|
179 |
+ |
|
180 |
+ /sbin/ldconfig |
|
181 |
+ |
|
182 |
+ # First argument is 0 => Uninstall |
|
183 |
+ # First argument is 1 => Upgrade |
|
184 |
+ %systemd_postun_with_restart pmd.service |
|
185 |
+ |
|
186 |
+# Post pmd-cli |
|
187 |
+%post cli |
|
188 |
+ if [ ! -d "%{_libdir}/gss" ] ; then |
|
189 |
+ mkdir %{_libdir}/gss |
|
190 |
+ fi |
|
191 |
+ |
|
192 |
+ # Add libgssapi_unix.so to GSSAPI plugin directory |
|
193 |
+ if [ ! -h %{_libdir}/gss/libgssapi_unix.so ]; then |
|
194 |
+ /bin/ln -sf /opt/vmware/lib64/libgssapi_unix.so %{_libdir}/gss/libgssapi_unix.so |
|
195 |
+ fi |
|
196 |
+ # Add gssapi_unix plugin configuration to GSS mech file |
|
197 |
+ if [ -f "%{_mech_file}" ]; then |
|
198 |
+ if [ `grep -c "%{_mech_id}" "%{_mech_file}"` -lt 1 ]; then |
|
199 |
+ echo "unix %{_mech_id} libgssapi_unix.so" >> "%{_mech_file}" |
|
200 |
+ fi |
|
201 |
+ fi |
|
202 |
+ |
|
203 |
+# Pre-uninstall cli |
|
204 |
+%preun cli |
|
205 |
+ |
|
206 |
+ # First argument is 0 => Uninstall |
|
207 |
+ # First argument is 1 => Upgrade |
|
208 |
+ |
|
209 |
+if [ "$1" = 0 ]; then |
|
210 |
+ if [ ! -e %{_bindir}/pmd ]; then |
|
211 |
+ # Cleanup GSSAPI UNIX symlink |
|
212 |
+ if [ -h %{_libdir}/gss/libgssapi_unix.so ]; then |
|
213 |
+ rm -f %{_libdir}/gss/libgssapi_unix.so |
|
214 |
+ fi |
|
215 |
+ # Remove GSSAPI SRP plugin configuration from GSS mech file |
|
216 |
+ if [ -f "%{_mech_file}" ]; then |
|
217 |
+ if [ `grep -c "%{_mech_id}" "%{_mech_file}"` -gt 0 ]; then |
|
218 |
+ cat "%{_mech_file}" | sed '/%{_mech_id}/d' > "/tmp/mech-$$" |
|
219 |
+ if [ -s /tmp/mech-$$ ]; then |
|
220 |
+ mv "/tmp/mech-$$" "%{_mech_file}" |
|
221 |
+ fi |
|
222 |
+ fi |
|
223 |
+ fi |
|
224 |
+ fi |
|
225 |
+fi |
|
226 |
+# Post-uninstall |
|
227 |
+%postun cli |
|
228 |
+ /sbin/ldconfig |
|
229 |
+ |
|
230 |
+%clean |
|
231 |
+rm -rf %{buildroot}/* |
|
232 |
+ |
|
233 |
+%files |
|
234 |
+ %defattr(-,root,root,0755) |
|
235 |
+ %{_bindir}/pmd |
|
236 |
+ /lib/systemd/system/pmd.service |
|
237 |
+ /etc/pmd/pmd.conf |
|
238 |
+ /etc/pmd/api_sddl.conf |
|
239 |
+ /etc/pmd/restapispec.json |
|
240 |
+ /etc/pmd/restconfig.txt |
|
241 |
+ /etc/pmd/server.crt |
|
242 |
+ /etc/pmd/server.key |
|
243 |
+ %dir /var/log/pmd |
|
244 |
+ |
|
245 |
+%files cli |
|
246 |
+ %{_bindir}/pmd-cli |
|
247 |
+ %{_libdir}/libpmdclient.so.* |
|
248 |
+ |
|
249 |
+%files devel |
|
250 |
+ %{_includedir}/pmd/*.h |
|
251 |
+ %{_libdir}/*.la |
|
252 |
+ %{_libdir}/libpmdclient.so |
|
253 |
+ %{_libdir}/pkgconfig/pmdclient.pc |
|
254 |
+ |
|
255 |
+%files python2 |
|
256 |
+ %{python_sitearch}/%{name}/ |
|
257 |
+ %{python_sitearch}/%{name}_python-*.egg-info |
|
258 |
+ |
|
259 |
+%files python3 |
|
260 |
+ %{_python3_sitearch}/%{name}/ |
|
261 |
+ %{_python3_sitearch}/%{name}_python-*.egg-info |
|
262 |
+ |
|
263 |
+%changelog |
|
264 |
+* Thu May 04 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.0.1-1 |
|
265 |
+- Initial build. First version |