-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgenders.spec.in
241 lines (205 loc) · 7.02 KB
/
genders.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
Name: @PACKAGE@
Version: @VERSION@
Release: 1
Summary: Static cluster configuration database
URL: https://github.com/chaos/genders
Group: System Environment/Base
License: GPL
Source: %{name}-%{version}.tar.gz
Requires: perl
BuildRequires: bison flex
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: libtool
BuildRoot: %{_tmppath}/%{name}-%{version}
%{!?_with_perl_extensions: %{!?_without_perl_extensions: %define _with_perl_extensions --with-perl-extensions}}
%{!?_with_python_extensions: %{!?_without_python_extensions: %define _with_python_extensions --with-python-extensions}}
%{!?_with_cplusplus_extensions: %{!?_without_cplusplus_extensions: %define _with_cplusplus_extensions --with-cplusplus-extensions}}
%{!?_with_java_extensions: %{!?_without_java_extensions: %define _without_java_extensions --without-java-extensions}}
# choose vendor arch by default
%{!?_with_perl_site_arch: %{!?_with_perl_vendor_arch: %define _with_perl_vendor_arch --with-perl-vendor-arch}}
# If python extensions are requested, then build versions
%if %{?_with_python_extensions:1}%{!?_with_python_extensions:0}
# Helper variable that tells us how many builds we have to do
%global _numbuilds 0
# build for python 2 unless specifically requested otherwise
%{!?_with_python2: %define _with_python2 1}
%if 0%{?_with_python2}
BuildRequires: python2
BuildRequires: python2-devel
%global _numbuilds %(expr %{expand: %{_numbuilds}} + 1)
%endif
# build for python 3 unless specifically requested otherwise
%{!?_with_python3: %define _with_python3 1}
%if 0%{?_with_python3}
BuildRequires: python3
BuildRequires: python3-devel
%global _numbuilds %(expr %{expand: %{_numbuilds}} + 1)
%endif
%else
# Helper variable that tells us how many builds we have to do
%global _numbuilds 1
%define _with_python2 0
%define _with_python3 0
%endif
%description
Genders is a static cluster configuration database used for cluster
configuration management. It is used by a variety of tools and
scripts for management of large clusters. The genders database is
typically replicated on every node of the cluster. It describes the
layout and configuration of the cluster so that tools and scripts can
sense the variations of cluster nodes. By abstracting this information
into a plain text file, it becomes possible to change the
configuration of a cluster by modifying only one file.
%if 0%{?_with_python2}
%package python
Summary: python2 bindings
Group: System Environment/Base
%description python
python2 bindings
%endif
%if 0%{?_with_python3}
%package python%{python3_version_nodots}
Summary: python3 bindings
Group: System Environment/Base
%description python%{python3_version_nodots}
python3 bindings
%endif
%package compat
Summary: Compatibility library
Group: System Environment/Base
%description compat
genders API that is compatible with earlier releases of genders
%prep
%if 0%{!?_numbuilds} || 0%{?_numbuilds} == 0
echo -e "Python extensions were requested, but none will be built.\n\
Are _with_python2 and _with_python3 both disabled?"
exit 1
%endif
%setup -q -n %{name}-%{version}
%if 0%{?_with_python3}
%{__rm} -rf %{py3dir}
%{__cp} -a . %{py3dir}
%endif
%build
%if 0%{?_with_python2} || 0%{!?_with_python3}
# Ensure that AC_PATH_PROG is set for python2
export PYTHON=%{__python2}
# Ensure we change into the build directory
pushd .
%else
# Ensure that AC_PATH_PROG is set for python3
export PYTHON=%{__python3}
# Ensure we change into the build directory
pushd %{py3dir}
%endif
%configure --program-prefix=%{?_program_prefix:%{_program_prefix}} \
--with-extension-destdir="$RPM_BUILD_ROOT" \
%{?_with_perl_extensions} \
%{?_without_perl_extensions} \
%{?_with_perl_site_arch} \
%{?_without_perl_site_arch} \
%{?_with_perl_vendor_arch} \
%{?_without_perl_vendor_arch} \
%{?_with_python_extensions} \
%{?_without_python_extensions} \
%{?_with_cplusplus_extensions} \
%{?_without_cplusplus_extensions} \
%{?_with_java_extensions} \
%{?_without_java_extensions}
make
popd
%if 0%{?_numbuilds} && 0%{?_numbuilds} > 1 && 0%{?_with_python3}
# We know that we have one more build *and* that this must be for python3
# Ensure that AC_PATH_PROG is set for python3
export PYTHON=%{__python3}
# Ensure we change into the build directory
pushd %{py3dir}
%configure --program-prefix=%{?_program_prefix:%{_program_prefix}} \
--with-extension-destdir="$RPM_BUILD_ROOT" \
%{?_with_perl_extensions} \
%{?_without_perl_extensions} \
%{?_with_perl_site_arch} \
%{?_without_perl_site_arch} \
%{?_with_perl_vendor_arch} \
%{?_without_perl_vendor_arch} \
%{?_with_python_extensions} \
%{?_without_python_extensions} \
%{?_with_cplusplus_extensions} \
%{?_without_cplusplus_extensions} \
%{?_with_java_extensions} \
%{?_without_java_extensions}
make
popd
%endif
%install
# Clean up any old remnanants
rm -rf $RPM_BUILD_ROOT
%if 0%{?_with_python2} || 0%{!?_with_python3}
# Ensure that AC_PATH_PROG is set for python2
export PYTHON=%{__python2}
# Ensure we change into the build directory
pushd .
%else
# Ensure that AC_PATH_PROG is set for python3
export PYTHON=%{__python3}
# Ensure we change into the build directory
pushd %{py3dir}
%endif
DESTDIR="$RPM_BUILD_ROOT" make install
popd
%if 0%{?_numbuilds} && 0%{?_numbuilds} > 1 && 0%{?_with_python3}
# We know that we have one more build *and* that this must be for python3
# Ensure that AC_PATH_PROG is set for python3
export PYTHON=%{__python3}
# Ensure we change into the build directory
pushd %{py3dir}
DESTDIR="$RPM_BUILD_ROOT" make install
popd
%endif
%files
%defattr(-,root,root)
%doc README NEWS ChangeLog DISCLAIMER DISCLAIMER.UC COPYING TUTORIAL genders.sample
%if %{?_with_java_extensions:1}%{!?_with_java_extensions:0}
%dir %{_datadir}/doc/%{name}-%{version}-javadoc/
%doc %{_datadir}/doc/%{name}-%{version}-javadoc/*
%endif
# It doesn't matter if the user chooses a 32bit or 64bit target. The
# packaging must work off whatever Perl is installed.
%if %{?_with_perl_site_arch:1}%{!?_with_perl_site_arch:0}
%define _perldir %(perl -e 'use Config; $T=$Config{installsitearch}; $P=$Config{siteprefix}; $T=~/$P\\/(.*)/; print "%{_prefix}/$1\\n"')
%endif
%if %{?_with_perl_vendor_arch:1}%{!?_with_perl_vendor_arch:0}
%define _perldir %(perl -e 'use Config; $T=$Config{installvendorarch}; $P=$Config{vendorprefix}; $T=~/$P\\/(.*)/; print "%{_prefix}/$1\\n"')
%endif
%{_mandir}/man1/*
%{_mandir}/man3/genders*
%{_mandir}/man3/libgenders*
%{_includedir}/*
%{_bindir}/*
%{_libdir}/libgenders.*
%if %{?_with_perl_extensions:1}%{!?_with_perl_extensions:0}
%{_mandir}/man3/Libgenders*
%{_mandir}/man3/Genders*
%{_perldir}/*
%endif
%if %{?_with_cplusplus_extensions:1}%{!?_with_cplusplus_extensions:0}
%{_libdir}/libgendersplusplus.*
%endif
%if %{?_with_java_extensions:1}%{!?_with_java_extensions:0}
%{_javadir}/*
%{_libdir}/libGendersjni.*
%endif
%files compat
%defattr(-,root,root)
%{_mandir}/man3/gendlib*
%{_prefix}/lib/genders/*
%if 0%{?_with_python2}
%files python
%defattr(-,root,root)
%{_libdir}/python2*
%endif
%if 0%{?_with_python3}
%files python%{python3_version_nodots}
%defattr(-,root,root)
%{_libdir}/python3*
%endif