Merge pull request #4601 from ssbarnea/fix/test-build-rpm-changes

Enable multi-platform rpm building
This commit is contained in:
OpenShift Merge Robot 2019-12-05 09:06:20 -08:00 committed by GitHub
commit 465e142bf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 22 deletions

View File

@ -32,7 +32,9 @@ BUILDTAGS ?= \
exclude_graphdriver_devicemapper \ exclude_graphdriver_devicemapper \
seccomp \ seccomp \
varlink varlink
PYTHON ?= $(shell command -v python python3) PYTHON ?= $(shell command -v python python3|head -n1)
PKG_MANAGER ?= $(shell command -v dnf yum|head -n1)
GO_BUILD=$(GO) build GO_BUILD=$(GO) build
# Go module support: set `-mod=vendor` to use the vendored sources # Go module support: set `-mod=vendor` to use the vendored sources
@ -543,12 +545,19 @@ vendor-in-container:
install.libseccomp.sudo \ install.libseccomp.sudo \
lint \ lint \
pause \ pause \
package \
package-install \
shell \ shell \
uninstall \ uninstall \
validate \ validate \
validate.completions \ validate.completions \
vendor vendor
rpm: package: ## Build rpm packages
@echo "Building rpms ..." ## TODO(ssbarnea): make version number predictable, it should not change
## on each execution, producing duplicates.
rm -f ~/rpmbuild/RPMS/x86_64/* ~/rpmbuild/RPMS/noarch/*
./contrib/build_rpm.sh ./contrib/build_rpm.sh
package-install: package ## Install rpm packages
sudo ${PKG_MANAGER} -y install --allowerasing ${HOME}/rpmbuild/RPMS/*/*.rpm

View File

@ -6,7 +6,7 @@ pkg_manager=`command -v dnf yum | head -n1`
echo "Package manager binary: $pkg_manager" echo "Package manager binary: $pkg_manager"
if [ $pkg_manager == "*yum" ]; then if [[ $pkg_manager == *yum ]]; then
echo "[virt7-container-common-candidate] echo "[virt7-container-common-candidate]
name=virt7-container-common-candidate name=virt7-container-common-candidate
baseurl=https://cbs.centos.org/repos/virt7-container-common-candidate/x86_64/os/ baseurl=https://cbs.centos.org/repos/virt7-container-common-candidate/x86_64/os/
@ -28,7 +28,7 @@ declare -a PKGS=(device-mapper-devel \
go-compilers-golang-compiler \ go-compilers-golang-compiler \
) )
if [ $pkg_manager == "*dnf" ]; then if [[ $pkg_manager == *dnf ]]; then
PKGS+=(python3-devel \ PKGS+=(python3-devel \
python3-varlink \ python3-varlink \
) )
@ -36,26 +36,22 @@ if [ $pkg_manager == "*dnf" ]; then
if ! grep -i -q 'Red Hat\|CentOS' /etc/redhat-release; then if ! grep -i -q 'Red Hat\|CentOS' /etc/redhat-release; then
PKGS+=(btrfs-progs-devel) PKGS+=(btrfs-progs-devel)
fi fi
# disable doc until go-md2man rpm becomes available
fi # disable debug to avoid error: Empty %files file ~/rpmbuild/BUILD/libpod-.../debugsourcefiles.list
export extra_arg="--without doc --without debug"
# golang-github-cpuguy83-go-md2man is needed for building man pages else
# It is not available by default in CentOS 8 making it optional if ! grep -i -q 'Red Hat\|CentOS' /etc/redhat-release; then
if [ -z "$extra_arg" ]; then PKGS+=(golang-github-cpuguy83-go-md2man)
PKGS+=(golang-github-cpuguy83-go-md2man) fi
fi fi
echo ${PKGS[*]} echo ${PKGS[*]}
sudo $pkg_manager install -y ${PKGS[*]} sudo $pkg_manager install -y ${PKGS[*]}
make -f .copr/Makefile make -f .copr/Makefile
rpmbuild --rebuild ${extra_arg:-""} podman-*.src.rpm # workaround for https://github.com/containers/libpod/issues/4627
if [ -d ~/rpmbuild/BUILD ]; then
# Test to make sure the install of the binary works chmod -R +w ~/rpmbuild/BUILD
sudo $pkg_manager -y install ~/rpmbuild/RPMS/x86_64/podman-*.x86_64.rpm
# If we built python/varlink packages, we should test their installs too
if [ $pkg_manager == "*dnf" ]; then
sudo $pkg_manager -y install ~/rpmbuild/RPMS/noarch/python*
fi fi
rpmbuild --rebuild ${extra_arg:-} podman-*.src.rpm

View File

@ -95,7 +95,9 @@ system](https://bodhi.fedoraproject.org/updates/?packages=podman).
**Required** **Required**
Fedora, CentOS, RHEL, and related distributions: Fedora, CentOS, RHEL, and related distributions you should try to run
`make package-install` which will install dependencies, build the source,
produce rpms for the current platform and install them in the end.
```bash ```bash
sudo yum install -y \ sudo yum install -y \