diff options
Diffstat (limited to 'contrib/build_rpm.sh')
-rwxr-xr-x[-rw-r--r--] | contrib/build_rpm.sh | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/contrib/build_rpm.sh b/contrib/build_rpm.sh index 1132ef380..e41763fa7 100644..100755 --- a/contrib/build_rpm.sh +++ b/contrib/build_rpm.sh @@ -1,15 +1,12 @@ #!/bin/bash -set -x - -pkg_manager=`command -v dnf` -if [ -z "$pkg_manager" ]; then - pkg_manager=`command -v yum` -fi +set -euxo pipefail +# returned path can vary: /usr/bin/dnf /bin/dnf ... +pkg_manager=`command -v dnf yum | head -n1` echo "Package manager binary: $pkg_manager" -if [ $pkg_manager == "/usr/bin/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/ @@ -22,35 +19,39 @@ declare -a PKGS=(device-mapper-devel \ glib2-devel \ glibc-static \ golang \ - golang-github-cpuguy83-go-md2man \ gpgme-devel \ libassuan-devel \ libseccomp-devel \ libselinux-devel \ make \ - golang-github-cpuguy83-go-md2man \ rpm-build \ - btrfs-progs-devel \ go-compilers-golang-compiler \ ) -if [ $pkg_manager == "/usr/bin/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 + # 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[*]} -$pkg_manager install -y ${PKGS[*]} +sudo $pkg_manager install -y ${PKGS[*]} make -f .copr/Makefile -rpmbuild --rebuild podman-*.src.rpm - -# Test to make sure the install of the binary works -$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 == "/usr/bin/dnf" ]; then - $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 |