summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-12-04 08:50:40 -0800
committerGitHub <noreply@github.com>2019-12-04 08:50:40 -0800
commit4dbab37e05d7daff858a8b1b968240dcf729d35a (patch)
tree636ceac41891af74aa9e816b58e9a02b7583d2d1
parente47b7a61d925475faea32a130296cd6a4d660af0 (diff)
parent578a836d7dcc657ee92863e5315ed12754f7a3ce (diff)
downloadpodman-4dbab37e05d7daff858a8b1b968240dcf729d35a.tar.gz
podman-4dbab37e05d7daff858a8b1b968240dcf729d35a.tar.bz2
podman-4dbab37e05d7daff858a8b1b968240dcf729d35a.zip
Merge pull request #4640 from ssbarnea/fix/dnf
Improve dnf tests inside build_rpm.sh
-rwxr-xr-x[-rw-r--r--]contrib/build_rpm.sh21
1 files changed, 9 insertions, 12 deletions
diff --git a/contrib/build_rpm.sh b/contrib/build_rpm.sh
index 507c03591..ceb4ca176 100644..100755
--- a/contrib/build_rpm.sh
+++ b/contrib/build_rpm.sh
@@ -1,15 +1,12 @@
#!/bin/bash
set -euxo pipefail
-pkg_manager=`command -v dnf`
-if [ -z "$pkg_manager" ]; then
- pkg_manager=`command -v yum`
-fi
-
+# 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/
@@ -31,11 +28,11 @@ declare -a PKGS=(device-mapper-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
+ # 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
@@ -49,16 +46,16 @@ if [ -z "$extra_arg" ]; then
fi
echo ${PKGS[*]}
-$pkg_manager install -y ${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
-$pkg_manager -y install ~/rpmbuild/RPMS/x86_64/podman-*.x86_64.rpm
+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 == "/usr/bin/dnf" ]; then
- $pkg_manager -y install ~/rpmbuild/RPMS/noarch/python*
+if [ $pkg_manager == "*dnf" ]; then
+ sudo $pkg_manager -y install ~/rpmbuild/RPMS/noarch/python*
fi