1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #16328 from jfrazelle/opensuse-rpms

add opensuse to rpm builder
This commit is contained in:
David Calavera 2015-09-22 15:59:49 -07:00
commit b0dc11127e
5 changed files with 45 additions and 7 deletions

View file

@ -47,6 +47,10 @@ for version in "${versions[@]}"; do
# get "Development Tools" packages and dependencies
echo 'RUN yum groupinstall -y "Development Tools"' >> "$version/Dockerfile"
;;
opensuse:*)
# get rpm-build and curl packages and dependencies
echo 'RUN zypper install -n ca-certificates* curl gzip rpm-build' >> "$version/Dockerfile"
;;
*)
echo 'RUN yum install -y @development-tools fedora-packager' >> "$version/Dockerfile"
;;
@ -70,7 +74,17 @@ for version in "${versions[@]}"; do
packages=( --enablerepo=ol7_optional_latest "${packages[*]}" )
;;
esac
echo "RUN yum install -y ${packages[*]}" >> "$version/Dockerfile"
case "$from" in
opensuse:*)
packages=( "${packages[@]/btrfs-progs-devel/libbtrfs-devel}" )
# use zypper
echo "RUN zypper install -n ${packages[*]}" >> "$version/Dockerfile"
;;
*)
echo "RUN yum install -y ${packages[*]}" >> "$version/Dockerfile"
;;
esac
echo >> "$version/Dockerfile"

View file

@ -0,0 +1,15 @@
#
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/generate.sh"!
#
FROM opensuse:13.2
RUN zypper install -n ca-certificates* curl gzip rpm-build
RUN zypper install -n libbtrfs-devel device-mapper-devel glibc-static libselinux-devel selinux-policy selinux-policy-devel sqlite-devel tar
ENV GO_VERSION 1.4.2
RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
ENV PATH $PATH:/usr/local/go/bin
ENV AUTO_GOPATH 1
ENV DOCKER_BUILDTAGS selinux

View file

@ -17,7 +17,7 @@ Packager: Docker <support@docker.com>
%global debug_package %{nil}
# is_systemd conditional
%if 0%{?fedora} >= 21 || 0%{?centos} >= 7 || 0%{?rhel} >= 7
%if 0%{?fedora} >= 21 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1300
%global is_systemd 1
%endif
@ -26,8 +26,10 @@ Packager: Docker <support@docker.com>
# only require systemd on those systems
%if 0%{?is_systemd}
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(libsystemd-journal)
Requires: systemd-units
%if !0%{?suse_version}
BuildRequires: pkgconfig(libsystemd-journal)
%endif
%else
Requires(post): chkconfig
Requires(preun): chkconfig
@ -102,6 +104,7 @@ depending on a particular stack or provider.
%endif
%build
export DOCKER_GITCOMMIT=%{_gitcommit}
./hack/make.sh dynbinary
# ./man/md2man-all.sh runs outside the build container (if at all), since we don't have go-md2man here

View file

@ -24,6 +24,11 @@ set -e
rpmRelease="0.${rcVersion}.rc${rcVersion}"
fi
DOCKER_GITCOMMIT=$(git rev-parse --short HEAD)
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
DOCKER_GITCOMMIT="$DOCKER_GITCOMMIT-dirty"
fi
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
if [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
gitUnix="$(git log -1 --pretty='%at')"
@ -60,7 +65,8 @@ set -e
echo 'ENV DOCKER_EXPERIMENTAL 1' >> "$DEST/$version/Dockerfile.build"
fi
cat >> "$DEST/$version/Dockerfile.build" <<-EOF
RUN mkdir -p /root/rpmbuild/SOURCES
RUN mkdir -p /root/rpmbuild/SOURCES \
&& echo '%_topdir /root/rpmbuild' > /root/.rpmmacros
WORKDIR /root/rpmbuild
RUN ln -sfv /usr/src/${rpmName}/hack/make/.build-rpm SPECS
WORKDIR /root/rpmbuild/SPECS
@ -70,11 +76,11 @@ set -e
EOF
# selinux policy referencing systemd things won't work on non-systemd versions
# of centos or rhel, which we don't support anyways
if [ "$suite" -gt 6 ]; then
if [ "${suite%.*}" -gt 6 ] && [[ "$version" != opensuse* ]]; then
cat >> "$DEST/$version/Dockerfile.build" <<-EOF
RUN tar -cz -C /usr/src/${rpmName}/contrib -f /root/rpmbuild/SOURCES/${rpmName}-selinux.tar.gz ${rpmName}-selinux
RUN { echo '* $rpmDate $rpmPackager $rpmVersion-$rpmRelease'; echo '* Version: $VERSION'; } >> ${rpmName}-selinux.spec && tail >&2 ${rpmName}-selinux.spec
RUN rpmbuild -ba --define '_release $rpmRelease' --define '_version $rpmVersion' --define '_origversion $VERSION' ${rpmName}-selinux.spec
RUN rpmbuild -ba --define '_gitcommit $DOCKER_GITCOMMIT' --define '_release $rpmRelease' --define '_version $rpmVersion' --define '_origversion $VERSION' ${rpmName}-selinux.spec
EOF
fi
tempImage="docker-temp/build-rpm:$version"

View file

@ -18,7 +18,7 @@ set -e
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo
# manage the repos for each distribution separately
distros=( fedora centos oraclelinux )
distros=( fedora centos opensuse oraclelinux )
# get the release
release="main"