Browse code

adding rpm builds for ppc64le and s390x

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Signed-off-by: Dominik Dingel <dingel@de.ibm.com>
Signed-off-by: Thorsten Winkler <thorsten.winkler@de.ibm.com>
Signed-off-by: Utz Bacher <utz.bacher@de.ibm.com>

Utz Bacher authored on 2017/05/10 06:56:08
Showing 7 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+#
1
+# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/ppc64le/generate.sh"!
2
+#
3
+
4
+FROM ppc64le/centos:7
5
+
6
+RUN yum groupinstall -y "Development Tools"
7
+RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs
8
+RUN yum install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
9
+
10
+ENV GO_VERSION 1.8.1
11
+RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local
12
+ENV PATH $PATH:/usr/local/go/bin
13
+
14
+ENV AUTO_GOPATH 1
15
+
16
+ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux
17
+ENV RUNC_BUILDTAGS seccomp selinux
18
+
... ...
@@ -4,8 +4,8 @@ set -e
4 4
 # usage: ./generate.sh [versions]
5 5
 #    ie: ./generate.sh
6 6
 #        to update all Dockerfiles in this directory
7
-#    or: ./generate.sh
8
-#        to only update fedora-23/Dockerfile
7
+#    or: ./generate.sh centos-7
8
+#        to only update centos-7/Dockerfile
9 9
 #    or: ./generate.sh fedora-newversion
10 10
 #        to create a new folder and a Dockerfile within it
11 11
 
... ...
@@ -20,8 +20,9 @@ versions=( "${versions[@]%/}" )
20 20
 for version in "${versions[@]}"; do
21 21
 	distro="${version%-*}"
22 22
 	suite="${version##*-}"
23
-	from="${distro}:${suite}"
23
+	from="ppc64le/${distro}:${suite}"
24 24
 	installer=yum
25
+
25 26
 	if [[ "$distro" == "fedora" ]]; then
26 27
 		installer=dnf
27 28
 	fi
... ...
@@ -33,7 +34,7 @@ for version in "${versions[@]}"; do
33 33
 		# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/ppc64le/generate.sh"!
34 34
 		#
35 35
 
36
-		FROM ppc64le/$from
36
+		FROM $from
37 37
 	EOF
38 38
 
39 39
 	echo >> "$version/Dockerfile"
... ...
@@ -42,14 +43,33 @@ for version in "${versions[@]}"; do
42 42
 	runcBuildTags=
43 43
 
44 44
 	case "$from" in
45
-		# add centos and opensuse tools install bits later
46
-		fedora:*)
45
+		ppc64le/fedora:*)
47 46
 			echo "RUN ${installer} -y upgrade" >> "$version/Dockerfile"
47
+			;;
48
+		*) ;;
49
+	esac
50
+
51
+	case "$from" in
52
+		ppc64le/centos:*)
53
+			# get "Development Tools" packages dependencies
54
+			echo 'RUN yum groupinstall -y "Development Tools"' >> "$version/Dockerfile"
55
+
56
+			if [[ "$version" == "centos-7" ]]; then
57
+				echo 'RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs' >> "$version/Dockerfile"
58
+			fi
59
+			;;
60
+		ppc64le/opensuse:*)
61
+			# Add the ppc64le repo (hopefully the image is updated soon)
62
+			# get rpm-build and curl packages and dependencies
63
+			echo "RUN zypper addrepo -n ppc64le-oss -f https://download.opensuse.org/ports/ppc/distribution/leap/${suite}/repo/oss/ ppc64le-oss"  >> "$version/Dockerfile"
64
+			echo "RUN zypper addrepo -n ppc64le-updates -f https://download.opensuse.org/ports/update/${suite}/ ppc64le-updates" >> "$version/Dockerfile"
65
+			echo 'RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build' >> "$version/Dockerfile"
66
+			;;
67
+		*)
48 68
 			echo "RUN ${installer} install -y @development-tools fedora-packager" >> "$version/Dockerfile"
49 69
 			;;
50 70
 	esac
51 71
 
52
-	# this list is sorted alphabetically; please keep it that way
53 72
 	packages=(
54 73
 		btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible)
55 74
 		device-mapper-devel # for "libdevmapper.h"
... ...
@@ -60,15 +80,20 @@ for version in "${versions[@]}"; do
60 60
 		pkgconfig # for the pkg-config command
61 61
 		selinux-policy
62 62
 		selinux-policy-devel
63
+		sqlite-devel # for "sqlite3.h"
63 64
 		systemd-devel # for "sd-journal.h" and libraries
64 65
 		tar # older versions of dev-tools do not have tar
65 66
 		git # required for containerd and runc clone
66 67
 		cmake # tini build
68
+		vim-common # tini build
67 69
 	)
68 70
 
69 71
 	# opensuse does not have the right libseccomp libs
70 72
 	case "$from" in
