a7175518538ccd0a5578ca0423bcf4f0f3e4adf2
[packages/docker.git] / docker.spec
1 #
2 # Conditional build:
3 %bcond_with     tests           # build without tests
4 %bcond_with     vim                     # build vim syntax package (bundled in vim 7.4.979-2)
5 %bcond_with     doc                     # build manual pages
6
7 # NOTES
8 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
9
10 # v1.0.0-rc2-123-gac031b5
11 %define runc_commit ac031b5
12 # v0.2.3-66-g8517738
13 %define containerd_commit 8517738
14 # v0.8.0-dev.2-464-g0f53435
15 %define libnetwork_commit 0f53435
16 %define subver -rc1
17 Summary:        Docker: the open-source application container engine
18 Name:           docker
19 Version:        1.13.0
20 Release:        0.2
21 License:        Apache v2.0
22 Group:          Applications/System
23 # https://github.com/docker/docker/releases
24 Source0:        https://github.com/docker/docker/archive/v%{version}%{subver}/%{name}-%{version}%{subver}.tar.gz
25 # Source0-md5:  3e40a95c40182314a5c2ba41f5b7d7d2
26 Source1:        https://github.com/docker/runc/archive/%{runc_commit}/runc-%{runc_commit}.tar.gz
27 # Source1-md5:  5c22c984bb610dbcd57d11c83125f376
28 Source2:        https://github.com/docker/containerd/archive/%{containerd_commit}/containerd-%{containerd_commit}.tar.gz
29 # Source2-md5:  f5f0654554164fe3e3433e41955b64f9
30 Source3:        https://github.com/docker/libnetwork/archive/%{libnetwork_commit}/libnetwork-%{libnetwork_commit}.tar.gz
31 # Source3-md5:  7cfbfe76355aae3577c77a6a4b2c92db
32 Source4:        https://github.com/krallin/tini/archive/v0.13.0/tini-0.13.0.tar.gz
33 # Source4-md5:  c29541112a242c53c82bb6b1213f288f
34 Source5:        %{name}d.sh
35 Source7:        %{name}.init
36 Source8:        %{name}.sysconfig
37 Patch0:         systemd.patch
38 URL:            http://www.docker.com/
39 BuildRequires:  btrfs-progs-devel >= 3.16.1
40 BuildRequires:  device-mapper-devel >= 2.02.89
41 BuildRequires:  golang >= 1.6
42 BuildRequires:  libseccomp-devel >= 2.2.1
43 BuildRequires:  rpmbuild(macros) >= 1.644
44 BuildRequires:  sqlite3-devel >= 3.7.9
45 Requires(post,preun):   /sbin/chkconfig
46 Requires(postun):       /usr/sbin/groupdel
47 Requires(pre):  /usr/bin/getgid
48 Requires(pre):  /usr/sbin/groupadd
49 Requires:       ca-certificates
50 Requires:       cmake
51 Requires:       iproute2 >= 3.5
52 Requires:       iptables
53 Requires:       rc-scripts >= 0.4.0.10
54 Requires:       systemd-units >= 38
55 Requires:       tar >= 1:1.26
56 Requires:       uname(release) >= 3.8
57 Requires:       xz
58 Suggests:       docker-credential-helpers
59 Suggests:       git-core >= 1.7
60 Suggests:       libcgroup
61 Suggests:       xz >= 1:4.9
62 Provides:       group(docker)
63 Obsoletes:      lxc-docker < 1.1.1
64 # only runs on x64 hosts for now:
65 # https://github.com/docker/docker/issues/136
66 # https://github.com/docker/docker/issues/611
67 ExclusiveArch:  %{x8664}
68 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
69
70 %define         bash_compdir    %{_datadir}/bash-completion/completions
71 %define         zsh_compdir     %{_datadir}/zsh/site-functions
72 %define         _vimdatadir             %{_datadir}/vim
73 %define         _libexecdir             %{_prefix}/lib
74
75 # binary stripped or something
76 %define         _enable_debug_packages 0
77
78 %description
79 Docker is an open source project to pack, ship and run any application
80 as a lightweight container
81
82 Docker containers are both hardware-agnostic and platform-agnostic.
83 This means that they can run anywhere, from your laptop to the largest
84 EC2 compute instance and everything in between - and they don't
85 require that you use a particular language, framework or packaging
86 system. That makes them great building blocks for deploying and
87 scaling web apps, databases and backend services without depending on
88 a particular stack or provider.
89
90 Docker is an open-source implementation of the deployment engine which
91 powers dotCloud, a popular Platform-as-a-Service. It benefits directly
92 from the experience accumulated over several years of large-scale
93 operation and support of hundreds of thousands of applications and
94 databases.
95
96 %package -n bash-completion-%{name}
97 Summary:        bash-completion for Docker
98 Summary(pl.UTF-8):      bashowe uzupełnianie nazw dla Dockera
99 Group:          Applications/Shells
100 Requires:       %{name}
101 Requires:       bash-completion >= 2.0
102 Obsoletes:      bash-completion-lxc-docker < 1.1.1
103 %if "%{_rpmversion}" >= "5"
104 BuildArch:      noarch
105 %endif
106
107 %description -n bash-completion-%{name}
108 This package provides bash-completion for Docker.
109
110 %description -n bash-completion-%{name} -l pl.UTF-8
111 Pakiet ten dostarcza bashowe uzupełnianie nazw dla Dockera.
112
113 %package -n zsh-completion-%{name}
114 Summary:        zsh completion for Docker
115 Summary(pl.UTF-8):      Uzupełnianie parametrów w zsh dla poleceń Dockera
116 Group:          Applications/Shells
117 Requires:       %{name}
118 %if "%{_rpmversion}" >= "5"
119 BuildArch:      noarch
120 %endif
121
122 %description -n zsh-completion-%{name}
123 This package provides zsh completion for Docker.
124
125 %description -n zsh-completion-%{name} -l pl.UTF-8
126 Pakiet ten dostarcza uzupełnianie w zsh dla poleceń Dockera.
127
128 %package -n vim-syntax-%{name}
129 Summary:        Vim syntax: Docker
130 Group:          Applications/Editors/Vim
131 Requires:       %{name} = %{version}-%{release}
132 Requires:       vim-rt >= 4:7.2.170
133 Obsoletes:      vim-syntax-lxc-docker < 1.1.1
134 %if "%{_rpmversion}" >= "5"
135 BuildArch:      noarch
136 %endif
137
138 %description -n vim-syntax-%{name}
139 This plugin provides syntax highlighting in Dockerfile.
140
141 %prep
142 %setup -q %{?subver:-n %{name}-%{version}%{subver}} -a1 -a2 -a3 -a4
143 mv runc-%{runc_commit}* runc
144 mv containerd-%{containerd_commit}* containerd
145 mv libnetwork-%{libnetwork_commit}* libnetwork
146 mv tini-* tini
147 %patch0 -p1
148
149 install -d vendor/src/github.com/docker
150 ln -s $(pwd) vendor/src/github.com/docker/docker
151 ln -s $(pwd)/containerd containerd/vendor/src/github.com/docker/containerd
152 ln -s $(pwd)/libnetwork vendor/src/github.com/docker/libnetwork
153
154 %build
155 v=$(awk -F= '/RUNC_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
156 echo "$v" | grep "^%{runc_commit}"
157 v=$(awk -F= '/CONTAINERD_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
158 echo "$v" | grep "^%{containerd_commit}"
159 v=$(awk -F= '/LIBNETWORK_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
160 echo "$v" | grep "^%{libnetwork_commit}"
161
162 export GOPATH=$(pwd)/vendor:$(pwd)/containerd/vendor
163 export DOCKER_GITCOMMIT="pld/%{version}"
164 # build docker-runc
165 %{__make} -C runc
166
167 # build docker-containerd
168 %{__make} -C containerd
169
170 # build docker-proxy
171 go build -ldflags="$PROXY_LDFLAGS" \
172         -o docker-proxy \
173         github.com/docker/libnetwork/cmd/proxy
174
175 # build docker-init
176 cd tini
177 cmake -DMINIMAL=ON .
178 %{__make}
179 cd ..
180
181 bash -x hack/make.sh dynbinary
182 %if %{with doc}
183 man/md2man-all.sh
184 %endif
185
186 %install
187 rm -rf $RPM_BUILD_ROOT
188 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
189         $RPM_BUILD_ROOT%{_libexecdir} \
190         $RPM_BUILD_ROOT/var/lib/docker/{containers,execdriver,graph,image,init,network,swarm,tmp,trust,vfs,volumes}
191
192 install -p bundles/%{version}%{?subver}/dynbinary-client/docker-%{version}%{?subver} $RPM_BUILD_ROOT%{_bindir}/docker
193 install -p bundles/%{version}%{?subver}/dynbinary-daemon/dockerd-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/dockerd
194
195 # install docker-runc
196 install -p runc/runc $RPM_BUILD_ROOT%{_sbindir}/docker-runc
197
198 # install docker-containerd
199 install -p containerd/bin/containerd $RPM_BUILD_ROOT%{_sbindir}/docker-containerd
200 install -p containerd/bin/containerd-shim $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-shim
201 install -p containerd/bin/ctr $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-ctr
202
203 # install docker-proxy
204 install -p docker-proxy $RPM_BUILD_ROOT%{_sbindir}/docker-proxy
205
206 # install docker-init
207 install -p tini/tini $RPM_BUILD_ROOT%{_sbindir}/docker-init
208
209 cp -p contrib/init/systemd/docker.service $RPM_BUILD_ROOT%{systemdunitdir}
210 cp -p contrib/init/systemd/docker.socket $RPM_BUILD_ROOT%{systemdunitdir}
211 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/docker
212 install -p %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/dockerd
213 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/sysconfig/docker
214
215 # install udev rules
216 install -d $RPM_BUILD_ROOT/lib/udev/rules.d
217 cp -p contrib/udev/80-docker.rules $RPM_BUILD_ROOT/lib/udev/rules.d
218
219 # bash and zsh completion
220 install -d $RPM_BUILD_ROOT%{bash_compdir}
221 cp -p contrib/completion/bash/docker $RPM_BUILD_ROOT%{bash_compdir}/docker
222 install -d $RPM_BUILD_ROOT%{zsh_compdir}
223 cp -p contrib/completion/zsh/_docker $RPM_BUILD_ROOT%{zsh_compdir}
224
225 # vim syntax
226 %if %{with vim}
227 install -d $RPM_BUILD_ROOT%{_vimdatadir}
228 cp -a contrib/syntax/vim/* $RPM_BUILD_ROOT%{_vimdatadir}
229 %{__rm} $RPM_BUILD_ROOT%{_vimdatadir}/{LICENSE,README.md}
230 %endif
231
232 %pre
233 %groupadd -g 296 docker
234
235 %post
236 /sbin/chkconfig --add %{name}
237 %service -n %{name} restart
238 %systemd_post %{name}.service
239
240 %preun
241 if [ "$1" = "0" ]; then
242         %service -q %{name} stop
243         /sbin/chkconfig --del %{name}
244 fi
245 %systemd_preun %{name}.service
246
247 %postun
248 if [ "$1" = "0" ]; then
249         %groupremove docker
250 fi
251 %systemd_reload
252
253 %clean
254 rm -rf $RPM_BUILD_ROOT
255
256 %files
257 %defattr(644,root,root,755)
258 %doc README.md CHANGELOG.md CONTRIBUTING.md LICENSE AUTHORS NOTICE MAINTAINERS
259 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/docker
260 %attr(754,root,root) /etc/rc.d/init.d/docker
261 %attr(755,root,root) %{_bindir}/docker
262 %attr(755,root,root) %{_sbindir}/docker-containerd
263 %attr(755,root,root) %{_sbindir}/docker-containerd-ctr
264 %attr(755,root,root) %{_sbindir}/docker-containerd-shim
265 %attr(755,root,root) %{_sbindir}/docker-init
266 %attr(755,root,root) %{_sbindir}/docker-proxy
267 %attr(755,root,root) %{_sbindir}/docker-runc
268 %attr(755,root,root) %{_sbindir}/dockerd
269 %attr(755,root,root) %{_libexecdir}/dockerd
270 %{systemdunitdir}/docker.service
271 %{systemdunitdir}/docker.socket
272 /lib/udev/rules.d/80-docker.rules
273
274 %dir %attr(700,root,root) /var/lib/docker
275 %dir %attr(700,root,root) /var/lib/docker/containers
276 %dir %attr(700,root,root) /var/lib/docker/execdriver
277 %dir %attr(700,root,root) /var/lib/docker/graph
278 %dir %attr(700,root,root) /var/lib/docker/image
279 %dir %attr(700,root,root) /var/lib/docker/init
280 %dir %attr(700,root,root) /var/lib/docker/network
281 %dir %attr(700,root,root) /var/lib/docker/swarm
282 %dir %attr(700,root,root) /var/lib/docker/tmp
283 %dir %attr(700,root,root) /var/lib/docker/trust
284 %dir %attr(700,root,root) /var/lib/docker/vfs
285 %dir %attr(700,root,root) /var/lib/docker/volumes
286
287 %files -n bash-completion-%{name}
288 %defattr(644,root,root,755)
289 %{bash_compdir}/docker
290
291 %files -n zsh-completion-%{name}
292 %defattr(644,root,root,755)
293 %{zsh_compdir}/_docker
294
295 %if %{with vim}
296 %files -n vim-syntax-%{name}
297 %defattr(644,root,root,755)
298 %doc contrib/syntax/vim/{README.md,LICENSE}
299 %{_vimdatadir}/doc/dockerfile.txt
300 %{_vimdatadir}/ftdetect/dockerfile.vim
301 %{_vimdatadir}/syntax/dockerfile.vim
302 %endif
This page took 0.074256 seconds and 2 git commands to generate.