From 73df9b4e87d0a9fc13ef75e0d8f2f50ddfc8c7e5 Mon Sep 17 00:00:00 2001 From: Michael Holzheu Date: Tue, 23 Aug 2016 12:17:29 -0400 Subject: [PATCH] s390x: Enable "make deb" for Ubuntu Xenial (16.04) With this patch and Docker PR 25883 ("Add a Dockerfile for generating manpages on s390x") "make deb" creates the following packages for s390x: # cd bundles/1.13.0-dev/build-deb/ # find . . ./ubuntu-xenial ./ubuntu-xenial/docker-engine_1.13.0~dev~git20160823.161729.0.2693af4-0~xenial_s390x.deb ./ubuntu-xenial/docker-engine_1.13.0~dev~git20160823.161729.0.2693af4-0~xenial.dsc ./ubuntu-xenial/docker-engine_1.13.0~dev~git20160823.161729.0.2693af4-0~xenial_s390x.changes ./ubuntu-xenial/Dockerfile.build ./ubuntu-xenial/docker-engine_1.13.0~dev~git20160823.161729.0.2693af4-0~xenial.tar.gz ./docker.log ./test.log Package "docker-engine_1.13.0~dev~git20160823.161729.0.2693af4-0~xenial_s390x.deb" could be successfully installed on a s390x Ubuntu system: # cat /etc/issue Ubuntu 16.04.1 LTS \n \l # dpkg -i docker-engine_1.13.0~dev~git20160823.161729.0.2693af4-0~xenial_s390x.deb ... Installing new version of config file /etc/init.d/docker ... Installing new version of config file /etc/init/docker.conf ... Processing triggers for systemd (229-4ubuntu7) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for man-db (2.7.5-1) ... # docker version Client: Version: 1.13.0-dev API version: 1.25 Go version: go1.7 Git commit: 2693af4-unsupported Built: Wed Aug 24 11:41:13 2016 OS/Arch: linux/s390x Server: ... The s390x "generate.sh" is a modified version of "ppc64le/generate.sh". We removed seccomp for s390x because we need at least libseccomp version 2.3.1 which is not provided by Ubuntu Xenial. Signed-off-by: Michael Holzheu --- contrib/builder/deb/s390x/build.sh | 10 ++ contrib/builder/deb/s390x/generate.sh | 94 +++++++++++++++++++ .../deb/s390x/ubuntu-xenial/Dockerfile | 16 ++++ 3 files changed, 120 insertions(+) create mode 100755 contrib/builder/deb/s390x/build.sh create mode 100755 contrib/builder/deb/s390x/generate.sh create mode 100644 contrib/builder/deb/s390x/ubuntu-xenial/Dockerfile diff --git a/contrib/builder/deb/s390x/build.sh b/contrib/builder/deb/s390x/build.sh new file mode 100755 index 0000000000..8271d9dc47 --- /dev/null +++ b/contrib/builder/deb/s390x/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +set -x +./generate.sh +for d in */; do + docker build -t "dockercore/builder-deb:$(basename "$d")" "$d" +done diff --git a/contrib/builder/deb/s390x/generate.sh b/contrib/builder/deb/s390x/generate.sh new file mode 100755 index 0000000000..b44f918b69 --- /dev/null +++ b/contrib/builder/deb/s390x/generate.sh @@ -0,0 +1,94 @@ +#!/bin/bash +set -e + +# This file is used to auto-generate Dockerfiles for making debs via 'make deb' +# +# usage: ./generate.sh [versions] +# ie: ./generate.sh +# to update all Dockerfiles in this directory +# or: ./generate.sh ubuntu-xenial +# to only update ubuntu-xenial/Dockerfile +# or: ./generate.sh ubuntu-newversion +# to create a new folder and a Dockerfile within it + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +versions=( "$@" ) +if [ ${#versions[@]} -eq 0 ]; then + versions=( */ ) +fi +versions=( "${versions[@]%/}" ) + +for version in "${versions[@]}"; do + echo "${versions[@]}" + distro="${version%-*}" + suite="${version##*-}" + from="s390x/${distro}:${suite}" + + mkdir -p "$version" + echo "$version -> FROM $from" + cat > "$version/Dockerfile" <<-EOF + # + # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/s390x/generate.sh"! + # + + FROM $from + + EOF + + extraBuildTags='pkcs11' + runcBuildTags= + + # this list is sorted alphabetically; please keep it that way + packages=( + apparmor # for apparmor_parser for testing the profile + bash-completion # for bash-completion debhelper integration + btrfs-tools # for "btrfs/ioctl.h" (and "version.h" if possible) + build-essential # "essential for building Debian packages" + curl ca-certificates # for downloading Go + debhelper # for easy ".deb" building + dh-apparmor # for apparmor debhelper + dh-systemd # for systemd debhelper integration + git # for "git commit" info in "docker -v" + libapparmor-dev # for "sys/apparmor.h" + libdevmapper-dev # for "libdevmapper.h" + libltdl-dev # for pkcs11 "ltdl.h" + libseccomp-dev # for "seccomp.h" & "libseccomp.so" + libsqlite3-dev # for "sqlite3.h" + pkg-config # for detecting things like libsystemd-journal dynamically + libsystemd-dev + ) + + case "$suite" in + # s390x needs libseccomp 2.3.1 + xenial) + # Ubuntu Xenial has libseccomp 2.2.3 + runcBuildTags="apparmor selinux" + ;; + *) + extraBuildTags+=' seccomp' + runcBuildTags="apparmor selinux seccomp" + ;; + esac + + # update and install packages + echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile" + + echo >> "$version/Dockerfile" + + awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile >> "$version/Dockerfile" + echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" + echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" + + echo >> "$version/Dockerfile" + + echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" + + echo >> "$version/Dockerfile" + + # print build tags in alphabetical order + buildTags=$( echo "apparmor selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' ) + + echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile" + echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile" +done diff --git a/contrib/builder/deb/s390x/ubuntu-xenial/Dockerfile b/contrib/builder/deb/s390x/ubuntu-xenial/Dockerfile new file mode 100644 index 0000000000..8ff8804873 --- /dev/null +++ b/contrib/builder/deb/s390x/ubuntu-xenial/Dockerfile @@ -0,0 +1,16 @@ +# +# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/s390x/generate.sh"! +# + +FROM s390x/ubuntu:xenial + +RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/* + +ENV GO_VERSION 1.7.1 +RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local +ENV PATH $PATH:/usr/local/go/bin + +ENV AUTO_GOPATH 1 + +ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux +ENV RUNC_BUILDTAGS apparmor selinux