Merge pull request #33167 from utzb/rpmbuilds

adding rpm builds for ppc64le and s390x
This commit is contained in:
Sebastiaan van Stijn 2017-05-24 17:24:23 +01:00 committed by GitHub
commit 4050e3061c
7 changed files with 281 additions and 10 deletions

View file

@ -0,0 +1,19 @@
#
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/ppc64le/generate.sh"!
#
FROM ppc64le/centos:7
RUN yum groupinstall -y "Development Tools"
RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs
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
ENV GO_VERSION 1.8.1
RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local
ENV PATH $PATH:/usr/local/go/bin
ENV AUTO_GOPATH 1
ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux
ENV RUNC_BUILDTAGS seccomp selinux

View file

@ -4,8 +4,8 @@ set -e
# usage: ./generate.sh [versions] # usage: ./generate.sh [versions]
# ie: ./generate.sh # ie: ./generate.sh
# to update all Dockerfiles in this directory # to update all Dockerfiles in this directory
# or: ./generate.sh # or: ./generate.sh centos-7
# to only update fedora-23/Dockerfile # to only update centos-7/Dockerfile
# or: ./generate.sh fedora-newversion # or: ./generate.sh fedora-newversion
# to create a new folder and a Dockerfile within it # to create a new folder and a Dockerfile within it
@ -20,8 +20,9 @@ versions=( "${versions[@]%/}" )
for version in "${versions[@]}"; do for version in "${versions[@]}"; do
distro="${version%-*}" distro="${version%-*}"
suite="${version##*-}" suite="${version##*-}"
from="${distro}:${suite}" from="ppc64le/${distro}:${suite}"
installer=yum installer=yum
if [[ "$distro" == "fedora" ]]; then if [[ "$distro" == "fedora" ]]; then
installer=dnf installer=dnf
fi fi
@ -33,7 +34,7 @@ for version in "${versions[@]}"; do
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/ppc64le/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/ppc64le/generate.sh"!
# #
FROM ppc64le/$from FROM $from
EOF EOF
echo >> "$version/Dockerfile" echo >> "$version/Dockerfile"
@ -42,14 +43,33 @@ for version in "${versions[@]}"; do
runcBuildTags= runcBuildTags=
case "$from" in case "$from" in
# add centos and opensuse tools install bits later ppc64le/fedora:*)
fedora:*)
echo "RUN ${installer} -y upgrade" >> "$version/Dockerfile" echo "RUN ${installer} -y upgrade" >> "$version/Dockerfile"
;;
*) ;;
esac
case "$from" in
ppc64le/centos:*)
# get "Development Tools" packages dependencies
echo 'RUN yum groupinstall -y "Development Tools"' >> "$version/Dockerfile"
if [[ "$version" == "centos-7" ]]; then
echo 'RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs' >> "$version/Dockerfile"
fi
;;
ppc64le/opensuse:*)
# Add the ppc64le repo (hopefully the image is updated soon)
# get rpm-build and curl packages and dependencies
echo "RUN zypper addrepo -n ppc64le-oss -f https://download.opensuse.org/ports/ppc/distribution/leap/${suite}/repo/oss/ ppc64le-oss" >> "$version/Dockerfile"
echo "RUN zypper addrepo -n ppc64le-updates -f https://download.opensuse.org/ports/update/${suite}/ ppc64le-updates" >> "$version/Dockerfile"
echo 'RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build' >> "$version/Dockerfile"
;;
*)
echo "RUN ${installer} install -y @development-tools fedora-packager" >> "$version/Dockerfile" echo "RUN ${installer} install -y @development-tools fedora-packager" >> "$version/Dockerfile"
;; ;;
esac esac
# this list is sorted alphabetically; please keep it that way
packages=( packages=(
btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible) btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible)
device-mapper-devel # for "libdevmapper.h" device-mapper-devel # for "libdevmapper.h"
@ -60,15 +80,20 @@ for version in "${versions[@]}"; do
pkgconfig # for the pkg-config command pkgconfig # for the pkg-config command
selinux-policy selinux-policy
selinux-policy-devel selinux-policy-devel
sqlite-devel # for "sqlite3.h"
systemd-devel # for "sd-journal.h" and libraries systemd-devel # for "sd-journal.h" and libraries
tar # older versions of dev-tools do not have tar tar # older versions of dev-tools do not have tar
git # required for containerd and runc clone git # required for containerd and runc clone
cmake # tini build cmake # tini build
vim-common # tini build
) )
# opensuse does not have the right libseccomp libs # opensuse does not have the right libseccomp libs
case "$from" in case "$from" in
# add opensuse libseccomp package substitution when adding build support ppc64le/opensuse:*)
packages=( "${packages[@]/libseccomp-devel}" )
runcBuildTags="selinux"
;;
*) *)
extraBuildTags+=' seccomp' extraBuildTags+=' seccomp'
runcBuildTags="seccomp selinux" runcBuildTags="seccomp selinux"
@ -76,7 +101,17 @@ for version in "${versions[@]}"; do
esac esac
case "$from" in case "$from" in
# add opensuse btrfs package substitution when adding build support ppc64le/opensuse:*)
packages=( "${packages[@]/btrfs-progs-devel/libbtrfs-devel}" )
packages=( "${packages[@]/pkgconfig/pkg-config}" )
packages=( "${packages[@]/vim-common/vim}" )
if [[ "$from" == "ppc64le/opensuse:13."* ]]; then
packages+=( systemd-rpm-macros )
fi
# use zypper
echo "RUN zypper --non-interactive install ${packages[*]}" >> "$version/Dockerfile"
;;
*) *)
echo "RUN ${installer} install -y ${packages[*]}" >> "$version/Dockerfile" echo "RUN ${installer} install -y ${packages[*]}" >> "$version/Dockerfile"
;; ;;
@ -84,12 +119,15 @@ for version in "${versions[@]}"; do
echo >> "$version/Dockerfile" echo >> "$version/Dockerfile"
awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.ppc64le >> "$version/Dockerfile" awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.ppc64le >> "$version/Dockerfile"
echo 'RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" echo 'RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
echo >> "$version/Dockerfile"
echo >> "$version/Dockerfile"
echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile"
echo >> "$version/Dockerfile" echo >> "$version/Dockerfile"
# print build tags in alphabetical order # print build tags in alphabetical order