71
-		# add opensuse libseccomp package substitution when adding build support
73
+		ppc64le/opensuse:*)
74
+			packages=( "${packages[@]/libseccomp-devel}" )
75
+			runcBuildTags="selinux"
76
+			;;
72 77
 		*)
73 78
 			extraBuildTags+=' seccomp'
74 79
 			runcBuildTags="seccomp selinux"
... ...
@@ -76,7 +101,17 @@ for version in "${versions[@]}"; do
76 76
 	esac
77 77
 
78 78
 	case "$from" in
79
-		# add opensuse btrfs package substitution when adding build support
79
+		ppc64le/opensuse:*)
80
+			packages=( "${packages[@]/btrfs-progs-devel/libbtrfs-devel}" )
81
+			packages=( "${packages[@]/pkgconfig/pkg-config}" )
82
+			packages=( "${packages[@]/vim-common/vim}" )
83
+			if [[ "$from" == "ppc64le/opensuse:13."* ]]; then
84
+				packages+=( systemd-rpm-macros )
85
+			fi
86
+
87
+			# use zypper
88
+			echo "RUN zypper --non-interactive install ${packages[*]}" >> "$version/Dockerfile"
89
+			;;
80 90
 		*)
81 91
 			echo "RUN ${installer} install -y ${packages[*]}" >> "$version/Dockerfile"
82 92
 			;;
... ...
@@ -84,12 +119,15 @@ for version in "${versions[@]}"; do
84 84
 
85 85
 	echo >> "$version/Dockerfile"
86 86
 
87
+
87 88
 	awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.ppc64le >> "$version/Dockerfile"
88 89
 	echo 'RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
89 90
 	echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
90
-	echo >> "$version/Dockerfile"	
91
+
92
+	echo >> "$version/Dockerfile"
91 93
 
92 94
 	echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile"
95
+
93 96
 	echo >> "$version/Dockerfile"
94 97
 
95 98
 	# print build tags in alphabetical order
