forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
origin.spec
470 lines (389 loc) · 14.1 KB
/
origin.spec
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
#debuginfo not supported with Go
%global debug_package %{nil}
# modifying the Go binaries breaks the DWARF debugging
%global __os_install_post %{_rpmconfigdir}/brp-compress
%global gopath %{_datadir}/gocode
%global import_path github.com/openshift/origin
# docker_version is the version of docker requires by packages
%global docker_version 1.13
# openvswitch_version is the version of openvswitch requires by packages
%global openvswitch_version 2.6.1
# this is the version we obsolete up to. The packaging changed for Origin
# 1.0.6 and OSE 3.1 such that 'openshift' package names were no longer used.
%global package_refactor_version 3.0.2.900
%global golang_version 1.10
# %commit and %os_git_vars are intended to be set by tito custom builders provided
# in the .tito/lib directory. The values in this spec file will not be kept up to date.
%{!?commit:
%global commit 86b5e46426ba828f49195af21c56f7c6674b48f7
}
%global shortcommit %(c=%{commit}; echo ${c:0:7})
# os_git_vars needed to run hack scripts during rpm builds
%{!?os_git_vars:
%global os_git_vars OS_GIT_VERSION='' OS_GIT_COMMIT='' OS_GIT_MAJOR='' OS_GIT_MINOR='' OS_GIT_TREE_STATE=''
}
%if 0%{?skip_build}
%global do_build 0
%else
%global do_build 1
%endif
%if 0%{?skip_prep}
%global do_prep 0
%else
%global do_prep 1
%endif
%if 0%{?skip_dist}
%global package_dist %{nil}
%else
%global package_dist %{dist}
%endif
%if 0%{?fedora} || 0%{?epel}
%global need_redistributable_set 0
%else
# Due to library availability, redistributable builds only work on x86_64
%ifarch x86_64
%global need_redistributable_set 1
%else
%global need_redistributable_set 0
%endif
%endif
%{!?make_redistributable: %global make_redistributable %{need_redistributable_set}}
%if "%{dist}" == ".el7aos"
%global package_name atomic-openshift
%global product_name Atomic OpenShift
%else
%global package_name origin
%global product_name Origin
%endif
%{!?version: %global version 0.0.1}
%{!?release: %global release 1}
Name: %{package_name}
Version: %{version}
Release: %{release}%{package_dist}
Summary: Open Source Container Management by Red Hat
License: ASL 2.0
URL: https://%{import_path}
# If go_arches not defined fall through to implicit golang archs
%if 0%{?go_arches:1}
ExclusiveArch: %{go_arches}
%else
ExclusiveArch: x86_64 aarch64 ppc64le s390x
%endif
Source0: https://%{import_path}/archive/%{commit}/%{name}-%{version}.tar.gz
BuildRequires: systemd
BuildRequires: bsdtar
BuildRequires: golang >= %{golang_version}
BuildRequires: krb5-devel
BuildRequires: rsync
Requires: %{name}-clients = %{version}-%{release}
Requires: iptables
Obsoletes: openshift < %{package_refactor_version}
#
# The following Bundled Provides entries are populated automatically by the
# OpenShift Origin tito custom builder found here:
# https://github.com/openshift/origin/blob/master/.tito/lib/origin/builder/
#
# These are defined as per:
# https://fedoraproject.org/wiki/Packaging:Guidelines#Bundling_and_Duplication_of_system_libraries
#
### AUTO-BUNDLED-GEN-ENTRY-POINT
%description
OpenShift is a distribution of Kubernetes optimized for enterprise application
development and deployment. OpenShift adds developer and operational centric
tools on top of Kubernetes to enable rapid application development, easy
deployment and scaling, and long-term lifecycle maintenance for small and large
teams and applications. It provides a secure and multi-tenant configuration for
Kubernetes allowing you to safely host many different applications and workloads
on a unified cluster.
%package hypershift
Summary: %{product_name} server commands
%description hypershift
%{summary}
%package hyperkube
Summary: %{product_name} Kubernetes server commands
%description hyperkube
%{summary}
%package master
Summary: %{product_name} Master
Requires: %{name} = %{version}-%{release}
Obsoletes: openshift-master < %{package_refactor_version}
%description master
%{summary}
%package tests
Summary: %{product_name} Test Suite
%description tests
%{summary}
%package node
Summary: %{product_name} Node
Requires: %{name}-hyperkube = %{version}-%{release}
Requires: util-linux
Requires: socat
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Obsoletes: openshift-node < %{package_refactor_version}
Obsoletes: tuned-profiles-%{name}-node
Provides: tuned-profiles-%{name}-node
%description node
%{summary}
%package clients
Summary: %{product_name} Client binaries for Linux
Obsoletes: openshift-clients < %{package_refactor_version}
Requires: bash-completion
%description clients
%{summary}
%if 0%{?make_redistributable}
%package clients-redistributable
Summary: %{product_name} Client binaries for Linux, Mac OSX, and Windows
Obsoletes: openshift-clients-redistributable < %{package_refactor_version}
BuildRequires: goversioninfo
%description clients-redistributable
%{summary}
%endif
%package pod
Summary: %{product_name} Pod
%description pod
%{summary}
%package sdn-ovs
Summary: %{product_name} SDN Plugin for Open vSwitch
Requires: openvswitch >= %{openvswitch_version}
# selinux-policy is required because openvswitch doesn't yet take a dependency on selinux-policy but changes the files
Requires: selinux-policy
Requires: %{name}-node = %{version}-%{release}
Requires: bridge-utils
Requires: ethtool
Requires: procps-ng
Requires: iproute
Requires: conntrack-tools
Obsoletes: openshift-sdn-ovs < %{package_refactor_version}
%description sdn-ovs
%{summary}
%package template-service-broker
Summary: Template Service Broker
%description template-service-broker
%{summary}
%package excluder
Summary: Exclude openshift packages from updates
BuildArch: noarch
%description excluder
Many times admins do not want openshift updated when doing
normal system updates.
%{name}-excluder exclude - No openshift packages can be updated
%{name}-excluder unexclude - Openshift packages can be updated
%package docker-excluder
Summary: Exclude docker packages from updates
BuildArch: noarch
%description docker-excluder
Certain versions of OpenShift will not work with newer versions
of docker. Exclude those versions of docker.
%{name}-docker-excluder exclude - No major docker updates
%{name}-docker-excluder unexclude - docker packages can be updated
%prep
%if 0%{do_prep}
%setup -q
%endif
%build
%if 0%{do_build}
%if 0%{make_redistributable}
# Create Binaries for all supported arches
%{os_git_vars} OS_BUILD_RELEASE_ARCHIVES=n make build-cross
%else
# Create Binaries only for building arch
%ifarch x86_64
BUILD_PLATFORM="linux/amd64"
%endif
%ifarch %{ix86}
BUILD_PLATFORM="linux/386"
%endif
%ifarch ppc64le
BUILD_PLATFORM="linux/ppc64le"
%endif
%ifarch %{arm} aarch64
BUILD_PLATFORM="linux/arm64"
%endif
%ifarch s390x
BUILD_PLATFORM="linux/s390x"
%endif
OS_ONLY_BUILD_PLATFORMS="${BUILD_PLATFORM}" %{os_git_vars} OS_BUILD_RELEASE_ARCHIVES=n make build-cross
%endif
# Generate man pages
%{os_git_vars} make build-docs
%endif
%install
PLATFORM="$(go env GOHOSTOS)/$(go env GOHOSTARCH)"
install -d %{buildroot}%{_bindir}
# Install linux components
for bin in oc openshift hypershift hyperkube template-service-broker openshift-sdn openshift-tests
do
echo "+++ INSTALLING ${bin}"
install -p -m 755 _output/local/bin/${PLATFORM}/${bin} %{buildroot}%{_bindir}/${bin}
done
%if 0%{?make_redistributable}
# Install client executable for windows and mac
install -d %{buildroot}%{_datadir}/%{name}/{linux,macosx,windows}
install -p -m 755 _output/local/bin/linux/amd64/oc %{buildroot}%{_datadir}/%{name}/linux/oc
install -p -m 755 _output/local/bin/linux/amd64/kubectl %{buildroot}%{_datadir}/%{name}/linux/kubectl
install -p -m 755 _output/local/bin/darwin/amd64/oc %{buildroot}/%{_datadir}/%{name}/macosx/oc
install -p -m 755 _output/local/bin/darwin/amd64/kubectl %{buildroot}/%{_datadir}/%{name}/macosx/kubectl
install -p -m 755 _output/local/bin/windows/amd64/oc.exe %{buildroot}/%{_datadir}/%{name}/windows/oc.exe
install -p -m 755 _output/local/bin/windows/amd64/kubectl.exe %{buildroot}/%{_datadir}/%{name}/windows/kubectl.exe
%endif
# Install pod
install -p -m 755 _output/local/bin/${PLATFORM}/pod %{buildroot}%{_bindir}/
install -d -m 0755 %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
for cmd in \
openshift-deploy \
openshift-docker-build \
openshift-sti-build \
openshift-git-clone \
openshift-manage-dockerfile \
openshift-extract-image-content \
openshift-recycle \
kubectl
do
ln -s oc %{buildroot}%{_bindir}/$cmd
done
install -d -m 0755 %{buildroot}%{_sysconfdir}/origin/{master,node}
install -d -m 0755 %{buildroot}%{_sysconfdir}/kubernetes/manifests
# stub filed required to ensure config is not reverted during upgrades
install -m 0644 contrib/systemd/origin-node.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}-node
# Install man1 man pages
install -d -m 0755 %{buildroot}%{_mandir}/man1
install -m 0644 docs/man/man1/* %{buildroot}%{_mandir}/man1/
mkdir -p %{buildroot}%{_sharedstatedir}/origin
# Install sdn scripts
install -d -m 0755 %{buildroot}%{_sysconfdir}/cni/net.d
install -d -m 0755 %{buildroot}/opt/cni/bin
install -p -m 0755 _output/local/bin/${PLATFORM}/sdn-cni-plugin %{buildroot}/opt/cni/bin/openshift-sdn
install -p -m 0755 _output/local/bin/${PLATFORM}/host-local %{buildroot}/opt/cni/bin
install -p -m 0755 _output/local/bin/${PLATFORM}/loopback %{buildroot}/opt/cni/bin
install -d -m 0755 %{buildroot}%{_unitdir}/%{name}-node.service.d
# Install bash completions
install -d -m 755 %{buildroot}%{_sysconfdir}/bash_completion.d/
for bin in oc kubectl openshift
do
echo "+++ INSTALLING BASH COMPLETIONS FOR ${bin} "
%{buildroot}%{_bindir}/${bin} completion bash > %{buildroot}%{_sysconfdir}/bash_completion.d/${bin}
chmod 644 %{buildroot}%{_sysconfdir}/bash_completion.d/${bin}
done
# Install origin-accounting
install -d -m 755 %{buildroot}%{_sysconfdir}/systemd/system.conf.d/
install -p -m 644 contrib/systemd/origin-accounting.conf %{buildroot}%{_sysconfdir}/systemd/system.conf.d/
# Excluder variables
mkdir -p $RPM_BUILD_ROOT/usr/sbin
%if 0%{?fedora}
OS_CONF_FILE="/etc/dnf.conf"
%else
OS_CONF_FILE="/etc/yum.conf"
%endif
# Install openshift-excluder script
sed "s|@@CONF_FILE-VARIABLE@@|${OS_CONF_FILE}|" contrib/excluder/excluder-template > $RPM_BUILD_ROOT/usr/sbin/%{name}-excluder
sed -i "s|@@PACKAGE_LIST-VARIABLE@@|%{name} %{name}-clients %{name}-clients-redistributable %{name}-master %{name}-node %{name}-pod %{name}-recycle %{name}-hyperkube %{name}-tests|" $RPM_BUILD_ROOT/usr/sbin/%{name}-excluder
chmod 0744 $RPM_BUILD_ROOT/usr/sbin/%{name}-excluder
# Install docker-excluder script
sed "s|@@CONF_FILE-VARIABLE@@|${OS_CONF_FILE}|" contrib/excluder/excluder-template > $RPM_BUILD_ROOT/usr/sbin/%{name}-docker-excluder
sed -i "s|@@PACKAGE_LIST-VARIABLE@@|docker*1.14* docker*1.15* docker*1.16* docker*1.17* docker*1.18* docker*1.19* docker*1.20*|" $RPM_BUILD_ROOT/usr/sbin/%{name}-docker-excluder
chmod 0744 $RPM_BUILD_ROOT/usr/sbin/%{name}-docker-excluder
# Give the excluders a consistent timestamp between multi-arch builds
touch --reference=%{SOURCE0} $RPM_BUILD_ROOT/usr/sbin/%{name}-excluder
touch --reference=%{SOURCE0} $RPM_BUILD_ROOT/usr/sbin/%{name}-docker-excluder
%files
%doc README.md
%license LICENSE
%{_bindir}/openshift
%{_sharedstatedir}/origin
%{_sysconfdir}/bash_completion.d/openshift
%defattr(-,root,root,0700)
%dir %config(noreplace) %{_sysconfdir}/origin
%ghost %dir %config(noreplace) %{_sysconfdir}/origin
%ghost %config(noreplace) %{_sysconfdir}/origin/.config_managed
%files tests
%{_bindir}/openshift-tests
%files hypershift
%{_bindir}/hypershift
%defattr(-,root,root,0700)
%files hyperkube
%{_bindir}/hyperkube
%defattr(-,root,root,0700)
%files master
%defattr(-,root,root,0700)
%config(noreplace) %{_sysconfdir}/origin/master
%files node
%{_sysconfdir}/systemd/system.conf.d/origin-accounting.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-node
%defattr(-,root,root,0700)
%config(noreplace) %{_sysconfdir}/origin/node
%dir %{_sysconfdir}/kubernetes/manifests
%preun node
%systemd_preun %{name}-node.service
%postun node
%systemd_postun
%files sdn-ovs
%{_bindir}/openshift-sdn
%dir %{_sysconfdir}/cni/net.d
%dir /opt/cni/bin
/opt/cni/bin/*
%files clients
%license LICENSE
%{_bindir}/oc
%{_bindir}/kubectl
%{_bindir}/openshift-deploy
%{_bindir}/openshift-docker-build
%{_bindir}/openshift-sti-build
%{_bindir}/openshift-git-clone
%{_bindir}/openshift-extract-image-content
%{_bindir}/openshift-manage-dockerfile
%{_bindir}/openshift-recycle
%{_sysconfdir}/bash_completion.d/oc
%{_sysconfdir}/bash_completion.d/kubectl
%{_mandir}/man1/oc*
%if 0%{?make_redistributable}
%files clients-redistributable
%dir %{_datadir}/%{name}/linux/
%dir %{_datadir}/%{name}/macosx/
%dir %{_datadir}/%{name}/windows/
%{_datadir}/%{name}/linux/oc
%{_datadir}/%{name}/linux/kubectl
%{_datadir}/%{name}/macosx/oc
%{_datadir}/%{name}/macosx/kubectl
%{_datadir}/%{name}/windows/oc.exe
%{_datadir}/%{name}/windows/kubectl.exe
%endif
%files pod
%{_bindir}/pod
%files excluder
/usr/sbin/%{name}-excluder
%pretrans excluder
# we always want to clear this out using the last
# versions script. Otherwise excludes might get left in
if [ -s /usr/sbin/%{name}-excluder ] ; then
/usr/sbin/%{name}-excluder unexclude
fi
%posttrans excluder
# we always want to run this after an install or update
/usr/sbin/%{name}-excluder exclude
%preun excluder
# If we are the last one, clean things up
if [ "$1" -eq 0 ] ; then
/usr/sbin/%{name}-excluder unexclude
fi
%files docker-excluder
/usr/sbin/%{name}-docker-excluder
%files template-service-broker
%{_bindir}/template-service-broker
%pretrans docker-excluder
# we always want to clear this out using the last
# versions script. Otherwise excludes might get left in
if [ -s /usr/sbin/%{name}-docker-excluder ] ; then
/usr/sbin/%{name}-docker-excluder unexclude
fi
%posttrans docker-excluder
# we always want to run this after an install or update
/usr/sbin/%{name}-docker-excluder exclude
%preun docker-excluder
# If we are the last one, clean things up
if [ "$1" -eq 0 ] ; then
/usr/sbin/%{name}-docker-excluder unexclude
fi
%changelog