+#
+# Conditional build:
+%bcond_with tests # build without tests
+
Summary: Docker: the Linux container engine
Name: lxc-docker
-Version: 0.6.0
+Version: 0.7.0
Release: 1
License: Apache v2.0
Group: Applications/System
-Source0: https://github.com/dotcloud/docker/archive/v%{version}.tar.gz
-# Source0-md5: 1aedc1fcbb743cd44330a54334db221e
-Source100: https://raw.github.com/dotcloud/docker/v0.5.3/Makefile
-# Source100-md5: 44cc86a37fc5dfe59596076d346da20d
-Source1: https://github.com/gorilla/context/archive/master.tar.gz?/gorilla-context.tgz
-# Source1-md5: 621f599f7a49f56ca89c25a6d01ecc3a
-Source2: https://github.com/gorilla/mux/archive/master.tar.gz?/gorilla-mux.tgz
-# Source2-md5: e908c7da6b4b8b61b4733d4a348f015c
-Source3: https://github.com/kr/pty/archive/master.tar.gz?/kr-pty.tgz
-# Source3-md5: ffdcacc582c7b6404e71c2dce638869e
-Source4: https://github.com/dotcloud/tar/archive/master.tar.gz?/tar.tgz
-# Source4-md5: 7458ecaa777e56d124b61638d597b37f
-# $ PKG=code.google.com/p/go.net/ REV=84a4013f96e0; hg clone http://$PKG go.net && cd go.net && hg checkout $REV && cd .. && tar -cjf go.net.tar.gz2 --exclude-vcs go.net
-Source5: go.net.tar.bz2
-# Source5-md5: c8fd9d068430ddfa42d28d4772260eda
+Source0: https://github.com/dotcloud/docker/archive/v%{version}/docker-%{version}.tar.gz
+# Source0-md5: bc5e2aa1fbcd3ab8fac1a4f6a4613a16
+Source5: %{name}.service
+Source6: %{name}.init
URL: http://github.com/dotcloud/docker
-BuildRequires: golang >= 1.1
+BuildRequires: device-mapper-devel
+BuildRequires: golang >= 1.1.2
+BuildRequires: rpmbuild(macros) >= 1.228
+BuildRequires: sqlite3-devel >= 3.7.9
+Requires(post,preun): /sbin/chkconfig
+Requires(postun): /usr/sbin/groupdel
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires: iproute2 >= 3.5
Requires: iptables
-Requires: lxc
+Requires: lxc >= 0.8
+Requires: rc-scripts >= 0.4.0.10
+Requires: tar >= 1:1.26
Requires: uname(release) >= 3.8
+Requires: xz
+Suggests: git-core >= 1.7
+Suggests: libcgroup
+Suggests: xz >= 1:4.9
+Provides: group(docker)
+Patch0: %{name}-nosha.patch
+# only runs on x64 hosts for now:
+# https://github.com/dotcloud/docker/issues/136
+# https://github.com/dotcloud/docker/issues/611
+ExclusiveArch: %{x8664}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define bash_compdir %{_datadir}/bash-completion/completions
+%define _vimdatadir %{_datadir}/vim
# binary stripped or something
%define _enable_debug_packages 0
large-scale web deployments, database clusters, continuous deployment
systems, private PaaS, service-oriented architectures, etc.
-%package -n bash-completion-lxc-docker
+%package -n bash-completion-%{name}
Summary: bash-completion for Docker
Summary(pl.UTF-8): bashowe uzupełnianie nazw dla Dockera
Group: Applications/Shells
%description -n bash-completion-lxc-docker -l pl.UTF-8
Pakiet ten dostarcza bashowe uzupełnianie nazw dla Dockera.
+%package -n vim-syntax-%{name}
+Summary: Vim syntax: Docker
+Group: Applications/Editors/Vim
+Requires: %{name} = %{version}-%{release}
+Requires: vim-rt >= 4:7.2.170
+%if "%{_rpmversion}" >= "5"
+BuildArch: noarch
+%endif
+
+%description -n vim-syntax-%{name}
+This plugin provides syntax highlighting in Dockerfile.
+
%prep
-%setup -q -n docker-%{version} -a1 -a2 -a3 -a4 -a5
-cp -p %{SOURCE100} .
-
-# handle external deps offline, these are taken from Dockerfile
-install -d .gopath/src/github.com/{gorilla,kr,dotcloud}
-# git clone https://github.com/gorilla/context .gopath/src/github.com/gorilla/context
-mv context-master .gopath/src/github.com/gorilla/context
-# git clone https://github.com/gorilla/mux .gopath/src/github.com/gorilla/mux
-mv mux-master .gopath/src/github.com/gorilla/mux
-# git clone https://github.com/kr/pty .gopath/src/github.com/kr/pty
-mv pty-master .gopath/src/github.com/kr/pty
-# git clone https://github.com/dotcloud/tar .gopath/src/github.com/dotcloud/tar
-mv tar-master .gopath/src/github.com/dotcloud/tar
-# PKG=code.google.com/p/go.net/
-install -d .gopath/src/code.google.com/p
-mv go.net .gopath/src/code.google.com/p/go.net
+%setup -q -n docker-%{version}
+%patch0 -p1
+
+install -d vendor/src/github.com/dotcloud
+ln -s $(pwd) vendor/src/github.com/dotcloud/docker
%build
-# avoid interfering with builder env
-unset GIT_WORK_TREE
-unset GIT_DIR
-%{__make} VERBOSE=1
+export GOPATH=$(pwd)/vendor
+install -d build
+cd build
+VERSION=%{version}
+GITCOMMIT=pld-%{release} # use RPM_PACKAGE_RELEASE for this
+# Use these flags when compiling the tests and final binary
+# without '-d', as that fails now
+LDFLAGS="-X main.GITCOMMIT $GITCOMMIT -X main.VERSION $VERSION -w"
+go build -v -ldflags "$LDFLAGS" -a github.com/dotcloud/docker/docker
+go build -v -ldflags "$LDFLAGS" -a ../dockerinit/dockerinit.go
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,/var/lib/docker/{containers,graph,volumes}}
-install -p bin/docker $RPM_BUILD_ROOT%{_bindir}/lxc-docker
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,/etc/rc.d/init.d,%{systemdunitdir},/var/lib/docker/{containers,graph,volumes}}
+install -p build/docker $RPM_BUILD_ROOT%{_bindir}/lxc-docker
+install -p build/dockerinit $RPM_BUILD_ROOT%{_bindir}/dockerinit
+install -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/lxc-docker.service
+install -p %{SOURCE6} $RPM_BUILD_ROOT/etc/rc.d/init.d/lxc-docker
ln -s lxc-docker $RPM_BUILD_ROOT%{_bindir}/docker
-cp -p packaging/debian/lxc-docker.1 $RPM_BUILD_ROOT%{_mandir}/man1
+#cp -p packaging/debian/lxc-docker.1 $RPM_BUILD_ROOT%{_mandir}/man1
# bash completion
install -d $RPM_BUILD_ROOT%{bash_compdir}
-cp -p contrib/docker.bash $RPM_BUILD_ROOT%{bash_compdir}/lxc-docker
+cp -p contrib/completion/bash/docker $RPM_BUILD_ROOT%{bash_compdir}/lxc-docker
ln -s lxc-docker $RPM_BUILD_ROOT%{bash_compdir}/docker
+# vim syntax
+install -d $RPM_BUILD_ROOT%{_vimdatadir}
+cp -a contrib/vim-syntax/* $RPM_BUILD_ROOT%{_vimdatadir}
+%{__rm} $RPM_BUILD_ROOT%{_vimdatadir}/{LICENSE,README.md}
+
+%pre
+%groupadd -g 296 docker
+
+%post
+/sbin/chkconfig --add %{name}
+%service -n %{name} restart
+
+%preun
+if [ "$1" = "0" ]; then
+ %service -q %{name} stop
+ /sbin/chkconfig --del %{name}
+fi
+
+%postun
+if [ "$1" = "0" ]; then
+ %groupremove docker
+fi
+
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc README.md CHANGELOG.md CONTRIBUTING.md FIXME LICENSE AUTHORS NOTICE MAINTAINERS
+%{systemdunitdir}/lxc-docker.service
+%attr(754,root,root) /etc/rc.d/init.d/lxc-docker
%attr(755,root,root) %{_bindir}/lxc-docker
%attr(755,root,root) %{_bindir}/docker
-%{_mandir}/man1/lxc-docker.1*
+%attr(755,root,root) %{_bindir}/dockerinit
+#%{_mandir}/man1/lxc-docker.1*
%dir %attr(700,root,root) /var/lib/docker
%dir %attr(700,root,root) /var/lib/docker/containers
%dir %attr(700,root,root) /var/lib/docker/graph
%dir %attr(700,root,root) /var/lib/docker/volumes
-%files -n bash-completion-lxc-docker
+%files -n bash-completion-%{name}
%defattr(644,root,root,755)
%{bash_compdir}/lxc-docker
%{bash_compdir}/docker
+
+%files -n vim-syntax-%{name}
+%defattr(644,root,root,755)
+%doc contrib/vim-syntax/{README.md,LICENSE}
+%{_vimdatadir}/doc/dockerfile.txt
+%{_vimdatadir}/ftdetect/dockerfile.vim
+%{_vimdatadir}/syntax/dockerfile.vim