96 99
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+#
1
+# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/ppc64le/generate.sh"!
2
+#
3
+
4
+FROM ppc64le/opensuse:42.1
5
+
6
+RUN zypper addrepo -n ppc64le-oss -f https://download.opensuse.org/ports/ppc/distribution/leap/42.1/repo/oss/ ppc64le-oss
7
+RUN zypper addrepo -n ppc64le-updates -f https://download.opensuse.org/ports/update/42.1/ ppc64le-updates
8
+RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build
9
+RUN zypper --non-interactive install libbtrfs-devel device-mapper-devel glibc-static  libselinux-devel libtool-ltdl-devel pkg-config selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim
10
+
11
+ENV GO_VERSION 1.8.1
12
+RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local
13
+ENV PATH $PATH:/usr/local/go/bin
14
+
15
+ENV AUTO_GOPATH 1
16
+
17
+ENV DOCKER_BUILDTAGS pkcs11 selinux
18
+ENV RUNC_BUILDTAGS selinux
19
+
0 20
new file mode 100755
... ...
@@ -0,0 +1,10 @@
0
+#!/usr/bin/env 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-rpm:$(basename "$d")" "$d"
9
+done
0 10
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+#
1
+# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/s390x/generate.sh"!
2
+#
3
+
4
+FROM sinenomine/clefos-base-s390x
5
+
6
+
7
+RUN touch /var/lib/rpm/* && yum groupinstall -y "Development Tools"
8
+RUN touch /var/lib/rpm/* && yum install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
9
+
10
+ENV GO_VERSION 1.8.1
11
+RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local
12
+ENV PATH $PATH:/usr/local/go/bin
13
+
14
+ENV AUTO_GOPATH 1
15
+
16
+ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux
17
+ENV RUNC_BUILDTAGS seccomp selinux
18
+RUN ln -s /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc
0 19
new file mode 100755
... ...
@@ -0,0 +1,145 @@
0
+#!/usr/bin/env bash
1
+set -e
2
+
3
+# This file is used to auto-generate Dockerfiles for making rpms via 'make rpm'
4
+#
5
+# usage: ./generate.sh [versions]
6
+#    ie: ./generate.sh
7
+#        to update all Dockerfiles in this directory
8
+#    or: ./generate.sh centos-7
9
+#        to only update centos-7/Dockerfile
10
+#    or: ./generate.sh fedora-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
+	case "$distro" in
26
+		*opensuse*)
27
+		from="opensuse/s390x:tumbleweed"
28
+		;;
29
+	*clefos*)
30
+		from="sinenomine/${distro}"
31
+		;;
32
+	*)
33
+		echo No appropriate or supported image available.
34
+		exit 1
35
+		;;
36
+    esac
37
+	installer=yum
38
+
39
+	mkdir -p "$version"
40
+	echo "$version -> FROM $from"
41
+	cat > "$version/Dockerfile" <<-EOF
42
+		#
43
+		# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/s390x/generate.sh"!
44
+		#
45
+
46
+		FROM $from
47
+
48
+	EOF
49
+
50
+	echo >> "$version/Dockerfile"
51
+
52
+	extraBuildTags='pkcs11'
53
+	runcBuildTags=
54
+
55
+	case "$from" in
56
+		*clefos*)
57
+			# Fix for RHBZ #1213602 + get "Development Tools" packages dependencies
58
+			echo 'RUN touch /var/lib/rpm/* && yum groupinstall -y "Development Tools"' >> "$version/Dockerfile"
59
+			;;
60
+		*opensuse*)
61
+			echo "RUN zypper ar https://download.opensuse.org/ports/zsystems/tumbleweed/repo/oss/ tumbleweed" >> "$version/Dockerfile"
62
+			# get rpm-build and curl packages and dependencies
63
+			echo 'RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build' >> "$version/Dockerfile"
64
+			;;
65
+		*)
66
+			echo No appropriate or supported image available.
67
+			exit 1
68
+			;;
69
+	esac
70
+
71
+	packages=(
72
+		btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible)
73
+		device-mapper-devel # for "libdevmapper.h"
74
+		glibc-static
75
+		libseccomp-devel # for "seccomp.h" & "libseccomp.so"
76
+		libselinux-devel # for "libselinux.so"
77
+		libtool-ltdl-devel # for pkcs11 "ltdl.h"
78
+		pkgconfig # for the pkg-config command
79
+		selinux-policy
80
+		selinux-policy-devel
81
+		sqlite-devel # for "sqlite3.h"
82
+		systemd-devel # for "sd-journal.h" and libraries
83
+		tar # older versions of dev-tools do not have tar
84
+		git # required for containerd and runc clone
85
+		cmake # tini build
86
+		vim-common # tini build
87
+	)
88
+
89
+	case "$from" in
90
+		*clefos*)
91
+			extraBuildTags+=' seccomp'
92
+			runcBuildTags="seccomp selinux"
93
+			;;
94
+		*opensuse*)
95
+			packages=( "${packages[@]/libseccomp-devel}" )
96
+			runcBuildTags="selinux"
97
+			;;
98
+		*)
99
+			echo No appropriate or supported image available.
100
+			exit 1
101
+			;;
102
+	esac
103
+
104
+	case "$from" in
105
+		*clefos*)
106
+			# Same RHBZ fix needed on all yum lines
107
+			echo "RUN touch /var/lib/rpm/* && ${installer} install -y ${packages[*]}" >> "$version/Dockerfile"
108
+			;;
109
+		*opensuse*)
110
+			packages=( "${packages[@]/btrfs-progs-devel/libbtrfs-devel}" )
111
+			packages=( "${packages[@]/pkgconfig/pkg-config}" )
112
+			packages=( "${packages[@]/vim-common/vim}" )
113
+
114
+			packages+=( systemd-rpm-macros ) # for use of >= opensuse:13.*
115
+
116
+			# use zypper
117
+			echo "RUN zypper --non-interactive install ${packages[*]}" >> "$version/Dockerfile"
118
+			;;
119
+		*)
120
+			echo No appropriate or supported image available.
121
+			exit 1
122
+			;;
123
+	esac
124
+
125
+	echo >> "$version/Dockerfile"
126
+
127
+	awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.s390x >> "$version/Dockerfile"
128
+	echo 'RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
129
+	echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
130
+
131
+	echo >> "$version/Dockerfile"
132
+
133
+	echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile"
134
+
135
+	echo >> "$version/Dockerfile"
136
+
137
+	# print build tags in alphabetical order
138
+	buildTags=$( echo "selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' )
139
+
140
+	echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile"
141
+	echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile"
142
+	# TODO: Investigate why "s390x-linux-gnu-gcc" is required
143
+	echo "RUN ln -s /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc" >> "$version/Dockerfile"
144
+done
0 145
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+#
1
+# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/s390x/generate.sh"!
2
+#
3
+
4
+FROM opensuse/s390x:tumbleweed
5
+
6
+
7
+RUN zypper ar https://download.opensuse.org/ports/zsystems/tumbleweed/repo/oss/ tumbleweed
8
+RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build
9
+RUN zypper --non-interactive install libbtrfs-devel device-mapper-devel glibc-static  libselinux-devel libtool-ltdl-devel pkg-config selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim systemd-rpm-macros
10
+
11
+ENV GO_VERSION 1.8.1
12
+RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local
13
+ENV PATH $PATH:/usr/local/go/bin
14
+
15
+ENV AUTO_GOPATH 1
16
+
17
+ENV DOCKER_BUILDTAGS pkcs11 selinux
18
+ENV RUNC_BUILDTAGS selinux
19
+RUN ln -s /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc