Browse code

ppc64le rpmbuild

Add support for 'make rpm' on ppc64le. Currently only fedora 24.

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>

Christy Perez authored on 2016/09/29 07:30:46
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-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/ppc64le/generate.sh"!
2
+#
3
+
4
+FROM ppc64le/fedora:24
5
+
6
+RUN dnf -y upgrade
7
+RUN dnf install -y @development-tools fedora-packager
8
+RUN dnf 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
9
+
10
+ENV GO_VERSION 1.7.4
11
+RUN curl -fsSL "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
+
0 19
new file mode 100755
... ...
@@ -0,0 +1,103 @@
0
+#!/bin/bash
1
+set -e
2
+
3
+# usage: ./generate.sh [versions]
4
+#    ie: ./generate.sh
5
+#        to update all Dockerfiles in this directory
6
+#    or: ./generate.sh
7
+#        to only update fedora-23/Dockerfile
8
+#    or: ./generate.sh fedora-newversion
9
+#        to create a new folder and a Dockerfile within it
10
+
11
+cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
12
+
13
+versions=( "$@" )
14
+if [ ${#versions[@]} -eq 0 ]; then
15
+	versions=( */ )
16
+fi
17
+versions=( "${versions[@]%/}" )
18
+
19
+for version in "${versions[@]}"; do
20
+	distro="${version%-*}"
21
+	suite="${version##*-}"
22
+	from="${distro}:${suite}"
23
+	installer=yum
24
+	if [[ "$distro" == "fedora" ]]; then
25
+		installer=dnf
26
+	fi
27
+
28
+	mkdir -p "$version"
29
+	echo "$version -> FROM $from"
30
+	cat > "$version/Dockerfile" <<-EOF
31
+		#
32
+		# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/ppc64le/generate.sh"!
33
+		#
34
+
35
+		FROM ppc64le/$from
36
+	EOF
37
+
38
+	echo >> "$version/Dockerfile"
39
+
40
+	extraBuildTags='pkcs11'
41
+	runcBuildTags=
42
+
43
+	case "$from" in
44
+		# add centos and opensuse tools install bits later
45
+		fedora:*)
46
+			echo "RUN ${installer} -y upgrade" >> "$version/Dockerfile"
47
+			echo "RUN ${installer} install -y @development-tools fedora-packager" >> "$version/Dockerfile"
48
+			;;
49
+	esac
50
+
51
+	# this list is sorted alphabetically; please keep it that way
52
+	packages=(
53
+		btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible)
54
+		device-mapper-devel # for "libdevmapper.h"
55
+		glibc-static
56
+		libseccomp-devel # for "seccomp.h" & "libseccomp.so"
57
+		libselinux-devel # for "libselinux.so"
58
+		libtool-ltdl-devel # for pkcs11 "ltdl.h"
59
+		pkgconfig # for the pkg-config command
60
+		selinux-policy
61
+		selinux-policy-devel
62
+		sqlite-devel # for "sqlite3.h"
63
+		systemd-devel # for "sd-journal.h" and libraries
64
+		tar # older versions of dev-tools do not have tar
65
+		git # required for containerd and runc clone
66
+		cmake # tini build
67
+	)
68
+
69
+	# opensuse does not have the right libseccomp libs
70
+	case "$from" in
71
+		# add opensuse libseccomp package substitution when adding build support
72
+		*)
73
+			extraBuildTags+=' seccomp'
74
+			runcBuildTags="seccomp selinux"
75
+			;;
76
+	esac
77
+
78
+	case "$from" in
79
+		# add opensuse btrfs package substitution when adding build support
80
+		*)
81
+			echo "RUN ${installer} install -y ${packages[*]}" >> "$version/Dockerfile"
82
+			;;
83
+	esac
84
+
85
+	echo >> "$version/Dockerfile"
86
+
87
+	awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile >> "$version/Dockerfile"
88
+	echo 'RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
89
+	echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
90
+	echo >> "$version/Dockerfile"	
91
+
92
+	echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile"
93
+	echo >> "$version/Dockerfile"
94
+
95
+	# print build tags in alphabetical order
96
+	buildTags=$( echo "selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' )
97
+
98
+	echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile"
99
+	echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile"
100
+	echo >> "$version/Dockerfile"
101
+
102
+done