Skip to content

Commit

Permalink
Merge pull request #4601 from ssbarnea/fix/test-build-rpm-changes
Browse files Browse the repository at this point in the history
Enable multi-platform rpm building
  • Loading branch information
openshift-merge-robot authored Dec 5, 2019
2 parents 4fb724c + a03c3a9 commit 465e142
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ BUILDTAGS ?= \
exclude_graphdriver_devicemapper \
seccomp \
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 module support: set `-mod=vendor` to use the vendored sources
Expand Down Expand Up @@ -543,12 +545,19 @@ vendor-in-container:
install.libseccomp.sudo \
lint \
pause \
package \
package-install \
shell \
uninstall \
validate \
validate.completions \
vendor

rpm:
@echo "Building rpms ..."
package: ## Build rpm packages
## 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

package-install: package ## Install rpm packages
sudo ${PKG_MANAGER} -y install --allowerasing ${HOME}/rpmbuild/RPMS/*/*.rpm
32 changes: 14 additions & 18 deletions contrib/build_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pkg_manager=`command -v dnf yum | head -n1`
echo "Package manager binary: $pkg_manager"


if [ $pkg_manager == "*yum" ]; then
if [[ $pkg_manager == *yum ]]; then
echo "[virt7-container-common-candidate]
name=virt7-container-common-candidate
baseurl=https://cbs.centos.org/repos/virt7-container-common-candidate/x86_64/os/
Expand All @@ -28,34 +28,30 @@ declare -a PKGS=(device-mapper-devel \
go-compilers-golang-compiler \
)

if [ $pkg_manager == "*dnf" ]; then
if [[ $pkg_manager == *dnf ]]; then
PKGS+=(python3-devel \
python3-varlink \
)
# btrfs-progs-devel is not available in CentOS/RHEL-8
if ! grep -i -q 'Red Hat\|CentOS' /etc/redhat-release; then
PKGS+=(btrfs-progs-devel)
fi

fi

# golang-github-cpuguy83-go-md2man is needed for building man pages
# It is not available by default in CentOS 8 making it optional
if [ -z "$extra_arg" ]; then
PKGS+=(golang-github-cpuguy83-go-md2man)
# disable doc until go-md2man rpm becomes available
# disable debug to avoid error: Empty %files file ~/rpmbuild/BUILD/libpod-.../debugsourcefiles.list
export extra_arg="--without doc --without debug"
else
if ! grep -i -q 'Red Hat\|CentOS' /etc/redhat-release; then
PKGS+=(golang-github-cpuguy83-go-md2man)
fi
fi

echo ${PKGS[*]}
sudo $pkg_manager install -y ${PKGS[*]}

make -f .copr/Makefile
rpmbuild --rebuild ${extra_arg:-""} podman-*.src.rpm

# Test to make sure the install of the binary works
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*
# workaround for https://github.com/containers/libpod/issues/4627
if [ -d ~/rpmbuild/BUILD ]; then
chmod -R +w ~/rpmbuild/BUILD
fi

rpmbuild --rebuild ${extra_arg:-} podman-*.src.rpm
4 changes: 3 additions & 1 deletion install.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ system](https://bodhi.fedoraproject.org/updates/?packages=podman).

**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
sudo yum install -y \
Expand Down

0 comments on commit 465e142

Please sign in to comment.