Merge pull request #29377 from andrewhsu/require-docker-selinux

[1.12.x] depend on docker-selinux for centos-7.3+
This commit is contained in:
Victor Vieux 2016-12-13 22:25:21 -08:00 committed by GitHub
commit 5fb9e4926a
8 changed files with 11 additions and 7 deletions

View File

@ -86,7 +86,11 @@ Requires: device-mapper >= 1.02.90-2
# RE: rhbz#1195804 - ensure min NVR for selinux-policy
%if 0%{?with_selinux}
Requires: selinux-policy >= %{selinux_policyver}
%if 0%{?centos} >= 7
Requires(pre): docker-selinux
%else
Requires(pre): %{name}-selinux >= %{version}-%{release}
%endif # centos 7+
%endif # with_selinux
# conflicting packages

View File

@ -132,13 +132,12 @@ set -e
--define '_experimental ${DOCKER_EXPERIMENTAL:-0}' \
${rpmName}.spec
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 ] && [[ "$version" != opensuse* ]]; then
selinuxDir="selinux"
if [ -d "./contrib/selinux-$version" ]; then
selinuxDir="selinux-${version}"
fi
# by default do not create selinux rpm
# if there exists a selinux policy dir specifically for distro version
# then build a selinux rpm with the policy in the policy dir
if [ -d "./contrib/selinux-$version" ]; then
selinuxDir="selinux-${version}"
cat >> "$DEST/$version/Dockerfile.build" <<-EOF
RUN tar -cz -C /usr/src/${rpmName}/contrib/${selinuxDir} -f /root/rpmbuild/SOURCES/${rpmName}-selinux.tar.gz ${rpmName}-selinux
RUN rpmbuild -ba \
@ -149,6 +148,7 @@ set -e
${rpmName}-selinux.spec
EOF
fi
tempImage="docker-temp/build-rpm:$version"
( set -x && docker build -t "$tempImage" -f $DEST/$version/Dockerfile.build . )
docker run --rm "$tempImage" bash -c 'cd /root/rpmbuild && tar -c *RPMS' | tar -xvC "$DEST/$version"