Browse code

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 <holzheu@linux.vnet.ibm.com>

Michael Holzheu authored on 2016/08/24 01:17:29
Showing 3 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,10 @@
0
+#!/bin/bash
1
+set -e
2
+
3
+cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
4
+
5
+set -x
6
+./generate.sh
7
+for d in */; do
8
+	docker build -t "dockercore/builder-deb:$(basename "$d")" "$d"
9
+done
0 10
new file mode 100755
... ...
@@ -0,0 +1,94 @@
0
+#!/bin/bash
1
+set -e
2
+
3
+# This file is used to auto-generate Dockerfiles for making debs via 'make deb'
4
+#
5
+# usage: ./generate.sh [versions]
6
+#    ie: ./generate.sh
7
+#        to update all Dockerfiles in this directory
8
+#    or: ./generate.sh ubuntu-xenial
9
+#        to only update ubuntu-xenial/Dockerfile
10
+#    or: ./generate.sh ubuntu-newversion
11
+#        to create a new folder and a Dockerfile within it
12
+
13
+cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
14
+
15
+versions=( "$@" )
16
+if [ ${#versions[@]} -eq 0 ]; then
17
+	versions=( */ )
18
+fi
19
+versions=( "${versions[@]%/}" )
20
+
21
+for version in "${versions[@]}"; do
22
+	echo "${versions[@]}"
23
+	distro="${version%-*}"
24
+	suite="${version##*-}"
25
+	from="s390x/${distro}:${suite}"
26
+
27
+	mkdir -p "$version"
28
+	echo "$version -> FROM $from"
29
+	cat > "$version/Dockerfile" <<-EOF
30
+		#
31
+		# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/s390x/generate.sh"!
32
+		#
33
+
34
+		FROM $from
35
+
36
+	EOF
37
+
38
+	extraBuildTags='pkcs11'
39
+	runcBuildTags=
40
+
41
+	# this list is sorted alphabetically; please keep it that way
42
+	packages=(
43
+		apparmor # for apparmor_parser for testing the profile
44
+		bash-completion # for bash-completion debhelper integration
45
+		btrfs-tools # for "btrfs/ioctl.h" (and "version.h" if possible)
46
+		build-essential # "essential for building Debian packages"
47
+		curl ca-certificates # for downloading Go
48
+		debhelper # for easy ".deb" building
49
+		dh-apparmor # for apparmor debhelper
50
+		dh-systemd # for systemd debhelper integration
51
+		git # for "git commit" info in "docker -v"
52
+		libapparmor-dev # for "sys/apparmor.h"
53
+		libdevmapper-dev # for "libdevmapper.h"
54
+		libltdl-dev # for pkcs11 "ltdl.h"
55
+		libseccomp-dev  # for "seccomp.h" & "libseccomp.so"
56
+		libsqlite3-dev # for "sqlite3.h"
57
+		pkg-config # for detecting things like libsystemd-journal dynamically
58
+		libsystemd-dev
59
+	)
60
+
61
+	case "$suite" in
62
+		# s390x needs libseccomp 2.3.1
63
+		xenial)
64
+			# Ubuntu Xenial has libseccomp 2.2.3
65
+			runcBuildTags="apparmor selinux"
66
+			;;
67
+		*)
68
+			extraBuildTags+=' seccomp'
69
+			runcBuildTags="apparmor selinux seccomp"
70
+			;;
71
+	esac
72
+
73
+	# update and install packages
74
+	echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile"
75
+
76
+	echo >> "$version/Dockerfile"
77
+
78
+	awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile >> "$version/Dockerfile"
79
+	echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
80
+	echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
81
+
82
+	echo >> "$version/Dockerfile"
83
+
84
+	echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile"
85
+
86
+	echo >> "$version/Dockerfile"
87
+
88
+	# print build tags in alphabetical order
89
+	buildTags=$( echo "apparmor selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' )
90
+
91
+	echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile"
92
+	echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile"
93
+done
0 94
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+#
1
+# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/s390x/generate.sh"!
2
+#
3
+
4
+FROM s390x/ubuntu:xenial
5
+
6
+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/*
7
+
8
+ENV GO_VERSION 1.7.1
9
+RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local
10
+ENV PATH $PATH:/usr/local/go/bin
11
+
12
+ENV AUTO_GOPATH 1
13
+
14
+ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux
15
+ENV RUNC_BUILDTAGS apparmor selinux