community/docker: add needed binaries

docker 1.11 needs runc, containerd and containerd-shim. We bundle those
simliar to how the precompiled official docker binary distribution does.
This commit is contained in:
Natanael Copa 2016-04-19 12:06:20 +02:00
parent c8304fd395
commit a0d3ff6891
4 changed files with 156 additions and 19 deletions

View File

@ -1,60 +1,111 @@
# Maintainer: Eivind Uggedal <eivind@uggedal.com>
pkgname=docker
pkgver=1.11.0
pkgrel=0
_gitcommit=a34a1d5
_ver=${pkgver/_/-}
pkgrel=1
_gitcommit=v$_ver
pkgdesc="Pack, ship and run any application as a lightweight container"
url="http://www.docker.io/"
arch="all"
license="ASL 2.0"
depends="iptables git xz"
depends_dev=""
makedepends="go sqlite-dev btrfs-progs-dev bash linux-headers"
makedepends="go sqlite-dev btrfs-progs-dev bash linux-headers coreutils libseccomp-dev"
options="!strip"
install="$pkgname.pre-install"
_runc_ver=0.1.0
_containerd_ver=0.2.0
subpackages="
$pkgname-bash-completion:bashcomp
$pkgname-zsh-completion:zshcomp
$pkgname-vim:vim
"
source="
$pkgname-$pkgver.tar.gz::https://github.com/docker/docker/archive/v$pkgver.tar.gz
openrc-fixes.patch
$pkgname-$pkgver.tar.gz::https://github.com/docker/docker/archive/v$_ver.tar.gz
runc-$_runc_ver.tar.gz::https://github.com/opencontainers/runc/archive/v$_runc_ver.tar.gz
containerd-$_containerd_ver.tar.gz::https://github.com/docker/containerd/archive/v$_containerd_ver.tar.gz
docker-openrc-fixes.patch
docker-gitcommit.patch
runc-0001-nsexec-fix-build-against-musl-libc.patch
"
_builddir="$srcdir"/$pkgname-$pkgver
builddir="$srcdir"/$pkgname-$_ver
_buildtags="exclude_graphdriver_aufs exclude_graphdriver_devicemapper"
_runc_buildtags="seccomp"
_runc_builddir="$srcdir"/runc-$_runc_ver
prepare() {
_containerd_builddir="$srcdir"/containerd-$_containerd_ver
_apply_patches() {
local _dir="$1"
local _prefix="$2"
local i
cd "$_builddir"
msg "applying patches for $_prefix"
cd "$_dir"
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
${_prefix}-*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}
prepare() {
_apply_patches "$builddir" docker || return 1
_apply_patches "$_runc_builddir" runc || return 1
}
build() {
cd "$_builddir"
cd "$_runc_builddir"
cd "$builddir"
export AUTO_GOPATH=1
export DOCKER_GITCOMMIT=$_gitcommit
export DOCKER_BUILDTAGS=$_buildtags
unset CC # prevent possible ccache issues
# containerd
cd "$_containerd_builddir" || return 1
mkdir -p src/github.com/docker/
ln -s "$_containerd_builddir" src/github.com/docker/containerd
GOPATH="$PWD" LDFLAGS="" make GIT_COMMIT="v$_containerd_ver" || return 1
# runc
cd "$_runc_builddir" || return 1
GOPATH="$PWD" make COMMIT="v$_runc_ver" || return 1
# docker
cd "$builddir"
./hack/make.sh dynbinary
}
package() {
cd "$_builddir"
cd "$builddir"
local ver=$(cat VERSION)
install -Dm755 bundles/$ver/dynbinary/docker-$ver \
"$pkgdir"/usr/bin/docker
"$pkgdir"/usr/bin/docker || return 1
install -Dm755 "$_runc_builddir"/runc \
"$pkgdir"/usr/bin/docker-runc || return 1
install -Dm755 "$_containerd_builddir"/bin/containerd \
"$pkgdir"/usr/bin/docker-containerd || return 1
install -Dm755 "$_containerd_builddir"/bin/containerd-shim \
"$pkgdir"/usr/bin/docker-containerd-shim || return 1
install -Dm755 "$_containerd_builddir"/bin/ctr \
"$pkgdir"/usr/bin/docker-containerd-ctr || return 1
install -Dm755 bundles/$ver/dynbinary/dockerinit-$ver \
"$pkgdir"/usr/lib/docker/dockerinit
install -Dm755 contrib/init/openrc/docker.initd \
"$pkgdir"/etc/init.d/docker
install -Dm644 contrib/init/openrc/docker.confd \
@ -67,7 +118,7 @@ bashcomp() {
depends=""
install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
install -Dm644 "$_builddir"/contrib/completion/bash/$pkgname \
install -Dm644 "$builddir"/contrib/completion/bash/$pkgname \
"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}
@ -77,7 +128,7 @@ zshcomp() {
depends=""
install_if="$pkgname=$pkgver-r$pkgrel zsh"
install -Dm644 "$_builddir"/contrib/completion/zsh/_$pkgname \
install -Dm644 "$builddir"/contrib/completion/zsh/_$pkgname \
"$subpkgdir"/usr/share/zsh/site-functions/_$pkgname || return 1
}
@ -88,14 +139,26 @@ vim() {
local f=
for f in ftdetect/dockerfile.vim syntax/dockerfile.vim; do
install -Dm644 "$_builddir"/contrib/syntax/vim/$f \
install -Dm644 "$builddir"/contrib/syntax/vim/$f \
"$subpkgdir"/usr/share/vim/vimfiles/$f
done
}
md5sums="08cb0f7a7136f7aacc429392279ebd65 docker-1.11.0.tar.gz
506e32a6157a7f92e67511111fba6fe8 openrc-fixes.patch"
73971b4020a39445f071c3b3d5361a30 runc-0.1.0.tar.gz
bf5be6fb33f02855af5ecfa97dae99f9 containerd-0.2.0.tar.gz
506e32a6157a7f92e67511111fba6fe8 docker-openrc-fixes.patch
48b59f53f4a288611775df3c21bd7ba6 docker-gitcommit.patch
0c30db28eaccc5489a11b530ec0a4f7b runc-0001-nsexec-fix-build-against-musl-libc.patch"
sha256sums="088869b9a19ae17656e068aa6d3d473866e8133365427c601c671da1b2189057 docker-1.11.0.tar.gz
864d229e21dfa6c931b29b908093302a48837ddb1aa4205088f6f7fd4d7da4e3 openrc-fixes.patch"
681d6d89541ae2e06757f999a242a1f97bbcb1ad6e10f4cdee287ec4a9d2bff9 runc-0.1.0.tar.gz
1462e0c233763800b91ac2a670d82994ba1988560928e153f751fb1c0a6608c0 containerd-0.2.0.tar.gz
864d229e21dfa6c931b29b908093302a48837ddb1aa4205088f6f7fd4d7da4e3 docker-openrc-fixes.patch
a81bd65cdc9eab276de78d639a907ca5de3e96c5697d18bb37367fd525500684 docker-gitcommit.patch
a0ed2085c759a51acb1be56880655423156130fad3064f6f800b6a9c56144b78 runc-0001-nsexec-fix-build-against-musl-libc.patch"
sha512sums="ecb7f531a5632fd6274e3eec59a5194c61d0788ab9f3864845cbc248232c2f14671a26c34abab8c5ca85ce6106ae72ea3ae4e5d133ad1efb126069ae82a2dba0 docker-1.11.0.tar.gz
1162f62e8a7a5ded0c54cfe46014449efd67491bdb678fa22862117adb08206c909a3f98b0062125d25256dc1f48596b696bd4b19a8804d2862e758678a8bb62 openrc-fixes.patch"
8a9ff02b0161eda0a730194b0fbf7ad76e8f379992e74061ef49302da3492fd0c53f06db9153ded4d934d67bbf6f4291d6154254f1b924ef73c97c44cd14ffcf runc-0.1.0.tar.gz
381c0a21733fb79e90364649b46cbdadbc32d07245bd7a320465f6619ee5895e9552b7cc4393cb8d409295a7b867b7e461c079715cf1938e6313d4b888d81518 containerd-0.2.0.tar.gz
1162f62e8a7a5ded0c54cfe46014449efd67491bdb678fa22862117adb08206c909a3f98b0062125d25256dc1f48596b696bd4b19a8804d2862e758678a8bb62 docker-openrc-fixes.patch
deaa18afae793167cfbc7f0b4c7f94db237a9bbabb217201e84dc19849ffbc3473f13d4d28a3692325b5a08758db6563ff310cb6b8dc862fc9f41c84f79e6dad docker-gitcommit.patch
baedd5b3b45465d70b18c78688db48a35015ad2db5a1ad20c06c21a3b0146f634a0910c215ade7035e4c61f9f140410be7ff9d1cb142af067e09f3844796049f runc-0001-nsexec-fix-build-against-musl-libc.patch"

View File

@ -0,0 +1,28 @@
From 355ad33087c1c683458b60a6bc9e1f89623ee275 Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@docker.com>
Date: Thu, 14 Apr 2016 17:29:12 +0200
Subject: [PATCH] Fix detection of git commit during build from tarball
Distro packagers will often use the tarball to build a package and have
the build script for the package in git. To avoid that the docker build
script picks up the git commit from the distro repo we also check for a
directory named .git before check for -unsupported builds.
Signed-off-by: Natanael Copa <natanael.copa@docker.com>
---
hack/make.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hack/make.sh b/hack/make.sh
index 58561e2..41a53f6 100755
--- a/hack/make.sh
+++ b/hack/make.sh
@@ -79,7 +79,7 @@ DEFAULT_BUNDLES=(
)
VERSION=$(< ./VERSION)
-if command -v git &> /dev/null && git rev-parse &> /dev/null; then
+if command -v git &> /dev/null && [ -d .git ] && git rev-parse &> /dev/null; then
GITCOMMIT=$(git rev-parse --short HEAD)
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
GITCOMMIT="$GITCOMMIT-unsupported"

View File

@ -0,0 +1,46 @@
From ac6bd953192fa6752a07be7501f69f7cffe33e8e Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@docker.com>
Date: Tue, 19 Apr 2016 10:43:00 +0200
Subject: [PATCH] nsexec: fix build against musl libc
Remove a wrongly added include which was added in commit 3c2e77ee (Add a
compatibility header for CentOS/RHEL 6, 2016-01-29) apparently to
fix this compile error on centos 6:
> In file included from
> Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c:20:
> /usr/include/linux/netlink.h:35: error: expected specifier-qualifier-list before 'sa_family_t'
The glibc bits/sockaddr.h says that this header should never be included
directly[1]. Instead, sys/socket.h should be used.
The problem was correctly fixed later, in commit 394fb55 (Fix build
error on centos6, 2016-03-02) so the incorrect bits/sockaddr.h can
safely be removed.
This is needed to build musl libc.
Fixes #761
[1]: https://github.molgen.mpg.de/git-mirror/glibc/blob/20003c49884422da7ffbc459cdeee768a6fee07b/bits/sockaddr.h#L20
Signed-off-by: Natanael Copa <natanael.copa@docker.com>
---
libcontainer/nsenter/nsexec.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libcontainer/nsenter/nsexec.c b/libcontainer/nsenter/nsexec.c
index 8f37d6c..40a8f89 100644
--- a/libcontainer/nsenter/nsexec.c
+++ b/libcontainer/nsenter/nsexec.c
@@ -18,7 +18,6 @@
#include <unistd.h>
#include <grp.h>
-#include <bits/sockaddr.h>
#include <linux/types.h>
// All arguments should be above the stack because it grows down
--
2.8.1