View file

@ -0,0 +1,20 @@
#
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/ppc64le/generate.sh"!
#
FROM ppc64le/opensuse:42.1
RUN zypper addrepo -n ppc64le-oss -f https://download.opensuse.org/ports/ppc/distribution/leap/42.1/repo/oss/ ppc64le-oss
RUN zypper addrepo -n ppc64le-updates -f https://download.opensuse.org/ports/update/42.1/ ppc64le-updates
RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build
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
ENV GO_VERSION 1.8.1
RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local
ENV PATH $PATH:/usr/local/go/bin
ENV AUTO_GOPATH 1
ENV DOCKER_BUILDTAGS pkcs11 selinux
ENV RUNC_BUILDTAGS selinux

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
set -x
./generate.sh
for d in */; do
docker build -t "dockercore/builder-rpm:$(basename "$d")" "$d"
done

View file

@ -0,0 +1,19 @@
#
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/s390x/generate.sh"!
#
FROM sinenomine/clefos-base-s390x
RUN touch /var/lib/rpm/* && yum groupinstall -y "Development Tools"
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
ENV GO_VERSION 1.8.1
RUN curl -fsSL "https://golang.org/dl/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 pkcs11 seccomp selinux
ENV RUNC_BUILDTAGS seccomp selinux
RUN ln -s /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc

View file

@ -0,0 +1,145 @@
#!/usr/bin/env bash
set -e
# This file is used to auto-generate Dockerfiles for making rpms via 'make rpm'
#
# usage: ./generate.sh [versions]
# ie: ./generate.sh
# to update all Dockerfiles in this directory
# or: ./generate.sh centos-7
# to only update centos-7/Dockerfile
# or: ./generate.sh fedora-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##*-}"
case "$distro" in
*opensuse*)
from="opensuse/s390x:tumbleweed"
;;
*clefos*)
from="sinenomine/${distro}"
;;
*)
echo No appropriate or supported image available.
exit 1
;;
esac
installer=yum
mkdir -p "$version"
echo "$version -> FROM $from"
cat > "$version/Dockerfile" <<-EOF
#
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/s390x/generate.sh"!
#
FROM $from
EOF
echo >> "$version/Dockerfile"
extraBuildTags='pkcs11'
runcBuildTags=
case "$from" in
*clefos*)
# Fix for RHBZ #1213602 + get "Development Tools" packages dependencies
echo 'RUN touch /var/lib/rpm/* && yum groupinstall -y "Development Tools"' >> "$version/Dockerfile"
;;
*opensuse*)
echo "RUN zypper ar https://download.opensuse.org/ports/zsystems/tumbleweed/repo/oss/ tumbleweed" >> "$version/Dockerfile"
# get rpm-build and curl packages and dependencies
echo 'RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build' >> "$version/Dockerfile"
;;
*)
echo No appropriate or supported image available.
exit 1
;;
esac
packages=(
btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible)
device-mapper-devel # for "libdevmapper.h"
glibc-static
libseccomp-devel # for "seccomp.h" & "libseccomp.so"
libselinux-devel # for "libselinux.so"
libtool-ltdl-devel # for pkcs11 "ltdl.h"
pkgconfig # for the pkg-config command
selinux-policy
selinux-policy-devel
sqlite-devel # for "sqlite3.h"
systemd-devel # for "sd-journal.h" and libraries
tar # older versions of dev-tools do not have tar
git # required for containerd and runc clone
cmake # tini build
vim-common # tini build
)
case "$from" in
*clefos*)
extraBuildTags+=' seccomp'
runcBuildTags="seccomp selinux"
;;
*opensuse*)
packages=( "${packages[@]/libseccomp-devel}" )
runcBuildTags="selinux"
;;
*)
echo No appropriate or supported image available.
exit 1
;;
esac
case "$from" in
*clefos*)
# Same RHBZ fix needed on all yum lines
echo "RUN touch /var/lib/rpm/* && ${installer} install -y ${packages[*]}" >> "$version/Dockerfile"
;;
*opensuse*)
packages=( "${packages[@]/btrfs-progs-devel/libbtrfs-devel}" )
packages=( "${packages[@]/pkgconfig/pkg-config}" )
packages=( "${packages[@]/vim-common/vim}" )
packages+=( systemd-rpm-macros ) # for use of >= opensuse:13.*
# use zypper
echo "RUN zypper --non-interactive install ${packages[*]}" >> "$version/Dockerfile"
;;
*)
echo No appropriate or supported image available.
exit 1
;;
esac
echo >> "$version/Dockerfile"
awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.s390x >> "$version/Dockerfile"
echo 'RUN curl -fsSL "https://golang.org/dl/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 "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"
# TODO: Investigate why "s390x-linux-gnu-gcc" is required
echo "RUN ln -s /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc" >> "$version/Dockerfile"
done

View file

@ -0,0 +1,20 @@
#
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/s390x/generate.sh"!
#
FROM opensuse/s390x:tumbleweed
RUN zypper ar https://download.opensuse.org/ports/zsystems/tumbleweed/repo/oss/ tumbleweed
RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build
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
ENV GO_VERSION 1.8.1
RUN curl -fsSL "https://golang.org/dl/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 pkcs11 selinux
ENV RUNC_BUILDTAGS selinux
RUN ln -s /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc