1 |
# $Id: smeserver-mock.spec,v 1.2 2018/03/11 05:08:17 jpp Exp $ |
2 |
|
3 |
Summary: smeserver-mock tools for building RPMs |
4 |
%define name smeserver-mock |
5 |
Name: %{name} |
6 |
%define version 1.0 |
7 |
%define release 2 |
8 |
Version: %{version} |
9 |
Release: %{release}%{?dist} |
10 |
License: GPL |
11 |
Group: Networking/Daemons |
12 |
Source: %{name}-%{version}.tgz |
13 |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
14 |
BuildArchitectures: noarch |
15 |
Requires: e-smith-devtools |
16 |
Requires: mock |
17 |
Requires: python-ctypes |
18 |
Requires: glances |
19 |
Requires: make rpm-build rpm-sign wget |
20 |
Requires: cmake automake libtool |
21 |
Buildrequires: e-smith-devtools |
22 |
# needed for scl |
23 |
Requires: scl-utils scl-utils-build centos-release-scl centos-release-scl-rh |
24 |
Requires: python27-build |
25 |
AutoReqProv: no |
26 |
|
27 |
%changelog |
28 |
* Sun Mar 11 2018 Jean-Philipe Pialasse <tests@pialasse.com> 1.0-2.sme |
29 |
- update of site-default.cfg via post script [SME: 10537] |
30 |
- removed e-smith-devtools of requirements |
31 |
- added Requires python27-build |
32 |
|
33 |
* Sat Mar 10 2018 Jean-Philipe Pialasse <tests@pialasse.com> 1.0-1.sme |
34 |
- Initial release with SME iServer mock config files [SME: 10537] |
35 |
- tools added : BogusDateBot.sh change-log clog createBuildDir prepa tagbuild |
36 |
|
37 |
%description |
38 |
Tools for use in building RPMs for the Koozali SME server and gateway. |
39 |
|
40 |
Few tools are also provided to help you with package building. |
41 |
|
42 |
%prep |
43 |
%setup |
44 |
|
45 |
%build |
46 |
|
47 |
%install |
48 |
rm -rf $RPM_BUILD_ROOT |
49 |
(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
50 |
/bin/rm -f %{name}-%{version}-filelist |
51 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
52 |
--file /usr/bin/BogusDateBot.sh '%attr(0755,root,root)' \ |
53 |
--file /usr/bin/change-log '%attr(0755,root,root)' \ |
54 |
--file /usr/bin/clog '%attr(0755,root,root)' \ |
55 |
--file /usr/bin/createBuildDir '%attr(0755,root,root)' \ |
56 |
--file /usr/bin/prepa '%attr(0755,root,root)' \ |
57 |
--file /usr/bin/tagbuild '%attr(0755,root,root)' \ |
58 |
| grep -v /etc/mock/ \ |
59 |
> %{name}-%{version}-filelist |
60 |
|
61 |
%clean |
62 |
rm -rf $RPM_BUILD_ROOT |
63 |
|
64 |
%pre |
65 |
%preun |
66 |
%post |
67 |
|
68 |
# updates sme site defaults |
69 |
main=/etc/mock/site-defaults.cfg |
70 |
tmp=/tmp/site-defaults.cfg |
71 |
gen=/etc/mock/sme-site-defaults.cfg |
72 |
|
73 |
# position of the tags |
74 |
BEGIN_GEN=$(cat $main | grep -n '### KOOZALI SME SERVER BEGIN GENERATED CONTENT' | sed 's/\(.*\):.*/\1/g' ) |
75 |
END_GEN=$(cat $main | grep -n '### KOOZALI SME SERVER END GENERATED CONTENT' | sed 's/\(.*\):.*/\1/g' ) |
76 |
#if tag is absent set first to 0 |
77 |
if [[ "$BEGIN_GEN" -eq "" ]]; then BEGIN_GEN=0; fi |
78 |
if [[ "$END_GEN" -eq "" ]]; then |
79 |
# if second tag is absent just concatenate |
80 |
cat <(head -n $(expr $BEGIN_GEN - 1) $main) $gen >$tmp; |
81 |
|
82 |
else |
83 |
# if both tags are present replace content |
84 |
cat <(head -n $(expr $BEGIN_GEN - 1) $main) $gen <(tail -n +$(expr $END_GEN + 1) $main) >$tmp; |
85 |
|
86 |
fi |
87 |
# mv tmp file to main file |
88 |
mv $tmp $main |
89 |
|
90 |
|
91 |
%postun |
92 |
|
93 |
%files -f %{name}-%{version}-filelist |
94 |
%defattr(-,root,root,-) |
95 |
/etc/mock/* %attr(0755,root,mock) |