From 1a6718b386a264569a1d83b89804ecbcdfcc3930 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 10 Sep 2017 13:26:42 +0200 Subject: [PATCH] Add docker and dependencies --- satellites/docker.sat | 152 ++++++++++++++++++++++++++++++++++++++ satellites/go-md2man.sat | 23 ++++++ satellites/libseccomp.sat | 14 ++++ 3 files changed, 189 insertions(+) create mode 100644 satellites/docker.sat create mode 100644 satellites/go-md2man.sat create mode 100644 satellites/libseccomp.sat diff --git a/satellites/docker.sat b/satellites/docker.sat new file mode 100644 index 0000000..b3524bb --- /dev/null +++ b/satellites/docker.sat @@ -0,0 +1,152 @@ +# NOTE: Docker uses their own versions of several programs, installed as docker-* +# They could be installed separately, and linked with their docker-* names, +# but docker is very picky about exactly which commit of these it's running. +# As such, I will bundle the docker-specific versions in this package, +# instead of spreading them over multiple packages. + +# The exact commit number for these programs is specified in +# components/engine/hack/dockerfile/binaries-commits in the docker archive. + +name=docker +version=17.06.2-ce +version_runc=810190ceaa507aa2727d7ae6f4790c76ec150bd2 +version_containerd=6e23458c129b551d5c9871e5174f6b1b7f6d1170 +version_tini=949e6facb77383876aeff8a6944dde66b3089574 +version_libnetwork=7b2b1feb1de4817d522cc372af149ff48d25028e +update_url="https://github.com/$name/$name-ce/releases" +update_names="/archive/v$version.tar.gz" + +dlextract "https://github.com/$name/$name-ce/archive/v$version/$name-$version.tar.gz" \ + '45f92308bd542b6a8344c490d0383b64' +dlextract "https://github.com/$name/runc/archive/$version_runc/runc-$version_runc.tar.gz" \ + 'd2d5d628662bfbe11fd0d1bb7eb1c63c' +dlextract "https://github.com/$name/containerd/archive/$version_containerd/containerd-$version_containerd.tar.gz" \ + 'd1d057d831d46021cefee3a3c52c6c65' +dlextract "https://github.com/krallin/tini/archive/$version_tini/tini-$version_tini.tar.gz" \ + '9873191fc835a79cb94b24377391667e' +dlextract "https://github.com/$name/libnetwork/archive/$version_libnetwork/libnetwork-$version_libnetwork.tar.gz" \ + '9360e38c43e862e42c128db1852ac5bb' +_ + +# Verify that the dependency programs' versions match +# This should avoid the packager to have to manually check the file every update +( + . "$name-ce-$version/components/engine/hack/dockerfile/binaries-commits" + mismatches="" + for dependency in runc containerd tini libnetwork; do + if [ "$(eval echo \${version_$dependency})" != \ + "$(eval echo \${$(echo $dependency | tr a-z A-Z)_COMMIT})" ]; then + mismatches+="$dependency: $(eval echo \${$(echo $dependency | tr a-z A-Z)_COMMIT}) +" + fi + done + + if [ "$mismatches" ]; then + echo "Error: Mismatching commit for one or more dependencies" + printf "%s" "$mismatches" + exit 1 + fi +) + +# Some scripts apparently like to pick up and misuse LDFLAGS for go +unset LDFLAGS + +# Set up a fake GOPATH +mkdir -p ".gopath/src/github.com/$name" \ + '.gopath/src/github.com/opencontainers' \ + '.gopath/src/github.com/containerd' +ln -rs "$name-ce-$version/components/cli" ".gopath/src/github.com/$name/cli" +ln -rs "$name-ce-$version/components/engine" ".gopath/src/github.com/$name/$name" +ln -rs "runc-$version_runc" '.gopath/src/github.com/opencontainers/runc' +ln -rs "containerd-$version_containerd" '.gopath/src/github.com/containerd/containerd' +ln -rs "libnetwork-$version_libnetwork" ".gopath/src/github.com/$name/libnetwork" +export GOPATH="$PWD/.gopath" + +# Build engine +( cd "$name-ce-$version/components/engine" + DOCKER_GITCOMMIT="$version" \ + DOCKER_BUILDTAGS='seccomp' \ + hack/make.sh dynbinary +) + +# Build cli +( cd "$name-ce-$version/components/cli" + make VERSION="$version" dynbinary + + mkdir -p man/man1 + go build -v -o gen-manpages "github.com/$name/cli/man" + ./gen-manpages --root . --target man/man1 + + if command -v go-md2man 2> /dev/null; then + ./man/md2man-all.sh -q + fi +) + +# Build runc +( cd "$GOPATH/src/github.com/opencontainers/runc" + make BUILDTAGS='seccomp' \ + GIT_BRANCH=HEAD \ + COMMIT_NO="$version_runc" \ + COMMIT="$version_runc" +) + +# Build containerd +make -C "containerd-$version_containerd" + +# Build tini +( cd "tini-$version_tini" + cmake . + make tini-static +) + +# Build proxy +( cd "libnetwork-$version_libnetwork" + go build -v -ldflags="-linkmode=external" -o proxy ./cmd/proxy +) + +# Install engine +( cd "$name-ce-$version/components/engine" + install -Dm755 -t "$dir_install/$dir_prefix/$dir_bin" "bundles/latest/dynbinary-daemon/${name}d" + + install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/vim/vimfiles/syntax" \ + contrib/syntax/vim/syntax/dockerfile.vim + install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/vim/vimfiles/ftdetect" \ + contrib/syntax/vim/ftdetect/dockerfile.vim +) + +# Install cli +( cd "$name-ce-$version/components/cli" + install -Dm755 -t "$dir_install/$dir_prefix/$dir_bin" "build/$name" + + install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/bash-completion/completions" \ + "contrib/completion/bash/$name" + install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/zsh/site-functions" \ + "contrib/completion/zsh/_$name" + install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/fish/vendor_completions.d" \ + "contrib/completion/fish/$name.fish" + + mkdir -p "$dir_install/$dir_prefix/$dir_man" + cp -at "$dir_install/$dir_prefix/$dir_man" man/man* +) + +# Install runc +install -Dm755 "runc-$version_runc/runc" \ + "$dir_install/$dir_prefix/$dir_bin/$name-runc" + +# Install containerd +install -Dm755 "containerd-$version_containerd/bin/containerd" \ + "$dir_install/$dir_prefix/$dir_bin/$name-containerd" +install -Dm755 "containerd-$version_containerd/bin/containerd-shim" \ + "$dir_install/$dir_prefix/$dir_bin/$name-containerd-shim" +install -Dm755 "containerd-$version_containerd/bin/ctr" \ + "$dir_install/$dir_prefix/$dir_bin/$name-containerd-ctr" + +# Install tini +install -Dm755 "tini-$version_tini/tini-static" \ + "$dir_install/$dir_prefix/$dir_bin/$name-init" + +# Install proxy +install -Dm755 "libnetwork-$version_libnetwork/proxy" \ + "$dir_install/$dir_prefix/$dir_bin/$name-proxy" + +# vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: diff --git a/satellites/go-md2man.sat b/satellites/go-md2man.sat new file mode 100644 index 0000000..2443c13 --- /dev/null +++ b/satellites/go-md2man.sat @@ -0,0 +1,23 @@ +name=go-md2man +version=1.0.7 +update_url="https://github.com/cpuguy83/$name/releases" +update_names="/archive/v$version.tar.gz" + +dlextract "https://github.com/cpuguy83/$name/archive/v$version/$name-$version.tar.gz" \ + '2282a7a24635c63ca7bb08b5e07282fc' +_ + +# Set up a fake GOPATH +mkdir -p '.gopath/src/github.com/cpuguy83' +ln -rs "$name-$version" ".gopath/src/github.com/cpuguy83/$name" +export GOPATH="$PWD/.gopath" + +cd "$name-$version" + +go build -v -o "$name" +"./$name" -in="$name.1.md" -out="$name.1" + +install -Dm755 -t "$dir_install/$dir_prefix/$dir_bin" "$name" +install -Dm644 -t "$dir_install/$dir_prefix/$dir_man/man1" "$name.1" + +# vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: diff --git a/satellites/libseccomp.sat b/satellites/libseccomp.sat new file mode 100644 index 0000000..f7a59c2 --- /dev/null +++ b/satellites/libseccomp.sat @@ -0,0 +1,14 @@ +import 'compile/configure' + +name=libseccomp +version=2.3.2 +update_url="https://github.com/seccomp/$name/releases" + +dlextract "https://github.com/seccomp/$name/releases/download/v$version/$name-$version.tar.gz" \ + 'e74a626bea0cd607c23229b10b5f93da' +_ + +cd "$name-$version" +compile_configure + +# vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: